2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
32 /* _String_iterator<char> and _String_const_iterator<char> class */
33 /* char_traits<char> */
34 /* ?assign@?$char_traits@D@std@@SAXAADABD@Z */
35 /* ?assign@?$char_traits@D@std@@SAXAEADAEBD@Z */
36 static void MSVCP_char_traits_char_assign(char *ch, const char *assign)
41 /* ?length@?$char_traits@D@std@@SAIPBD@Z */
42 /* ?length@?$char_traits@D@std@@SA_KPEBD@Z */
43 static MSVCP_size_t MSVCP_char_traits_char_length(const char *str)
48 /* ?_Copy_s@?$char_traits@D@std@@SAPADPADIPBDI@Z */
49 /* ?_Copy_s@?$char_traits@D@std@@SAPEADPEAD_KPEBD1@Z */
50 static char* MSVCP_char_traits_char__Copy_s(char *dest,
51 MSVCP_size_t size, const char *src, MSVCP_size_t count)
53 if(!dest || !src || size<count) {
56 _invalid_parameter(NULL, NULL, NULL, 0, 0);
60 return memcpy(dest, src, count);
63 /* ?_Move_s@?$char_traits@D@std@@SAPADPADIPBDI@Z */
64 /* ?_Move_s@?$char_traits@D@std@@SAPEADPEAD_KPEBD1@Z */
65 static char* MSVCP_char_traits_char__Move_s(char *dest,
66 MSVCP_size_t size, const char *src, MSVCP_size_t count)
68 if(!dest || !src || size<count) {
71 _invalid_parameter(NULL, NULL, NULL, 0, 0);
75 return memmove(dest, src, count);
78 /* char_traits<wchar_t> */
79 /* ?assign@?$char_traits@_W@std@@SAXAA_WAB_W@Z */
80 /* ?assign@?$char_traits@_W@std@@SAXAEA_WAEB_W@Z */
81 static void MSVCP_char_traits_wchar_assign(wchar_t *ch,
82 const wchar_t *assign)
87 /* ?length@?$char_traits@_W@std@@SAIPB_W@Z */
88 /* ?length@?$char_traits@_W@std@@SA_KPEB_W@Z */
89 static MSVCP_size_t MSVCP_char_traits_wchar_length(const wchar_t *str)
91 return wcslen((WCHAR*)str);
94 /* ?_Copy_s@?$char_traits@_W@std@@SAPA_WPA_WIPB_WI@Z */
95 /* ?_Copy_s@?$char_traits@_W@std@@SAPEA_WPEA_W_KPEB_W1@Z */
96 static wchar_t* MSVCP_char_traits_wchar__Copy_s(wchar_t *dest,
97 MSVCP_size_t size, const wchar_t *src, MSVCP_size_t count)
99 if(!dest || !src || size<count) {
102 _invalid_parameter(NULL, NULL, NULL, 0, 0);
106 return memcpy(dest, src, count * sizeof(wchar_t));
109 /* ?_Move_s@?$char_traits@_W@std@@SAPA_WPA_WIPB_WI@Z */
110 /* ?_Move_s@?$char_traits@_W@std@@SAPEA_WPEA_W_KPEB_W1@Z */
111 static wchar_t* MSVCP_char_traits_wchar__Move_s(wchar_t *dest,
112 MSVCP_size_t size, const wchar_t *src, MSVCP_size_t count)
114 if(!dest || !src || size<count) {
117 _invalid_parameter(NULL, NULL, NULL, 0, 0);
121 return memmove(dest, src, count * sizeof(WCHAR));
125 /* ?_Xran@_String_base@std@@SAXXZ */
126 static void MSVCP__String_base_Xran(void)
128 static const char msg[] = "invalid string position";
131 throw_exception(EXCEPTION_OUT_OF_RANGE, msg);
135 /* basic_string<char, char_traits<char>, allocator<char>> */
136 /* ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB */
137 /* ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2_KB */
138 static const MSVCP_size_t MSVCP_basic_string_char_npos = -1;
140 /* ?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEPADXZ */
141 /* ?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAPEADXZ */
142 static char* basic_string_char_ptr(basic_string_char *this)
144 if(this->res == BUF_SIZE_CHAR-1)
145 return this->data.buf;
146 return this->data.ptr;
149 /* ?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IBEPBDXZ */
150 /* ?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEBAPEBDXZ */
151 static const char* basic_string_char_const_ptr(const basic_string_char *this)
153 if(this->res == BUF_SIZE_CHAR-1)
154 return this->data.buf;
155 return this->data.ptr;
158 /* ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXI@Z */
159 /* ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAX_K@Z */
160 static void basic_string_char_eos(basic_string_char *this, MSVCP_size_t len)
162 static const char nullbyte = '\0';
165 MSVCP_char_traits_char_assign(basic_string_char_ptr(this)+len, &nullbyte);
168 /* ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NPBD@Z */
169 /* ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAA_NPEBD@Z */
170 static MSVCP_bool basic_string_char_inside(
171 basic_string_char *this, const char *ptr)
173 char *cstr = basic_string_char_ptr(this);
175 return (ptr<cstr || ptr>=cstr+this->size) ? FALSE : TRUE;
178 /* ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEX_NI@Z */
179 /* ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAX_N_K@Z */
180 static void basic_string_char_tidy(basic_string_char *this,
181 MSVCP_bool built, MSVCP_size_t new_size)
183 if(built && BUF_SIZE_CHAR<=this->res) {
184 char *ptr = this->data.ptr;
187 MSVCP_char_traits_char__Copy_s(this->data.buf, BUF_SIZE_CHAR, ptr, new_size);
188 MSVCP_allocator_char_deallocate(this->allocator, ptr, this->res+1);
191 this->res = BUF_SIZE_CHAR-1;
192 basic_string_char_eos(this, new_size);
195 /* ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z */
196 /* ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAA_N_K_N@Z */
197 static MSVCP_bool basic_string_char_grow(
198 basic_string_char *this, MSVCP_size_t new_size, MSVCP_bool trim)
200 if(this->res < new_size) {
201 MSVCP_size_t new_res = new_size, len = this->size;
206 if(new_res/3 < this->res/2)
207 new_res = this->res + this->res/2;
209 ptr = MSVCP_allocator_char_allocate(this->allocator, new_res+1);
211 ptr = MSVCP_allocator_char_allocate(this->allocator, new_size+1);
215 ERR("Out of memory\n");
216 basic_string_char_tidy(this, TRUE, 0);
220 MSVCP_char_traits_char__Copy_s(ptr, new_size,
221 basic_string_char_ptr(this), this->size);
222 basic_string_char_tidy(this, TRUE, 0);
223 this->data.ptr = ptr;
224 this->res = new_size;
225 basic_string_char_eos(this, len);
226 } else if(trim && new_size < BUF_SIZE_CHAR)
227 basic_string_char_tidy(this, TRUE,
228 new_size<this->size ? new_size : this->size);
229 else if(new_size == 0)
230 basic_string_char_eos(this, 0);
235 /* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z */
236 /* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0@Z */
237 static basic_string_char* MSVCP_basic_string_char_erase(
238 basic_string_char *this, MSVCP_size_t pos, MSVCP_size_t len)
240 TRACE("%p %lu %lu\n", this, pos, len);
243 MSVCP__String_base_Xran();
245 if(len > this->size-pos)
246 len = this->size-pos;
249 MSVCP_char_traits_char__Move_s(basic_string_char_ptr(this)+pos,
250 this->res-pos, basic_string_char_ptr(this)+pos+len,
252 basic_string_char_eos(this, this->size-len);
258 /* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z */
259 /* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
260 static basic_string_char* MSVCP_basic_string_char_assign_substr(
261 basic_string_char *this, const basic_string_char *assign,
262 MSVCP_size_t pos, MSVCP_size_t len)
264 TRACE("%p %p %lu %lu\n", this, assign, pos, len);
266 if(assign->size < pos)
267 MSVCP__String_base_Xran();
269 if(len > assign->size-pos)
270 len = assign->size-pos;
273 MSVCP_basic_string_char_erase(this, pos+len, MSVCP_basic_string_char_npos);
274 MSVCP_basic_string_char_erase(this, 0, pos);
275 } else if(basic_string_char_grow(this, len, FALSE)) {
276 MSVCP_char_traits_char__Copy_s(basic_string_char_ptr(this),
277 this->res, basic_string_char_const_ptr(assign)+pos, len);
278 basic_string_char_eos(this, len);
284 /* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z */
285 /* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@AEBV01@@Z */
286 static basic_string_char* MSVCP_basic_string_char_assign(
287 basic_string_char *this, const basic_string_char *assign)
289 return MSVCP_basic_string_char_assign_substr(this, assign,
290 0, MSVCP_basic_string_char_npos);
293 /* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z */
294 /* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD_K@Z */
295 static basic_string_char* MSVCP_basic_string_char_assign_cstr_len(
296 basic_string_char *this, const char *str, MSVCP_size_t len)
298 TRACE("%p %s %lu\n", this, debugstr_an(str, len), len);
300 if(basic_string_char_inside(this, str))
301 return MSVCP_basic_string_char_assign_substr(this, this,
302 str-basic_string_char_ptr(this), len);
303 else if(basic_string_char_grow(this, len, FALSE)) {
304 MSVCP_char_traits_char__Copy_s(basic_string_char_ptr(this),
305 this->res, str, len);
306 basic_string_char_eos(this, len);
312 /* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z */
313 /* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@PEBD@Z */
314 static basic_string_char* MSVCP_basic_string_char_assign_cstr(
315 basic_string_char *this, const char *str)
317 return MSVCP_basic_string_char_assign_cstr_len(this, str,
318 MSVCP_char_traits_char_length(str));
321 /* ?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
322 /* ?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
323 /* ?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
324 /* ?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
325 const char* MSVCP_basic_string_char_c_str(const basic_string_char *this)
328 return basic_string_char_const_ptr(this);
331 /* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z */
332 /* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV01@@Z */
333 basic_string_char* MSVCP_basic_string_char_copy_ctor(
334 basic_string_char *this, const basic_string_char *copy)
336 TRACE("%p %p\n", this, copy);
338 basic_string_char_tidy(this, FALSE, 0);
339 MSVCP_basic_string_char_assign(this, copy);
343 /* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z */
344 /* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD@Z */
345 basic_string_char* MSVCP_basic_string_char_ctor_cstr(
346 basic_string_char *this, const char *str)
348 TRACE("%p %s\n", this, debugstr_a(str));
350 basic_string_char_tidy(this, FALSE, 0);
351 MSVCP_basic_string_char_assign_cstr(this, str);
355 /* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ */
356 /* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ */
357 void MSVCP_basic_string_char_dtor(basic_string_char *this)
360 basic_string_char_tidy(this, TRUE, 0);
363 /* ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
364 /* ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ */
365 /* ?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
366 /* ?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ */
367 MSVCP_size_t MSVCP_basic_string_char_length(const basic_string_char *this)
373 /* basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>> */
374 /* basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short>> */
375 /* ?npos@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@2IB */
376 /* ?npos@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@2_KB */
377 /* ?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2IB */
378 /* ?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2_KB */
379 const MSVCP_size_t MSVCP_basic_string_wchar_npos = -1;
381 /* ?_Myptr@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEPA_WXZ */
382 /* ?_Myptr@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAPEA_WXZ */
383 /* ?_Myptr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEPAGXZ */
384 /* ?_Myptr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAPEAGXZ */
385 static wchar_t* basic_string_wchar_ptr(basic_string_wchar *this)
387 if(this->res == BUF_SIZE_WCHAR-1)
388 return this->data.buf;
389 return this->data.ptr;
392 /* ?_Myptr@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IBEPB_WXZ */
393 /* ?_Myptr@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEBAPEB_WXZ */
394 /* ?_Myptr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IBEPBGXZ */
395 /* ?_Myptr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEBAPEBGXZ */
396 static const wchar_t* basic_string_wchar_const_ptr(const basic_string_wchar *this)
398 if(this->res == BUF_SIZE_WCHAR-1)
399 return this->data.buf;
400 return this->data.ptr;
403 /* ?_Eos@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXI@Z */
404 /* ?_Eos@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAX_K@Z */
405 /* ?_Eos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXI@Z */
406 /* ?_Eos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAX_K@Z */
407 static void basic_string_wchar_eos(basic_string_wchar *this, MSVCP_size_t len)
409 static const wchar_t nullbyte_w = '\0';
412 MSVCP_char_traits_wchar_assign(basic_string_wchar_ptr(this)+len, &nullbyte_w);
415 /* ?_Inside@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAE_NPB_W@Z */
416 /* ?_Inside@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAA_NPEB_W@Z */
417 /* ?_Inside@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAE_NPBG@Z */
418 /* ?_Inside@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAA_NPEBG@Z */
419 static MSVCP_bool basic_string_wchar_inside(
420 basic_string_wchar *this, const wchar_t *ptr)
422 wchar_t *cstr = basic_string_wchar_ptr(this);
424 return (ptr<cstr || ptr>=cstr+this->size) ? FALSE : TRUE;
427 /* ?_Tidy@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEX_NI@Z */
428 /* ?_Tidy@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAX_N_K@Z */
429 /* ?_Tidy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEX_NI@Z */
430 /* ?_Tidy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAX_N_K@Z */
431 static void basic_string_wchar_tidy(basic_string_wchar *this,
432 MSVCP_bool built, MSVCP_size_t new_size)
434 if(built && BUF_SIZE_WCHAR<=this->res) {
435 wchar_t *ptr = this->data.ptr;
438 MSVCP_char_traits_wchar__Copy_s(this->data.buf, BUF_SIZE_WCHAR, ptr, new_size);
439 MSVCP_allocator_wchar_deallocate(this->allocator, ptr, this->res+1);
442 this->res = BUF_SIZE_WCHAR-1;
443 basic_string_wchar_eos(this, new_size);
446 /* ?_Grow@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAE_NI_N@Z */
447 /* ?_Grow@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAA_N_K_N@Z */
448 /* ?_Grow@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAE_NI_N@Z */
449 /* ?_Grow@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAA_N_K_N@Z */
450 static MSVCP_bool basic_string_wchar_grow(
451 basic_string_wchar *this, MSVCP_size_t new_size, MSVCP_bool trim)
453 if(this->res < new_size) {
454 MSVCP_size_t new_res = new_size, len = this->size;
459 if(new_res/3 < this->res/2)
460 new_res = this->res + this->res/2;
462 ptr = MSVCP_allocator_wchar_allocate(this->allocator, new_res+1);
464 ptr = MSVCP_allocator_wchar_allocate(this->allocator, new_size+1);
468 ERR("Out of memory\n");
469 basic_string_wchar_tidy(this, TRUE, 0);
473 MSVCP_char_traits_wchar__Copy_s(ptr, new_size,
474 basic_string_wchar_ptr(this), this->size);
475 basic_string_wchar_tidy(this, TRUE, 0);
476 this->data.ptr = ptr;
477 this->res = new_size;
478 basic_string_wchar_eos(this, len);
479 } else if(trim && new_size < BUF_SIZE_WCHAR)
480 basic_string_wchar_tidy(this, TRUE,
481 new_size<this->size ? new_size : this->size);
482 else if(new_size == 0)
483 basic_string_wchar_eos(this, 0);
488 /* ?erase@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@II@Z */
489 /* ?erase@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@_K0@Z */
490 /* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@II@Z */
491 /* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0@Z */
492 static basic_string_wchar* MSVCP_basic_string_wchar_erase(
493 basic_string_wchar *this, MSVCP_size_t pos, MSVCP_size_t len)
495 TRACE("%p %lu %lu\n", this, pos, len);
498 MSVCP__String_base_Xran();
500 if(len > this->size-pos)
501 len = this->size-pos;
504 MSVCP_char_traits_wchar__Move_s(basic_string_wchar_ptr(this)+pos,
505 this->res-pos, basic_string_wchar_ptr(this)+pos+len,
507 basic_string_wchar_eos(this, this->size-len);
513 /* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@ABV12@II@Z */
514 /* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
515 /* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@ABV12@II@Z */
516 /* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
517 static basic_string_wchar* MSVCP_basic_string_wchar_assign_substr(
518 basic_string_wchar *this, const basic_string_wchar *assign,
519 MSVCP_size_t pos, MSVCP_size_t len)
521 TRACE("%p %p %lu %lu\n", this, assign, pos, len);
523 if(assign->size < pos)
524 MSVCP__String_base_Xran();
526 if(len > assign->size-pos)
527 len = assign->size-pos;
530 MSVCP_basic_string_wchar_erase(this, pos+len, MSVCP_basic_string_wchar_npos);
531 MSVCP_basic_string_wchar_erase(this, 0, pos);
532 } else if(basic_string_wchar_grow(this, len, FALSE)) {
533 MSVCP_char_traits_wchar__Copy_s(basic_string_wchar_ptr(this),
534 this->res, basic_string_wchar_const_ptr(assign)+pos, len);
535 basic_string_wchar_eos(this, len);
541 /* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@PB_WI@Z */
542 /* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@PEB_W_K@Z */
543 /* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBGI@Z */
544 /* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG_K@Z */
545 static basic_string_wchar* MSVCP_basic_string_wchar_assign_cstr_len(
546 basic_string_wchar *this, const wchar_t *str, MSVCP_size_t len)
548 TRACE("%p %s %lu\n", this, debugstr_wn(str, len), len);
550 if(basic_string_wchar_inside(this, str))
551 return MSVCP_basic_string_wchar_assign_substr(this, this,
552 str-basic_string_wchar_ptr(this), len);
553 else if(basic_string_wchar_grow(this, len, FALSE)) {
554 MSVCP_char_traits_wchar__Copy_s(basic_string_wchar_ptr(this),
555 this->res, str, len);
556 basic_string_wchar_eos(this, len);
562 /* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@PB_W@Z */
563 /* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@PEB_W@Z */
564 /* ??4?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV01@PB_W@Z */
565 /* ??4?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV01@PEB_W@Z */
566 /* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBG@Z */
567 /* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG@Z */
568 /* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@PBG@Z */
569 /* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@PEBG@Z */
570 static basic_string_wchar* MSVCP_basic_string_wchar_assign_cstr(
571 basic_string_wchar *this, const wchar_t *str)
573 return MSVCP_basic_string_wchar_assign_cstr_len(this, str,
574 MSVCP_char_traits_wchar_length(str));
577 /* ?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ */
578 /* ?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEB_WXZ */
579 /* ?data@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ */
580 /* ?data@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEB_WXZ */
581 /* ?c_str@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPBGXZ */
582 /* ?c_str@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEBGXZ */
583 /* ?data@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPBGXZ */
584 /* ?data@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEBGXZ */
585 const wchar_t* MSVCP_basic_string_wchar_c_str(const basic_string_wchar *this)
588 return basic_string_wchar_const_ptr(this);
591 /* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@PB_W@Z */
592 /* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@PEB_W@Z */
593 /* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@PBG@Z */
594 /* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@PEBG@Z */
595 basic_string_wchar* MSVCP_basic_string_wchar_ctor_cstr(
596 basic_string_wchar *this, const wchar_t *str)
598 TRACE("%p %s\n", this, debugstr_w(str));
600 basic_string_wchar_tidy(this, FALSE, 0);
601 MSVCP_basic_string_wchar_assign_cstr(this, str);
605 /* ??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ */
606 /* ??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@XZ */
607 /* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ */
608 /* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@XZ */
609 void MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
612 basic_string_wchar_tidy(this, TRUE, 0);
615 /* ?size@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ */
616 /* ?size@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA_KXZ */
617 /* ?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ */
618 /* ?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA_KXZ */
619 /* ?size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */
620 /* ?size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ */
621 /* ?length@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */
622 /* ?length@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ */
623 MSVCP_size_t MSVCP_basic_string_wchar_length(const basic_string_wchar *this)