34 #ifndef _LOCALE_FACETS_NONIO_H 35 #define _LOCALE_FACETS_NONIO_H 1 37 #pragma GCC system_header 41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 enum dateorder { no_order, dmy, mdy, ymd, ydm };
58 template<
typename _CharT>
62 static const _CharT* _S_timezones[14];
64 const _CharT* _M_date_format;
65 const _CharT* _M_date_era_format;
66 const _CharT* _M_time_format;
67 const _CharT* _M_time_era_format;
68 const _CharT* _M_date_time_format;
69 const _CharT* _M_date_time_era_format;
72 const _CharT* _M_am_pm_format;
75 const _CharT* _M_day1;
76 const _CharT* _M_day2;
77 const _CharT* _M_day3;
78 const _CharT* _M_day4;
79 const _CharT* _M_day5;
80 const _CharT* _M_day6;
81 const _CharT* _M_day7;
84 const _CharT* _M_aday1;
85 const _CharT* _M_aday2;
86 const _CharT* _M_aday3;
87 const _CharT* _M_aday4;
88 const _CharT* _M_aday5;
89 const _CharT* _M_aday6;
90 const _CharT* _M_aday7;
93 const _CharT* _M_month01;
94 const _CharT* _M_month02;
95 const _CharT* _M_month03;
96 const _CharT* _M_month04;
97 const _CharT* _M_month05;
98 const _CharT* _M_month06;
99 const _CharT* _M_month07;
100 const _CharT* _M_month08;
101 const _CharT* _M_month09;
102 const _CharT* _M_month10;
103 const _CharT* _M_month11;
104 const _CharT* _M_month12;
107 const _CharT* _M_amonth01;
108 const _CharT* _M_amonth02;
109 const _CharT* _M_amonth03;
110 const _CharT* _M_amonth04;
111 const _CharT* _M_amonth05;
112 const _CharT* _M_amonth06;
113 const _CharT* _M_amonth07;
114 const _CharT* _M_amonth08;
115 const _CharT* _M_amonth09;
116 const _CharT* _M_amonth10;
117 const _CharT* _M_amonth11;
118 const _CharT* _M_amonth12;
122 __timepunct_cache(
size_t __refs = 0) : facet(__refs),
123 _M_date_format(0), _M_date_era_format(0), _M_time_format(0),
124 _M_time_era_format(0), _M_date_time_format(0),
125 _M_date_time_era_format(0), _M_am(0), _M_pm(0),
126 _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0),
127 _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0),
128 _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0),
129 _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0),
130 _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0),
131 _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0),
132 _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0),
133 _M_amonth02(0), _M_amonth03(0), _M_amonth04(0),
134 _M_amonth05(0), _M_amonth06(0), _M_amonth07(0),
135 _M_amonth08(0), _M_amonth09(0), _M_amonth10(0),
136 _M_amonth11(0), _M_amonth12(0), _M_allocated(
false)
139 ~__timepunct_cache();
142 _M_cache(
const locale& __loc);
146 operator=(
const __timepunct_cache&);
149 __timepunct_cache(
const __timepunct_cache&);
152 template<
typename _CharT>
153 __timepunct_cache<_CharT>::~__timepunct_cache()
164 __timepunct_cache<char>::_S_timezones[14];
166 #ifdef _GLIBCXX_USE_WCHAR_T 169 __timepunct_cache<wchar_t>::_S_timezones[14];
173 template<
typename _CharT>
174 const _CharT* __timepunct_cache<_CharT>::_S_timezones[14];
176 template<
typename _CharT>
181 typedef _CharT __char_type;
183 typedef __timepunct_cache<_CharT> __cache_type;
186 __cache_type* _M_data;
187 __c_locale _M_c_locale_timepunct;
188 const char* _M_name_timepunct;
195 __timepunct(
size_t __refs = 0);
198 __timepunct(__cache_type* __cache,
size_t __refs = 0);
211 __timepunct(__c_locale __cloc,
const char* __s,
size_t __refs = 0);
216 _M_put(_CharT* __s,
size_t __maxlen,
const _CharT* __format,
217 const tm* __tm)
const throw ();
220 _M_date_formats(
const _CharT** __date)
const 223 __date[0] = _M_data->_M_date_format;
224 __date[1] = _M_data->_M_date_era_format;
228 _M_time_formats(
const _CharT** __time)
const 231 __time[0] = _M_data->_M_time_format;
232 __time[1] = _M_data->_M_time_era_format;
236 _M_date_time_formats(
const _CharT** __dt)
const 239 __dt[0] = _M_data->_M_date_time_format;
240 __dt[1] = _M_data->_M_date_time_era_format;
244 _M_am_pm_format(
const _CharT* __ampm)
const 245 { __ampm = _M_data->_M_am_pm_format; }
248 _M_am_pm(
const _CharT** __ampm)
const 250 __ampm[0] = _M_data->_M_am;
251 __ampm[1] = _M_data->_M_pm;
255 _M_days(
const _CharT** __days)
const 257 __days[0] = _M_data->_M_day1;
258 __days[1] = _M_data->_M_day2;
259 __days[2] = _M_data->_M_day3;
260 __days[3] = _M_data->_M_day4;
261 __days[4] = _M_data->_M_day5;
262 __days[5] = _M_data->_M_day6;
263 __days[6] = _M_data->_M_day7;
267 _M_days_abbreviated(
const _CharT** __days)
const 269 __days[0] = _M_data->_M_aday1;
270 __days[1] = _M_data->_M_aday2;
271 __days[2] = _M_data->_M_aday3;
272 __days[3] = _M_data->_M_aday4;
273 __days[4] = _M_data->_M_aday5;
274 __days[5] = _M_data->_M_aday6;
275 __days[6] = _M_data->_M_aday7;
279 _M_months(
const _CharT** __months)
const 281 __months[0] = _M_data->_M_month01;
282 __months[1] = _M_data->_M_month02;
283 __months[2] = _M_data->_M_month03;
284 __months[3] = _M_data->_M_month04;
285 __months[4] = _M_data->_M_month05;
286 __months[5] = _M_data->_M_month06;
287 __months[6] = _M_data->_M_month07;
288 __months[7] = _M_data->_M_month08;
289 __months[8] = _M_data->_M_month09;
290 __months[9] = _M_data->_M_month10;
291 __months[10] = _M_data->_M_month11;
292 __months[11] = _M_data->_M_month12;
296 _M_months_abbreviated(
const _CharT** __months)
const 298 __months[0] = _M_data->_M_amonth01;
299 __months[1] = _M_data->_M_amonth02;
300 __months[2] = _M_data->_M_amonth03;
301 __months[3] = _M_data->_M_amonth04;
302 __months[4] = _M_data->_M_amonth05;
303 __months[5] = _M_data->_M_amonth06;
304 __months[6] = _M_data->_M_amonth07;
305 __months[7] = _M_data->_M_amonth08;
306 __months[8] = _M_data->_M_amonth09;
307 __months[9] = _M_data->_M_amonth10;
308 __months[10] = _M_data->_M_amonth11;
309 __months[11] = _M_data->_M_amonth12;
318 _M_initialize_timepunct(__c_locale __cloc = 0);
321 template<
typename _CharT>
327 __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);
331 __timepunct<char>::_M_put(
char*,
size_t,
const char*,
const tm*)
const throw ();
333 #ifdef _GLIBCXX_USE_WCHAR_T 336 __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);
340 __timepunct<wchar_t>::_M_put(
wchar_t*,
size_t,
const wchar_t*,
341 const tm*)
const throw ();
344 _GLIBCXX_END_NAMESPACE_VERSION
350 namespace std _GLIBCXX_VISIBILITY(default)
352 _GLIBCXX_BEGIN_NAMESPACE_VERSION
367 template<
typename _CharT,
typename _InIter>
408 {
return this->do_date_order(); }
432 ios_base::iostate& __err, tm* __tm)
const 433 {
return this->do_get_time(__beg, __end, __io, __err, __tm); }
457 ios_base::iostate& __err, tm* __tm)
const 458 {
return this->do_get_date(__beg, __end, __io, __err, __tm); }
485 ios_base::iostate& __err, tm* __tm)
const 486 {
return this->do_get_weekday(__beg, __end, __io, __err, __tm); }
514 ios_base::iostate& __err, tm* __tm)
const 515 {
return this->do_get_monthname(__beg, __end, __io, __err, __tm); }
540 ios_base::iostate& __err, tm* __tm)
const 541 {
return this->do_get_year(__beg, __end, __io, __err, __tm); }
559 do_date_order()
const;
577 do_get_time(iter_type __beg, iter_type __end,
ios_base& __io,
578 ios_base::iostate& __err, tm* __tm)
const;
596 do_get_date(iter_type __beg, iter_type __end,
ios_base& __io,
597 ios_base::iostate& __err, tm* __tm)
const;
615 do_get_weekday(iter_type __beg, iter_type __end,
ios_base&,
616 ios_base::iostate& __err, tm* __tm)
const;
634 do_get_monthname(iter_type __beg, iter_type __end,
ios_base&,
635 ios_base::iostate& __err, tm* __tm)
const;
653 do_get_year(iter_type __beg, iter_type __end,
ios_base& __io,
654 ios_base::iostate& __err, tm* __tm)
const;
658 _M_extract_num(iter_type __beg, iter_type __end,
int& __member,
659 int __min,
int __max,
size_t __len,
660 ios_base& __io, ios_base::iostate& __err)
const;
664 _M_extract_name(iter_type __beg, iter_type __end,
int& __member,
665 const _CharT** __names,
size_t __indexlen,
666 ios_base& __io, ios_base::iostate& __err)
const;
670 _M_extract_wday_or_month(iter_type __beg, iter_type __end,
int& __member,
671 const _CharT** __names,
size_t __indexlen,
672 ios_base& __io, ios_base::iostate& __err)
const;
676 _M_extract_via_format(iter_type __beg, iter_type __end,
ios_base& __io,
677 ios_base::iostate& __err, tm* __tm,
678 const _CharT* __format)
const;
681 template<
typename _CharT,
typename _InIter>
685 template<
typename _CharT,
typename _InIter>
714 template<
typename _CharT,
typename _OutIter>
755 put(iter_type __s,
ios_base& __io, char_type __fill,
const tm* __tm,
756 const _CharT* __beg,
const _CharT* __end)
const;
776 const tm* __tm,
char __format,
char __mod = 0)
const 777 {
return this->do_put(__s, __io, __fill, __tm, __format, __mod); }
802 do_put(iter_type __s,
ios_base& __io, char_type __fill,
const tm* __tm,
803 char __format,
char __mod)
const;
806 template<
typename _CharT,
typename _OutIter>
810 template<
typename _CharT,
typename _OutIter>
843 enum part { none, space, symbol, sign, value };
844 struct pattern {
char field[4]; };
846 static const pattern _S_default_pattern;
857 static const char* _S_atoms;
861 _GLIBCXX_CONST
static pattern
862 _S_construct_pattern(
char __precedes,
char __space,
char __posn)
throw ();
865 template<
typename _CharT,
bool _Intl>
868 const char* _M_grouping;
869 size_t _M_grouping_size;
870 bool _M_use_grouping;
871 _CharT _M_decimal_point;
872 _CharT _M_thousands_sep;
873 const _CharT* _M_curr_symbol;
874 size_t _M_curr_symbol_size;
875 const _CharT* _M_positive_sign;
876 size_t _M_positive_sign_size;
877 const _CharT* _M_negative_sign;
878 size_t _M_negative_sign_size;
880 money_base::pattern _M_pos_format;
881 money_base::pattern _M_neg_format;
886 _CharT _M_atoms[money_base::_S_end];
890 __moneypunct_cache(
size_t __refs = 0) : facet(__refs),
891 _M_grouping(0), _M_grouping_size(0), _M_use_grouping(
false),
892 _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()),
893 _M_curr_symbol(0), _M_curr_symbol_size(0),
894 _M_positive_sign(0), _M_positive_sign_size(0),
895 _M_negative_sign(0), _M_negative_sign_size(0),
897 _M_pos_format(money_base::pattern()),
898 _M_neg_format(money_base::pattern()), _M_allocated(
false)
901 ~__moneypunct_cache();
904 _M_cache(
const locale& __loc);
908 operator=(
const __moneypunct_cache&);
911 __moneypunct_cache(
const __moneypunct_cache&);
914 template<
typename _CharT,
bool _Intl>
915 __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache()
919 delete [] _M_grouping;
920 delete [] _M_curr_symbol;
921 delete [] _M_positive_sign;
922 delete [] _M_negative_sign;
933 template<
typename _CharT,
bool _Intl>
943 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
946 __cache_type* _M_data;
951 static const bool intl = _Intl;
964 : facet(__refs), _M_data(0)
965 { _M_initialize_moneypunct(); }
977 : facet(__refs), _M_data(__cache)
978 { _M_initialize_moneypunct(); }
991 moneypunct(__c_locale __cloc,
const char* __s,
size_t __refs = 0)
992 : facet(__refs), _M_data(0)
993 { _M_initialize_moneypunct(__cloc, __s); }
1006 {
return this->do_decimal_point(); }
1019 {
return this->do_thousands_sep(); }
1049 {
return this->do_grouping(); }
1062 {
return this->do_curr_symbol(); }
1079 {
return this->do_positive_sign(); }
1096 {
return this->do_negative_sign(); }
1112 {
return this->do_frac_digits(); }
1148 {
return this->do_pos_format(); }
1152 {
return this->do_neg_format(); }
1170 {
return _M_data->_M_decimal_point; }
1182 {
return _M_data->_M_thousands_sep; }
1195 {
return _M_data->_M_grouping; }
1208 {
return _M_data->_M_curr_symbol; }
1221 {
return _M_data->_M_positive_sign; }
1234 {
return _M_data->_M_negative_sign; }
1248 {
return _M_data->_M_frac_digits; }
1262 {
return _M_data->_M_pos_format; }
1276 {
return _M_data->_M_neg_format; }
1280 _M_initialize_moneypunct(__c_locale __cloc = 0,
1281 const char* __name = 0);
1284 template<
typename _CharT,
bool _Intl>
1287 template<
typename _CharT,
bool _Intl>
1304 #ifdef _GLIBCXX_USE_WCHAR_T 1323 template<
typename _CharT,
bool _Intl>
1330 static const bool intl = _Intl;
1336 if (__builtin_strcmp(__s,
"C") != 0
1337 && __builtin_strcmp(__s,
"POSIX") != 0)
1340 this->_S_create_c_locale(__tmp, __s);
1341 this->_M_initialize_moneypunct(__tmp);
1342 this->_S_destroy_c_locale(__tmp);
1351 template<
typename _CharT,
bool _Intl>
1354 _GLIBCXX_BEGIN_NAMESPACE_LDBL
1369 template<
typename _CharT,
typename _InIter>
1422 get(iter_type __s, iter_type __end,
bool __intl,
ios_base& __io,
1423 ios_base::iostate& __err,
long double& __units)
const 1424 {
return this->do_get(__s, __end, __intl, __io, __err, __units); }
1453 get(iter_type __s, iter_type __end,
bool __intl,
ios_base& __io,
1454 ios_base::iostate& __err, string_type& __digits)
const 1455 {
return this->do_get(__s, __end, __intl, __io, __err, __digits); }
1470 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 1472 __do_get(iter_type __s, iter_type __end,
bool __intl,
ios_base& __io,
1473 ios_base::iostate& __err,
double& __units)
const;
1476 do_get(iter_type __s, iter_type __end,
bool __intl,
ios_base& __io,
1477 ios_base::iostate& __err,
long double& __units)
const;
1488 do_get(iter_type __s, iter_type __end,
bool __intl,
ios_base& __io,
1489 ios_base::iostate& __err, string_type& __digits)
const;
1492 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 1494 do_get(iter_type __s, iter_type __end,
bool __intl,
ios_base& __io,
1495 ios_base::iostate& __err,
long double& __units)
const;
1498 template<
bool _Intl>
1500 _M_extract(iter_type __s, iter_type __end,
ios_base& __io,
1501 ios_base::iostate& __err,
string& __digits)
const;
1504 template<
typename _CharT,
typename _InIter>
1520 template<
typename _CharT,
typename _OutIter>
1563 char_type __fill,
long double __units)
const 1564 {
return this->do_put(__s, __intl, __io, __fill, __units); }
1586 char_type __fill,
const string_type& __digits)
const 1587 {
return this->do_put(__s, __intl, __io, __fill, __digits); }
1613 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 1615 __do_put(iter_type __s,
bool __intl,
ios_base& __io, char_type __fill,
1616 double __units)
const;
1619 do_put(iter_type __s,
bool __intl,
ios_base& __io, char_type __fill,
1620 long double __units)
const;
1643 do_put(iter_type __s,
bool __intl,
ios_base& __io, char_type __fill,
1644 const string_type& __digits)
const;
1647 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 1649 do_put(iter_type __s,
bool __intl,
ios_base& __io, char_type __fill,
1650 long double __units)
const;
1653 template<
bool _Intl>
1655 _M_insert(iter_type __s,
ios_base& __io, char_type __fill,
1656 const string_type& __digits)
const;
1659 template<
typename _CharT,
typename _OutIter>
1662 _GLIBCXX_END_NAMESPACE_LDBL
1670 typedef int catalog;
1694 template<
typename _CharT>
1708 __c_locale _M_c_locale_messages;
1709 const char* _M_name_messages;
1737 messages(__c_locale __cloc,
const char* __s,
size_t __refs = 0);
1751 {
return this->do_open(__s, __loc); }
1786 get(catalog __c,
int __set,
int __msgid,
const string_type& __s)
const 1787 {
return this->do_get(__c, __set, __msgid, __s); }
1797 close(catalog __c)
const 1798 {
return this->do_close(__c); }
1836 do_get(catalog,
int,
int,
const string_type& __dfault)
const;
1844 do_close(catalog)
const;
1848 _M_convert_to_char(
const string_type& __msg)
const 1851 return reinterpret_cast<char*
>(
const_cast<_CharT*
>(__msg.
c_str()));
1856 _M_convert_from_char(
char*)
const 1859 return string_type();
1863 template<
typename _CharT>
1871 #ifdef _GLIBCXX_USE_WCHAR_T 1878 template<
typename _CharT>
1882 typedef _CharT char_type;
1894 _GLIBCXX_END_NAMESPACE_VERSION
1903 #include <bits/locale_facets_nonio.tcc> virtual ~time_put()
Destructor.
pattern pos_format() const
Return pattern for money values.
string_type negative_sign() const
Return negative sign string.
string grouping() const
Return grouping specification.
string_type positive_sign() const
Return positive sign string.
iter_type put(iter_type __s, bool __intl, ios_base &__io, char_type __fill, long double __units) const
Format and output a monetary value.
Primary class template messages.This facet encapsulates the code to retrieve messages from message ca...
static locale::id id
Numpunct facet id.
Facet ID class.The ID class provides facets with an index used to identify them. Every facet class mu...
virtual string_type do_positive_sign() const
Return positive sign string.
Money format ordering data.This class contains an ordered array of 4 fields to represent the pattern ...
iter_type get_time(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input time string.
basic_string< _CharT > string_type
Public typedefs.
virtual char_type do_thousands_sep() const
Return thousands separator character.
Primary class template time_put.This facet encapsulates the code to format and output dates and times...
Primary class template moneypunct.This facet encapsulates the punctuation, grouping and other formatt...
moneypunct(__c_locale __cloc, const char *__s, size_t __refs=0)
Internal constructor. Not for general use.
ISO C++ entities toplevel namespace is std.
virtual int do_frac_digits() const
Return number of digits in fraction.
virtual string do_grouping() const
Return grouping specification.
char_type decimal_point() const
Return decimal point character.
static locale::id id
Numpunct facet id.
virtual pattern do_pos_format() const
Return pattern for money values.
class messages_byname [22.2.7.2].
Primary class template time_get.This facet encapsulates the code to parse and return a date or time f...
_CharT char_type
Public typedefs.
static locale::id id
Numpunct facet id.
moneypunct(size_t __refs=0)
Constructor performs initialization.
dateorder date_order() const
Return preferred order of month, day, and year.
virtual pattern do_neg_format() const
Return pattern for money values.
iter_type get_monthname(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input month string.
moneypunct(__cache_type *__cache, size_t __refs=0)
Constructor performs initialization.
Localization functionality base class.The facet class is the base class for a localization feature...
char_type thousands_sep() const
Return thousands separator character.
time_put(size_t __refs=0)
Constructor performs initialization.
_CharT char_type
Public typedefs.
iter_type put(iter_type __s, bool __intl, ios_base &__io, char_type __fill, const string_type &__digits) const
Format and output a monetary value.
class time_get_byname [22.2.5.2].
virtual ~money_get()
Destructor.
virtual string_type do_negative_sign() const
Return negative sign string.
virtual ~time_get()
Destructor.
Primary class template money_put.This facet encapsulates the code to format and output a monetary amo...
iter_type get_year(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input year string.
basic_string< _CharT > string_type
Public typedefs.
_InIter iter_type
Public typedefs.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
virtual string_type do_curr_symbol() const
Return currency symbol string.
_InIter iter_type
Public typedefs.
Messages facet base class providing catalog typedef.
Time format ordering data.This class provides an enum representing different orderings of time: day...
iter_type put(iter_type __s, ios_base &__io, char_type __fill, const tm *__tm, char __format, char __mod=0) const
Format and output a time or date.
_CharT char_type
Public typedefs.
iter_type get_weekday(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input weekday string.
static locale::id id
Numpunct facet id.
Primary class template money_get.This facet encapsulates the code to parse and return a monetary amou...
_OutIter iter_type
Public typedefs.
int frac_digits() const
Return number of digits in fraction.
_CharT char_type
Public typedefs.
virtual ~moneypunct()
Destructor.
_CharT char_type
Public typedefs.
money_get(size_t __refs=0)
Constructor performs initialization.
_CharT char_type
Public typedefs.
basic_string< _CharT > string_type
Public typedefs.
static locale::id id
Numpunct facet id.
_OutIter iter_type
Public typedefs.
time_get(size_t __refs=0)
Constructor performs initialization.
pattern neg_format() const
Return pattern for money values.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
string_type curr_symbol() const
Return currency symbol string.
virtual char_type do_decimal_point() const
Return decimal point character.
iter_type get_date(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input date string.
class time_put_byname [22.2.5.4].
basic_string< _CharT > string_type
Public typedefs.
static locale::id id
Numpunct facet id.
class moneypunct_byname [22.2.6.4].
virtual ~money_put()
Destructor.
money_put(size_t __refs=0)
Constructor performs initialization.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.