1 // std::moneypunct implementation details, GNU version -*- C++ -*-
3 // Copyright (C) 2001-2015 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
26 // ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
29 // Written by Benjamin Kosnik <bkoz@redhat.com>
32 #include <bits/c++locale_internal.h>
34 namespace std _GLIBCXX_VISIBILITY(default)
36 _GLIBCXX_BEGIN_NAMESPACE_VERSION
38 // This file might be compiled twice, but we only want to define the members
39 // of money_base once.
40 #if ! _GLIBCXX_USE_CXX11_ABI
42 // Construct and return valid pattern consisting of some combination of:
43 // space none symbol sign value
45 money_base::_S_construct_pattern(char __precedes, char __space,
50 // This insanely complicated routine attempts to construct a valid
51 // pattern for use with monyepunct. A couple of invariants:
53 // if (__precedes) symbol -> value
54 // else value -> symbol
59 // none == never first
60 // space never first or last
62 // Any elegant implementations of this are welcome.
67 // 1 The sign precedes the value and symbol.
68 __ret.field[0] = sign;
71 // Pattern starts with sign.
74 __ret.field[1] = symbol;
75 __ret.field[3] = value;
79 __ret.field[1] = value;
80 __ret.field[3] = symbol;
82 __ret.field[2] = space;
86 // Pattern starts with sign and ends with none.
89 __ret.field[1] = symbol;
90 __ret.field[2] = value;
94 __ret.field[1] = value;
95 __ret.field[2] = symbol;
97 __ret.field[3] = none;
101 // 2 The sign follows the value and symbol.
104 // Pattern either ends with sign.
107 __ret.field[0] = symbol;
108 __ret.field[2] = value;
112 __ret.field[0] = value;
113 __ret.field[2] = symbol;
115 __ret.field[1] = space;
116 __ret.field[3] = sign;
120 // Pattern ends with sign then none.
123 __ret.field[0] = symbol;
124 __ret.field[1] = value;
128 __ret.field[0] = value;
129 __ret.field[1] = symbol;
131 __ret.field[2] = sign;
132 __ret.field[3] = none;
136 // 3 The sign immediately precedes the symbol.
139 __ret.field[0] = sign;
140 __ret.field[1] = symbol;
143 __ret.field[2] = space;
144 __ret.field[3] = value;
148 __ret.field[2] = value;
149 __ret.field[3] = none;
154 __ret.field[0] = value;
157 __ret.field[1] = space;
158 __ret.field[2] = sign;
159 __ret.field[3] = symbol;
163 __ret.field[1] = sign;
164 __ret.field[2] = symbol;
165 __ret.field[3] = none;
170 // 4 The sign immediately follows the symbol.
173 __ret.field[0] = symbol;
174 __ret.field[1] = sign;
177 __ret.field[2] = space;
178 __ret.field[3] = value;
182 __ret.field[2] = value;
183 __ret.field[3] = none;
188 __ret.field[0] = value;
191 __ret.field[1] = space;
192 __ret.field[2] = symbol;
193 __ret.field[3] = sign;
197 __ret.field[1] = symbol;
198 __ret.field[2] = sign;
199 __ret.field[3] = none;
212 moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
216 _M_data = new __moneypunct_cache<char, true>;
221 _M_data->_M_decimal_point = '.';
222 _M_data->_M_thousands_sep = ',';
223 _M_data->_M_grouping = "";
224 _M_data->_M_grouping_size = 0;
225 _M_data->_M_use_grouping = false;
226 _M_data->_M_curr_symbol = "";
227 _M_data->_M_curr_symbol_size = 0;
228 _M_data->_M_positive_sign = "";
229 _M_data->_M_positive_sign_size = 0;
230 _M_data->_M_negative_sign = "";
231 _M_data->_M_negative_sign_size = 0;
232 _M_data->_M_frac_digits = 0;
233 _M_data->_M_pos_format = money_base::_S_default_pattern;
234 _M_data->_M_neg_format = money_base::_S_default_pattern;
236 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
237 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
242 _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
244 _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
247 // Check for NULL, which implies no fractional digits.
248 if (_M_data->_M_decimal_point == '\0')
250 // Like in "C" locale.
251 _M_data->_M_frac_digits = 0;
252 _M_data->_M_decimal_point = '.';
255 _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
258 const char* __cgroup = __nl_langinfo_l(__MON_GROUPING, __cloc);
259 const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
260 const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
262 const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
267 const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
272 // Check for NULL, which implies no grouping.
273 if (_M_data->_M_thousands_sep == '\0')
275 // Like in "C" locale.
276 _M_data->_M_grouping = "";
277 _M_data->_M_grouping_size = 0;
278 _M_data->_M_use_grouping = false;
279 _M_data->_M_thousands_sep = ',';
283 __len = strlen(__cgroup);
286 __group = new char[__len + 1];
287 memcpy(__group, __cgroup, __len + 1);
288 _M_data->_M_grouping = __group;
292 _M_data->_M_grouping = "";
293 _M_data->_M_use_grouping = false;
295 _M_data->_M_grouping_size = __len;
298 __len = strlen(__cpossign);
301 __ps = new char[__len + 1];
302 memcpy(__ps, __cpossign, __len + 1);
303 _M_data->_M_positive_sign = __ps;
306 _M_data->_M_positive_sign = "";
307 _M_data->_M_positive_sign_size = __len;
311 _M_data->_M_negative_sign = "()";
312 _M_data->_M_negative_sign_size = 2;
316 __len = strlen(__cnegsign);
319 __ns = new char[__len + 1];
320 memcpy(__ns, __cnegsign, __len + 1);
321 _M_data->_M_negative_sign = __ns;
324 _M_data->_M_negative_sign = "";
325 _M_data->_M_negative_sign_size = __len;
328 __len = strlen(__ccurr);
331 char* __curr = new char[__len + 1];
332 memcpy(__curr, __ccurr, __len + 1);
333 _M_data->_M_curr_symbol = __curr;
336 _M_data->_M_curr_symbol = "";
337 _M_data->_M_curr_symbol_size = __len;
346 __throw_exception_again;
349 char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
350 char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
351 char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
352 _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
354 char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
355 char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
356 _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
363 moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
367 _M_data = new __moneypunct_cache<char, false>;
372 _M_data->_M_decimal_point = '.';
373 _M_data->_M_thousands_sep = ',';
374 _M_data->_M_grouping = "";
375 _M_data->_M_grouping_size = 0;
376 _M_data->_M_use_grouping = false;
377 _M_data->_M_curr_symbol = "";
378 _M_data->_M_curr_symbol_size = 0;
379 _M_data->_M_positive_sign = "";
380 _M_data->_M_positive_sign_size = 0;
381 _M_data->_M_negative_sign = "";
382 _M_data->_M_negative_sign_size = 0;
383 _M_data->_M_frac_digits = 0;
384 _M_data->_M_pos_format = money_base::_S_default_pattern;
385 _M_data->_M_neg_format = money_base::_S_default_pattern;
387 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
388 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
393 _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
395 _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
398 // Check for NULL, which implies no fractional digits.
399 if (_M_data->_M_decimal_point == '\0')
401 // Like in "C" locale.
402 _M_data->_M_frac_digits = 0;
403 _M_data->_M_decimal_point = '.';
406 _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS,
409 const char* __cgroup = __nl_langinfo_l(__MON_GROUPING, __cloc);
410 const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
411 const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
413 const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
418 const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
423 // Check for NULL, which implies no grouping.
424 if (_M_data->_M_thousands_sep == '\0')
426 // Like in "C" locale.
427 _M_data->_M_grouping = "";
428 _M_data->_M_grouping_size = 0;
429 _M_data->_M_use_grouping = false;
430 _M_data->_M_thousands_sep = ',';
434 __len = strlen(__cgroup);
437 __group = new char[__len + 1];
438 memcpy(__group, __cgroup, __len + 1);
439 _M_data->_M_grouping = __group;
443 _M_data->_M_grouping = "";
444 _M_data->_M_use_grouping = false;
446 _M_data->_M_grouping_size = __len;
449 __len = strlen(__cpossign);
452 __ps = new char[__len + 1];
453 memcpy(__ps, __cpossign, __len + 1);
454 _M_data->_M_positive_sign = __ps;
457 _M_data->_M_positive_sign = "";
458 _M_data->_M_positive_sign_size = __len;
462 _M_data->_M_negative_sign = "()";
463 _M_data->_M_negative_sign_size = 2;
467 __len = strlen(__cnegsign);
470 __ns = new char[__len + 1];
471 memcpy(__ns, __cnegsign, __len + 1);
472 _M_data->_M_negative_sign = __ns;
475 _M_data->_M_negative_sign = "";
476 _M_data->_M_negative_sign_size = __len;
479 __len = strlen(__ccurr);
482 char* __curr = new char[__len + 1];
483 memcpy(__curr, __ccurr, __len + 1);
484 _M_data->_M_curr_symbol = __curr;
487 _M_data->_M_curr_symbol = "";
488 _M_data->_M_curr_symbol_size = __len;
497 __throw_exception_again;
500 char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
501 char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
502 char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
503 _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
505 char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
506 char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
507 _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
513 moneypunct<char, true>::~moneypunct()
515 if (_M_data->_M_grouping_size)
516 delete [] _M_data->_M_grouping;
517 if (_M_data->_M_positive_sign_size)
518 delete [] _M_data->_M_positive_sign;
519 if (_M_data->_M_negative_sign_size
520 && strcmp(_M_data->_M_negative_sign, "()") != 0)
521 delete [] _M_data->_M_negative_sign;
522 if (_M_data->_M_curr_symbol_size)
523 delete [] _M_data->_M_curr_symbol;
528 moneypunct<char, false>::~moneypunct()
530 if (_M_data->_M_grouping_size)
531 delete [] _M_data->_M_grouping;
532 if (_M_data->_M_positive_sign_size)
533 delete [] _M_data->_M_positive_sign;
534 if (_M_data->_M_negative_sign_size
535 && strcmp(_M_data->_M_negative_sign, "()") != 0)
536 delete [] _M_data->_M_negative_sign;
537 if (_M_data->_M_curr_symbol_size)
538 delete [] _M_data->_M_curr_symbol;
542 #ifdef _GLIBCXX_USE_WCHAR_T
545 moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
546 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
553 _M_data = new __moneypunct_cache<wchar_t, true>;
558 _M_data->_M_decimal_point = L'.';
559 _M_data->_M_thousands_sep = L',';
560 _M_data->_M_grouping = "";
561 _M_data->_M_grouping_size = 0;
562 _M_data->_M_use_grouping = false;
563 _M_data->_M_curr_symbol = L"";
564 _M_data->_M_curr_symbol_size = 0;
565 _M_data->_M_positive_sign = L"";
566 _M_data->_M_positive_sign_size = 0;
567 _M_data->_M_negative_sign = L"";
568 _M_data->_M_negative_sign_size = 0;
569 _M_data->_M_frac_digits = 0;
570 _M_data->_M_pos_format = money_base::_S_default_pattern;
571 _M_data->_M_neg_format = money_base::_S_default_pattern;
573 // Use ctype::widen code without the facet...
574 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
575 _M_data->_M_atoms[__i] =
576 static_cast<wchar_t>(money_base::_S_atoms[__i]);
581 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
582 __c_locale __old = __uselocale(__cloc);
584 // Switch to named locale so that mbsrtowcs will work.
585 char* __old = setlocale(LC_ALL, 0);
586 const size_t __llen = strlen(__old) + 1;
587 char* __sav = new char[__llen];
588 memcpy(__sav, __old, __llen);
589 setlocale(LC_ALL, __name);
592 union { char *__s; wchar_t __w; } __u;
593 __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
594 _M_data->_M_decimal_point = __u.__w;
596 __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
597 _M_data->_M_thousands_sep = __u.__w;
599 // Check for NULL, which implies no fractional digits.
600 if (_M_data->_M_decimal_point == L'\0')
602 // Like in "C" locale.
603 _M_data->_M_frac_digits = 0;
604 _M_data->_M_decimal_point = L'.';
607 _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
610 const char* __cgroup = __nl_langinfo_l(__MON_GROUPING, __cloc);
611 const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
612 const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
613 const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
616 wchar_t* __wcs_ps = 0;
617 wchar_t* __wcs_ns = 0;
618 const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
623 // Check for NULL, which implies no grouping.
624 if (_M_data->_M_thousands_sep == L'\0')
626 // Like in "C" locale.
627 _M_data->_M_grouping = "";
628 _M_data->_M_grouping_size = 0;
629 _M_data->_M_use_grouping = false;
630 _M_data->_M_thousands_sep = L',';
634 __len = strlen(__cgroup);
637 __group = new char[__len + 1];
638 memcpy(__group, __cgroup, __len + 1);
639 _M_data->_M_grouping = __group;
643 _M_data->_M_grouping = "";
644 _M_data->_M_use_grouping = false;
646 _M_data->_M_grouping_size = __len;
650 __len = strlen(__cpossign);
653 memset(&__state, 0, sizeof(mbstate_t));
654 __wcs_ps = new wchar_t[__len + 1];
655 mbsrtowcs(__wcs_ps, &__cpossign, __len + 1, &__state);
656 _M_data->_M_positive_sign = __wcs_ps;
659 _M_data->_M_positive_sign = L"";
660 _M_data->_M_positive_sign_size =
661 wcslen(_M_data->_M_positive_sign);
663 __len = strlen(__cnegsign);
665 _M_data->_M_negative_sign = L"()";
668 memset(&__state, 0, sizeof(mbstate_t));
669 __wcs_ns = new wchar_t[__len + 1];
670 mbsrtowcs(__wcs_ns, &__cnegsign, __len + 1, &__state);
671 _M_data->_M_negative_sign = __wcs_ns;
674 _M_data->_M_negative_sign = L"";
675 _M_data->_M_negative_sign_size =
676 wcslen(_M_data->_M_negative_sign);
679 __len = strlen(__ccurr);
682 memset(&__state, 0, sizeof(mbstate_t));
683 wchar_t* __wcs = new wchar_t[__len + 1];
684 mbsrtowcs(__wcs, &__ccurr, __len + 1, &__state);
685 _M_data->_M_curr_symbol = __wcs;
688 _M_data->_M_curr_symbol = L"";
689 _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
698 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
701 setlocale(LC_ALL, __sav);
704 __throw_exception_again;
707 char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
708 char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
709 char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
710 _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
712 char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
713 char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
714 _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
717 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
720 setlocale(LC_ALL, __sav);
728 moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
729 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
736 _M_data = new __moneypunct_cache<wchar_t, false>;
741 _M_data->_M_decimal_point = L'.';
742 _M_data->_M_thousands_sep = L',';
743 _M_data->_M_grouping = "";
744 _M_data->_M_grouping_size = 0;
745 _M_data->_M_use_grouping = false;
746 _M_data->_M_curr_symbol = L"";
747 _M_data->_M_curr_symbol_size = 0;
748 _M_data->_M_positive_sign = L"";
749 _M_data->_M_positive_sign_size = 0;
750 _M_data->_M_negative_sign = L"";
751 _M_data->_M_negative_sign_size = 0;
752 _M_data->_M_frac_digits = 0;
753 _M_data->_M_pos_format = money_base::_S_default_pattern;
754 _M_data->_M_neg_format = money_base::_S_default_pattern;
756 // Use ctype::widen code without the facet...
757 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
758 _M_data->_M_atoms[__i] =
759 static_cast<wchar_t>(money_base::_S_atoms[__i]);
764 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
765 __c_locale __old = __uselocale(__cloc);
767 // Switch to named locale so that mbsrtowcs will work.
768 char* __old = setlocale(LC_ALL, 0);
769 const size_t __llen = strlen(__old) + 1;
770 char* __sav = new char[__llen];
771 memcpy(__sav, __old, __llen);
772 setlocale(LC_ALL, __name);
775 union { char *__s; wchar_t __w; } __u;
776 __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
777 _M_data->_M_decimal_point = __u.__w;
779 __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
780 _M_data->_M_thousands_sep = __u.__w;
782 // Check for NULL, which implies no fractional digits.
783 if (_M_data->_M_decimal_point == L'\0')
785 // Like in "C" locale.
786 _M_data->_M_frac_digits = 0;
787 _M_data->_M_decimal_point = L'.';
790 _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS,
793 const char* __cgroup = __nl_langinfo_l(__MON_GROUPING, __cloc);
794 const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
795 const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
796 const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
799 wchar_t* __wcs_ps = 0;
800 wchar_t* __wcs_ns = 0;
801 const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
806 // Check for NULL, which implies no grouping.
807 if (_M_data->_M_thousands_sep == L'\0')
809 // Like in "C" locale.
810 _M_data->_M_grouping = "";
811 _M_data->_M_grouping_size = 0;
812 _M_data->_M_use_grouping = false;
813 _M_data->_M_thousands_sep = L',';
817 __len = strlen(__cgroup);
820 __group = new char[__len + 1];
821 memcpy(__group, __cgroup, __len + 1);
822 _M_data->_M_grouping = __group;
826 _M_data->_M_grouping = "";
827 _M_data->_M_use_grouping = false;
829 _M_data->_M_grouping_size = __len;
833 __len = strlen(__cpossign);
836 memset(&__state, 0, sizeof(mbstate_t));
837 __wcs_ps = new wchar_t[__len + 1];
838 mbsrtowcs(__wcs_ps, &__cpossign, __len + 1, &__state);
839 _M_data->_M_positive_sign = __wcs_ps;
842 _M_data->_M_positive_sign = L"";
843 _M_data->_M_positive_sign_size =
844 wcslen(_M_data->_M_positive_sign);
846 __len = strlen(__cnegsign);
848 _M_data->_M_negative_sign = L"()";
851 memset(&__state, 0, sizeof(mbstate_t));
852 __wcs_ns = new wchar_t[__len + 1];
853 mbsrtowcs(__wcs_ns, &__cnegsign, __len + 1, &__state);
854 _M_data->_M_negative_sign = __wcs_ns;
857 _M_data->_M_negative_sign = L"";
858 _M_data->_M_negative_sign_size =
859 wcslen(_M_data->_M_negative_sign);
862 __len = strlen(__ccurr);
865 memset(&__state, 0, sizeof(mbstate_t));
866 wchar_t* __wcs = new wchar_t[__len + 1];
867 mbsrtowcs(__wcs, &__ccurr, __len + 1, &__state);
868 _M_data->_M_curr_symbol = __wcs;
871 _M_data->_M_curr_symbol = L"";
872 _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
881 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
884 setlocale(LC_ALL, __sav);
887 __throw_exception_again;
890 char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
891 char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
892 char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
893 _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
895 char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
896 char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
897 _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
900 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
903 setlocale(LC_ALL, __sav);
910 moneypunct<wchar_t, true>::~moneypunct()
912 if (_M_data->_M_grouping_size)
913 delete [] _M_data->_M_grouping;
914 if (_M_data->_M_positive_sign_size)
915 delete [] _M_data->_M_positive_sign;
916 if (_M_data->_M_negative_sign_size
917 && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
918 delete [] _M_data->_M_negative_sign;
919 if (_M_data->_M_curr_symbol_size)
920 delete [] _M_data->_M_curr_symbol;
925 moneypunct<wchar_t, false>::~moneypunct()
927 if (_M_data->_M_grouping_size)
928 delete [] _M_data->_M_grouping;
929 if (_M_data->_M_positive_sign_size)
930 delete [] _M_data->_M_positive_sign;
931 if (_M_data->_M_negative_sign_size
932 && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
933 delete [] _M_data->_M_negative_sign;
934 if (_M_data->_M_curr_symbol_size)
935 delete [] _M_data->_M_curr_symbol;
940 _GLIBCXX_END_NAMESPACE_VERSION