📄 monetary_members.cc
字号:
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); if (!__nposn) _M_negative_sign = "()"; else _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); // _Intl == false _M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); } } template<> moneypunct<char, true>::~moneypunct() { } template<> moneypunct<char, false>::~moneypunct() { }#ifdef _GLIBCPP_USE_WCHAR_T template<> void moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) const char*)#else const char* __name)#endif { if (!__cloc) { // "C" locale _M_decimal_point = L'.'; _M_thousands_sep = L','; _M_grouping = ""; _M_curr_symbol = L""; _M_positive_sign = L""; _M_negative_sign = L""; _M_frac_digits = 0; _M_pos_format = money_base::_S_default_pattern; _M_neg_format = money_base::_S_default_pattern; } else { // Named locale.#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __c_locale __old = __uselocale(__cloc);#else // Switch to named locale so that mbsrtowcs will work. char* __old = strdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, __name);#endif _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); _M_grouping = __nl_langinfo_l(GROUPING, __cloc); const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); wchar_t* __wcs_ps = 0; wchar_t* __wcs_ns = 0; char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); try { mbstate_t __state; size_t __len = strlen(__cpossign); if (__len) { ++__len; memset(&__state, 0, sizeof(mbstate_t)); __wcs_ps = new wchar_t[__len]; mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); _M_positive_sign = __wcs_ps; } else _M_positive_sign = L""; __len = strlen(__cnegsign); if (!__nposn) _M_negative_sign = L"()"; else if (__len) { ++__len; memset(&__state, 0, sizeof(mbstate_t)); __wcs_ns = new wchar_t[__len]; mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); _M_negative_sign = __wcs_ns; } else _M_negative_sign = L""; // _Intl == true. __len = strlen(__ccurr); if (__len) { ++__len; memset(&__state, 0, sizeof(mbstate_t)); wchar_t* __wcs = new wchar_t[__len]; mbsrtowcs(__wcs, &__ccurr, __len, &__state); _M_curr_symbol = __wcs; } else _M_curr_symbol = L""; } catch (...) { delete __wcs_ps; delete __wcs_ns;#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __uselocale(__old);#else setlocale(LC_ALL, __old); free(__old);#endif __throw_exception_again; } _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc)); char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __uselocale(__old);#else setlocale(LC_ALL, __old); free(__old);#endif } } template<> void moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) const char*)#else const char* __name)#endif { if (!__cloc) { // "C" locale _M_decimal_point = L'.'; _M_thousands_sep = L','; _M_grouping = ""; _M_curr_symbol = L""; _M_positive_sign = L""; _M_negative_sign = L""; _M_frac_digits = 0; _M_pos_format = money_base::_S_default_pattern; _M_neg_format = money_base::_S_default_pattern; } else { // Named locale.#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __c_locale __old = __uselocale(__cloc);#else // Switch to named locale so that mbsrtowcs will work. char* __old = strdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, __name);#endif _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); _M_grouping = __nl_langinfo_l(GROUPING, __cloc); const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); wchar_t* __wcs_ps = 0; wchar_t* __wcs_ns = 0; char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); try { mbstate_t __state; size_t __len; __len = strlen(__cpossign); if (__len) { ++__len; memset(&__state, 0, sizeof(mbstate_t)); __wcs_ps = new wchar_t[__len]; mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); _M_positive_sign = __wcs_ps; } else _M_positive_sign = L""; __len = strlen(__cnegsign); if (!__nposn) _M_negative_sign = L"()"; else if (__len) { ++__len; memset(&__state, 0, sizeof(mbstate_t)); __wcs_ns = new wchar_t[__len]; mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); _M_negative_sign = __wcs_ns; } else _M_negative_sign = L""; // _Intl == true. __len = strlen(__ccurr); if (__len) { ++__len; memset(&__state, 0, sizeof(mbstate_t)); wchar_t* __wcs = new wchar_t[__len]; mbsrtowcs(__wcs, &__ccurr, __len, &__state); _M_curr_symbol = __wcs; } else _M_curr_symbol = L""; } catch (...) { delete __wcs_ps; delete __wcs_ns; #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __uselocale(__old);#else setlocale(LC_ALL, __old); free(__old);#endif __throw_exception_again; } _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __uselocale(__old);#else setlocale(LC_ALL, __old); free(__old);#endif } } template<> moneypunct<wchar_t, true>::~moneypunct() { if (wcslen(_M_positive_sign)) delete [] _M_positive_sign; if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0)) delete [] _M_negative_sign; if (wcslen(_M_curr_symbol)) delete [] _M_curr_symbol; } template<> moneypunct<wchar_t, false>::~moneypunct() { if (wcslen(_M_positive_sign)) delete [] _M_positive_sign; if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0)) delete [] _M_negative_sign; if (wcslen(_M_curr_symbol)) delete [] _M_curr_symbol; }#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -