1 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2 // 2006, 2007, 2008, 2009, 2010
3 // 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/>.
27 _GLIBCXX_BEGIN_NAMESPACE(std
)
29 // Definitions for static const data members of time_base.
32 __timepunct_cache
<char>::_S_timezones
[14] =
34 "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
35 "IST", "EET", "CST", "JST"
38 #ifdef _GLIBCXX_USE_WCHAR_T
41 __timepunct_cache
<wchar_t>::_S_timezones
[14] =
43 L
"GMT", L
"HST", L
"AKST", L
"PST", L
"MST", L
"CST", L
"EST", L
"AST",
44 L
"NST", L
"CET", L
"IST", L
"EET", L
"CST", L
"JST"
48 // Definitions for static const data members of money_base.
49 const money_base::pattern
50 money_base::_S_default_pattern
= { {symbol
, sign
, none
, value
} };
52 const char* money_base::_S_atoms
= "-0123456789";
54 const char* __num_base::_S_atoms_in
= "-+xX0123456789abcdefABCDEF";
55 const char* __num_base::_S_atoms_out
="-+xX0123456789abcdef0123456789ABCDEF";
57 // _GLIBCXX_RESOLVE_LIB_DEFECTS
58 // According to the resolution of DR 231, about 22.2.2.2.2, p11,
59 // "str.precision() is specified in the conversion specification".
61 __num_base::_S_format_float(const ios_base
& __io
, char* __fptr
,
64 ios_base::fmtflags __flags
= __io
.flags();
66 // [22.2.2.2.2] Table 60
67 if (__flags
& ios_base::showpos
)
69 if (__flags
& ios_base::showpoint
)
72 // As per DR 231: _always_, not only when
73 // __flags & ios_base::fixed || __prec > 0
79 ios_base::fmtflags __fltfield
= __flags
& ios_base::floatfield
;
80 // [22.2.2.2.2] Table 58
81 if (__fltfield
== ios_base::fixed
)
83 else if (__fltfield
== ios_base::scientific
)
84 *__fptr
++ = (__flags
& ios_base::uppercase
) ? 'E' : 'e';
86 *__fptr
++ = (__flags
& ios_base::uppercase
) ? 'G' : 'g';
91 __verify_grouping(const char* __grouping
, size_t __grouping_size
,
92 const string
& __grouping_tmp
) throw()
94 const size_t __n
= __grouping_tmp
.size() - 1;
95 const size_t __min
= std::min(__n
, size_t(__grouping_size
- 1));
99 // Parsed number groupings have to match the
100 // numpunct::grouping string exactly, starting at the
101 // right-most point of the parsed sequence of elements ...
102 for (size_t __j
= 0; __j
< __min
&& __test
; --__i
, ++__j
)
103 __test
= __grouping_tmp
[__i
] == __grouping
[__j
];
104 for (; __i
&& __test
; --__i
)
105 __test
= __grouping_tmp
[__i
] == __grouping
[__min
];
106 // ... but the first parsed grouping can be <= numpunct
107 // grouping (only do the check if the numpunct char is > 0
108 // because <= 0 means any size is ok).
109 if (static_cast<signed char>(__grouping
[__min
]) > 0
110 && __grouping
[__min
] != __gnu_cxx::__numeric_traits
<char>::__max
)
111 __test
&= __grouping_tmp
[0] <= __grouping
[__min
];
115 _GLIBCXX_END_NAMESPACE