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