Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.8 KiB

  1. //
  2. // std::map
  3. //
  4. %include <std_map.i>
  5. %define %std_multimap_methods(mmap...)
  6. %std_map_methods_common(mmap);
  7. #ifdef SWIG_EXPORT_ITERATOR_METHODS
  8. std::pair<iterator,iterator> equal_range(const key_type& x);
  9. std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const;
  10. #endif
  11. %enddef
  12. // ------------------------------------------------------------------------
  13. // std::multimap
  14. //
  15. // const declarations are used to guess the intent of the function being
  16. // exported; therefore, the following rationale is applied:
  17. //
  18. // -- f(std::multimap<T>), f(const std::multimap<T>&):
  19. // the parameter being read-only, either a sequence or a
  20. // previously wrapped std::multimap<T> can be passed.
  21. // -- f(std::multimap<T>&), f(std::multimap<T>*):
  22. // the parameter may be modified; therefore, only a wrapped std::multimap
  23. // can be passed.
  24. // -- std::multimap<T> f(), const std::multimap<T>& f():
  25. // the map is returned by copy; therefore, a sequence of T:s
  26. // is returned which is most easily used in other functions
  27. // -- std::multimap<T>& f(), std::multimap<T>* f():
  28. // the map is returned by reference; therefore, a wrapped std::multimap
  29. // is returned
  30. // -- const std::multimap<T>* f(), f(const std::multimap<T>*):
  31. // for consistency, they expect and return a plain map pointer.
  32. // ------------------------------------------------------------------------
  33. // exported class
  34. namespace std {
  35. template<class _Key, class _Tp, class _Compare = std::less<_Key >,
  36. class _Alloc = allocator<std::pair<const _Key, _Tp > > >
  37. class multimap {
  38. public:
  39. typedef size_t size_type;
  40. typedef ptrdiff_t difference_type;
  41. typedef _Key key_type;
  42. typedef _Tp mapped_type;
  43. typedef std::pair<const _Key, _Tp> value_type;
  44. typedef value_type* pointer;
  45. typedef const value_type* const_pointer;
  46. typedef value_type& reference;
  47. typedef const value_type& const_reference;
  48. typedef _Alloc allocator_type;
  49. %traits_swigtype(_Key);
  50. %traits_swigtype(_Tp);
  51. %fragment(SWIG_Traits_frag(std::multimap<_Key, _Tp, _Compare, _Alloc >), "header",
  52. fragment=SWIG_Traits_frag(std::pair<_Key, _Tp >),
  53. fragment="StdMultimapTraits") {
  54. namespace swig {
  55. template <> struct traits<std::multimap<_Key, _Tp, _Compare, _Alloc > > {
  56. typedef pointer_category category;
  57. static const char* type_name() {
  58. return "std::multimap<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >";
  59. }
  60. };
  61. }
  62. }
  63. %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::multimap<_Key, _Tp, _Compare, _Alloc >);
  64. multimap( const _Compare& );
  65. #ifdef %swig_multimap_methods
  66. // Add swig/language extra methods
  67. %swig_multimap_methods(std::multimap<_Key, _Tp, _Compare, _Alloc >);
  68. #endif
  69. %std_multimap_methods(multimap);
  70. };
  71. }