summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/config/locale/generic/monetary_members.cc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libstdc++/config/locale/generic/monetary_members.cc')
-rw-r--r--contrib/libstdc++/config/locale/generic/monetary_members.cc136
1 files changed, 92 insertions, 44 deletions
diff --git a/contrib/libstdc++/config/locale/generic/monetary_members.cc b/contrib/libstdc++/config/locale/generic/monetary_members.cc
index 1921f46..957a326 100644
--- a/contrib/libstdc++/config/locale/generic/monetary_members.cc
+++ b/contrib/libstdc++/config/locale/generic/monetary_members.cc
@@ -1,6 +1,6 @@
// std::moneypunct implementation details, generic version -*- C++ -*-
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,58 +47,92 @@ namespace std
void
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
{
- // "C" locale
- _M_decimal_point = '.';
- _M_thousands_sep = ',';
- _M_grouping = "";
- _M_curr_symbol = "";
- _M_positive_sign = "";
- _M_negative_sign = "";
- _M_frac_digits = 0;
- _M_pos_format = money_base::_S_default_pattern;
- _M_neg_format = money_base::_S_default_pattern;
+ // "C" locale.
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<char, true>;
+
+ _M_data->_M_decimal_point = '.';
+ _M_data->_M_thousands_sep = ',';
+ _M_data->_M_grouping = "";
+ _M_data->_M_grouping_size = 0;
+ _M_data->_M_curr_symbol = "";
+ _M_data->_M_curr_symbol_size = 0;
+ _M_data->_M_positive_sign = "";
+ _M_data->_M_positive_sign_size = 0;
+ _M_data->_M_negative_sign = "";
+ _M_data->_M_negative_sign_size = 0;
+ _M_data->_M_frac_digits = 0;
+ _M_data->_M_pos_format = money_base::_S_default_pattern;
+ _M_data->_M_neg_format = money_base::_S_default_pattern;
+
+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
}
template<>
void
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
{
- // "C" locale
- _M_decimal_point = '.';
- _M_thousands_sep = ',';
- _M_grouping = "";
- _M_curr_symbol = "";
- _M_positive_sign = "";
- _M_negative_sign = "";
- _M_frac_digits = 0;
- _M_pos_format = money_base::_S_default_pattern;
- _M_neg_format = money_base::_S_default_pattern;
+ // "C" locale.
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<char, false>;
+
+ _M_data->_M_decimal_point = '.';
+ _M_data->_M_thousands_sep = ',';
+ _M_data->_M_grouping = "";
+ _M_data->_M_grouping_size = 0;
+ _M_data->_M_curr_symbol = "";
+ _M_data->_M_curr_symbol_size = 0;
+ _M_data->_M_positive_sign = "";
+ _M_data->_M_positive_sign_size = 0;
+ _M_data->_M_negative_sign = "";
+ _M_data->_M_negative_sign_size = 0;
+ _M_data->_M_frac_digits = 0;
+ _M_data->_M_pos_format = money_base::_S_default_pattern;
+ _M_data->_M_neg_format = money_base::_S_default_pattern;
+
+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
}
template<>
moneypunct<char, true>::~moneypunct()
- { }
+ { delete _M_data; }
template<>
moneypunct<char, false>::~moneypunct()
- { }
+ { delete _M_data; }
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template<>
void
moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
const char*)
{
// "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;
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<wchar_t, true>;
+
+ _M_data->_M_decimal_point = L'.';
+ _M_data->_M_thousands_sep = L',';
+ _M_data->_M_grouping = "";
+ _M_data->_M_grouping_size = 0;
+ _M_data->_M_curr_symbol = L"";
+ _M_data->_M_curr_symbol_size = 0;
+ _M_data->_M_positive_sign = L"";
+ _M_data->_M_positive_sign_size = 0;
+ _M_data->_M_negative_sign = L"";
+ _M_data->_M_negative_sign_size = 0;
+ _M_data->_M_frac_digits = 0;
+ _M_data->_M_pos_format = money_base::_S_default_pattern;
+ _M_data->_M_neg_format = money_base::_S_default_pattern;
+
+ unsigned char uc;
+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
+ {
+ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
+ _M_data->_M_atoms[__i] = btowc(uc);
+ }
}
template<>
@@ -107,23 +141,37 @@ namespace std
const char*)
{
// "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;
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<wchar_t, false>;
+
+ _M_data->_M_decimal_point = L'.';
+ _M_data->_M_thousands_sep = L',';
+ _M_data->_M_grouping = "";
+ _M_data->_M_grouping_size = 0;
+ _M_data->_M_curr_symbol = L"";
+ _M_data->_M_curr_symbol_size = 0;
+ _M_data->_M_positive_sign = L"";
+ _M_data->_M_positive_sign_size = 0;
+ _M_data->_M_negative_sign = L"";
+ _M_data->_M_negative_sign_size = 0;
+ _M_data->_M_frac_digits = 0;
+ _M_data->_M_pos_format = money_base::_S_default_pattern;
+ _M_data->_M_neg_format = money_base::_S_default_pattern;
+
+ unsigned char uc;
+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
+ {
+ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
+ _M_data->_M_atoms[__i] = btowc(uc);
+ }
}
template<>
moneypunct<wchar_t, true>::~moneypunct()
- { }
+ { delete _M_data; }
template<>
moneypunct<wchar_t, false>::~moneypunct()
- { }
+ { delete _M_data; }
#endif
}
OpenPOWER on IntegriCloud