OLD | NEW |
(Empty) | |
| 1 %include <exception.i> |
| 2 %include <std_container.i> |
| 3 %include <std_alloc.i> |
| 4 %include <std_char_traits.i> |
| 5 |
| 6 |
| 7 %{ |
| 8 #include <string> |
| 9 %} |
| 10 |
| 11 namespace std |
| 12 { |
| 13 %naturalvar basic_string; |
| 14 } |
| 15 |
| 16 |
| 17 namespace std { |
| 18 |
| 19 template <class _CharT, class _Traits = char_traits<_CharT>, typename _Alloc =
allocator<_CharT> > |
| 20 class basic_string |
| 21 { |
| 22 #if !defined(SWIG_STD_MODERN_STL) || defined(SWIG_STD_NOMODERN_STL) |
| 23 %ignore push_back; |
| 24 %ignore clear; |
| 25 %ignore compare; |
| 26 %ignore append; |
| 27 #endif |
| 28 |
| 29 public: |
| 30 typedef size_t size_type; |
| 31 typedef ptrdiff_t difference_type; |
| 32 typedef _CharT value_type; |
| 33 typedef value_type reference; |
| 34 typedef value_type const_reference; |
| 35 typedef _Alloc allocator_type; |
| 36 |
| 37 static const size_type npos; |
| 38 |
| 39 #ifdef SWIG_EXPORT_ITERATOR_METHODS |
| 40 class iterator; |
| 41 class reverse_iterator; |
| 42 class const_iterator; |
| 43 class const_reverse_iterator; |
| 44 #endif |
| 45 |
| 46 |
| 47 %traits_swigtype(_CharT); |
| 48 %fragment(SWIG_Traits_frag(_CharT)); |
| 49 |
| 50 |
| 51 basic_string(const _CharT* __s, size_type __n); |
| 52 |
| 53 // Capacity: |
| 54 |
| 55 size_type length() const; |
| 56 |
| 57 size_type max_size() const; |
| 58 |
| 59 size_type capacity() const; |
| 60 |
| 61 void reserve(size_type __res_arg = 0); |
| 62 |
| 63 |
| 64 // Modifiers: |
| 65 |
| 66 basic_string& |
| 67 append(const basic_string& __str); |
| 68 |
| 69 basic_string& |
| 70 append(const basic_string& __str, size_type __pos, size_type __n); |
| 71 |
| 72 basic_string& |
| 73 append(const _CharT* __s, size_type __n); |
| 74 |
| 75 basic_string& |
| 76 append(size_type __n, _CharT __c); |
| 77 |
| 78 basic_string& |
| 79 assign(const basic_string& __str); |
| 80 |
| 81 basic_string& |
| 82 assign(const basic_string& __str, size_type __pos, size_type __n); |
| 83 |
| 84 basic_string& |
| 85 assign(const _CharT* __s, size_type __n); |
| 86 |
| 87 basic_string& |
| 88 insert(size_type __pos1, const basic_string& __str); |
| 89 |
| 90 basic_string& |
| 91 insert(size_type __pos1, const basic_string& __str, |
| 92 size_type __pos2, size_type __n); |
| 93 |
| 94 basic_string& |
| 95 insert(size_type __pos, const _CharT* __s, size_type __n); |
| 96 |
| 97 basic_string& |
| 98 insert(size_type __pos, size_type __n, _CharT __c); |
| 99 |
| 100 basic_string& |
| 101 erase(size_type __pos = 0, size_type __n = npos); |
| 102 |
| 103 basic_string& |
| 104 replace(size_type __pos, size_type __n, const basic_string& __str); |
| 105 |
| 106 basic_string& |
| 107 replace(size_type __pos1, size_type __n1, const basic_string& __str, |
| 108 size_type __pos2, size_type __n2); |
| 109 |
| 110 basic_string& |
| 111 replace(size_type __pos, size_type __n1, const _CharT* __s, |
| 112 size_type __n2); |
| 113 |
| 114 basic_string& |
| 115 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c); |
| 116 |
| 117 |
| 118 size_type |
| 119 copy(_CharT* __s, size_type __n, size_type __pos = 0) const; |
| 120 |
| 121 // String operations: |
| 122 const _CharT* c_str() const; |
| 123 |
| 124 size_type |
| 125 find(const _CharT* __s, size_type __pos, size_type __n) const; |
| 126 |
| 127 size_type |
| 128 find(const basic_string& __str, size_type __pos = 0) const; |
| 129 |
| 130 size_type |
| 131 find(_CharT __c, size_type __pos = 0) const; |
| 132 |
| 133 size_type |
| 134 rfind(const basic_string& __str, size_type __pos = npos) const; |
| 135 |
| 136 size_type |
| 137 rfind(const _CharT* __s, size_type __pos, size_type __n) const; |
| 138 |
| 139 size_type |
| 140 rfind(_CharT __c, size_type __pos = npos) const; |
| 141 |
| 142 size_type |
| 143 find_first_of(const basic_string& __str, size_type __pos = 0) const; |
| 144 |
| 145 size_type |
| 146 find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; |
| 147 |
| 148 size_type |
| 149 find_first_of(_CharT __c, size_type __pos = 0) const; |
| 150 |
| 151 size_type |
| 152 find_last_of(const basic_string& __str, size_type __pos = npos) const; |
| 153 |
| 154 size_type |
| 155 find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; |
| 156 |
| 157 size_type |
| 158 find_last_of(_CharT __c, size_type __pos = npos) const; |
| 159 |
| 160 size_type |
| 161 find_first_not_of(const basic_string& __str, size_type __pos = 0) const; |
| 162 |
| 163 size_type |
| 164 find_first_not_of(const _CharT* __s, size_type __pos, |
| 165 size_type __n) const; |
| 166 |
| 167 size_type |
| 168 find_first_not_of(_CharT __c, size_type __pos = 0) const; |
| 169 |
| 170 size_type |
| 171 find_last_not_of(const basic_string& __str, size_type __pos = npos) const; |
| 172 |
| 173 size_type |
| 174 find_last_not_of(const _CharT* __s, size_type __pos, |
| 175 size_type __n) const; |
| 176 |
| 177 size_type |
| 178 find_last_not_of(_CharT __c, size_type __pos = npos) const; |
| 179 |
| 180 basic_string |
| 181 substr(size_type __pos = 0, size_type __n = npos) const; |
| 182 |
| 183 int |
| 184 compare(const basic_string& __str) const; |
| 185 |
| 186 int |
| 187 compare(size_type __pos, size_type __n, const basic_string& __str) const; |
| 188 |
| 189 int |
| 190 compare(size_type __pos1, size_type __n1, const basic_string& __str, |
| 191 size_type __pos2, size_type __n2) const; |
| 192 |
| 193 |
| 194 %ignore pop_back(); |
| 195 %ignore front() const; |
| 196 %ignore back() const; |
| 197 %ignore basic_string(size_type n); |
| 198 %std_sequence_methods_val(basic_string); |
| 199 |
| 200 |
| 201 %ignore pop(); |
| 202 |
| 203 |
| 204 #ifdef %swig_basic_string |
| 205 // Add swig/language extra methods |
| 206 %swig_basic_string(std::basic_string<_CharT, _Traits, _Alloc >); |
| 207 #endif |
| 208 |
| 209 #ifdef SWIG_EXPORT_ITERATOR_METHODS |
| 210 |
| 211 |
| 212 class iterator; |
| 213 class reverse_iterator; |
| 214 class const_iterator; |
| 215 class const_reverse_iterator; |
| 216 |
| 217 |
| 218 void |
| 219 insert(iterator __p, size_type __n, _CharT __c); |
| 220 |
| 221 basic_string& |
| 222 replace(iterator __i1, iterator __i2, const basic_string& __str); |
| 223 |
| 224 basic_string& |
| 225 replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n); |
| 226 |
| 227 basic_string& |
| 228 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c); |
| 229 |
| 230 |
| 231 basic_string& |
| 232 replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2
); |
| 233 |
| 234 basic_string& |
| 235 replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __
k2); |
| 236 #endif |
| 237 |
| 238 basic_string& operator +=(const basic_string& v); |
| 239 |
| 240 %newobject __add__; |
| 241 %newobject __radd__; |
| 242 %extend { |
| 243 |
| 244 std::basic_string<_CharT,_Traits,_Alloc >* __add__(const basic_string& v)
{ |
| 245 std::basic_string<_CharT,_Traits,_Alloc >* res = new std::basic_string<_
CharT,_Traits,_Alloc >(*self); |
| 246 *res += v; |
| 247 return res; |
| 248 } |
| 249 |
| 250 std::basic_string<_CharT,_Traits,_Alloc >* __radd__(const basic_string& v)
{ |
| 251 std::basic_string<_CharT,_Traits,_Alloc >* res = new std::basic_string<_
CharT,_Traits,_Alloc >(v); |
| 252 *res += *self; |
| 253 return res; |
| 254 } |
| 255 |
| 256 std::basic_string<_CharT,_Traits,_Alloc > __str__() { |
| 257 return *self; |
| 258 } |
| 259 |
| 260 std::basic_ostream<_CharT, std::char_traits<_CharT> >& |
| 261 __rlshift__(std::basic_ostream<_CharT, std::char_traits<_CharT> >& out)
{ |
| 262 out << *self; |
| 263 return out; |
| 264 } |
| 265 } |
| 266 |
| 267 }; |
| 268 } |
| 269 |
| 270 |
OLD | NEW |