annotate lib/swig/swigwin-2.0.11/Lib/std/std_map.i @ 2276:e2433db49428

ActorHasItems
author Ritor1
date Fri, 14 Mar 2014 10:47:22 +0600
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 // std::map
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 %include <std_pair.i>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6 %include <std_container.i>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 %define %std_map_methods_common(map...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 %std_container_methods(map);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11 size_type erase(const key_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 size_type count(const key_type& x) const;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14 #ifdef SWIG_EXPORT_ITERATOR_METHODS
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 // iterator insert(iterator position, const value_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 void erase(iterator position);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17 void erase(iterator first, iterator last);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19 iterator find(const key_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 iterator lower_bound(const key_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 iterator upper_bound(const key_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 %define %std_map_methods(map...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 %std_map_methods_common(map);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 #ifdef SWIG_EXPORT_ITERATOR_METHODS
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 // iterator insert(const value_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 // ------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 // std::map
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 // const declarations are used to guess the intent of the function being
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 // exported; therefore, the following rationale is applied:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 // -- f(std::map<T>), f(const std::map<T>&):
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 // the parameter being read-only, either a sequence or a
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 // previously wrapped std::map<T> can be passed.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 // -- f(std::map<T>&), f(std::map<T>*):
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44 // the parameter may be modified; therefore, only a wrapped std::map
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 // can be passed.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 // -- std::map<T> f(), const std::map<T>& f():
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 // the map is returned by copy; therefore, a sequence of T:s
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 // is returned which is most easily used in other functions
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 // -- std::map<T>& f(), std::map<T>* f():
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 // the map is returned by reference; therefore, a wrapped std::map
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 // is returned
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 // -- const std::map<T>* f(), f(const std::map<T>*):
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 // for consistency, they expect and return a plain map pointer.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 // ------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57 #include <map>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 #include <algorithm>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59 #include <stdexcept>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 // exported class
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 namespace std {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 template<class _Key, class _Tp, class _Compare = std::less<_Key >,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 class _Alloc = allocator<std::pair<const _Key, _Tp > > >
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 class map {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 public:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 typedef size_t size_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 typedef ptrdiff_t difference_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 typedef _Key key_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 typedef _Tp mapped_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 typedef std::pair<const _Key, _Tp> value_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 typedef value_type* pointer;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77 typedef const value_type* const_pointer;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 typedef value_type& reference;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 typedef const value_type& const_reference;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 typedef _Alloc allocator_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 %traits_swigtype(_Key);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 %traits_swigtype(_Tp);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 %fragment(SWIG_Traits_frag(std::pair< _Key, _Tp >), "header",
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 fragment=SWIG_Traits_frag(_Key),
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87 fragment=SWIG_Traits_frag(_Tp),
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 fragment="StdPairTraits") {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 namespace swig {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 template <> struct traits<std::pair< _Key, _Tp > > {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 typedef pointer_category category;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92 static const char* type_name() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 return "std::pair<" #_Key "," #_Tp " >";
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 %fragment(SWIG_Traits_frag(std::map<_Key, _Tp, _Compare, _Alloc >), "header",
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 fragment=SWIG_Traits_frag(std::pair<_Key, _Tp >),
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 fragment="StdMapTraits") {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102 namespace swig {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 template <> struct traits<std::map<_Key, _Tp, _Compare, _Alloc > > {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 typedef pointer_category category;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 static const char* type_name() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106 return "std::map<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >";
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112 %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::map<_Key, _Tp, _Compare, _Alloc >);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114 map( const _Compare& );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116 #ifdef %swig_map_methods
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117 // Add swig/language extra methods
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 %swig_map_methods(std::map<_Key, _Tp, _Compare, _Alloc >);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 %std_map_methods(map);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124 }