1 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
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 2, 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 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
32 _GLIBCXX_BEGIN_NAMESPACE(std
)
34 // Definitions for static const data members of time_base.
37 __timepunct_cache
<char>::_S_timezones
[14] =
39 "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
40 "IST", "EET", "CST", "JST"
43 #ifdef _GLIBCXX_USE_WCHAR_T
46 __timepunct_cache
<wchar_t>::_S_timezones
[14] =
48 L
"GMT", L
"HST", L
"AKST", L
"PST", L
"MST", L
"CST", L
"EST", L
"AST",
49 L
"NST", L
"CET", L
"IST", L
"EET", L
"CST", L
"JST"
53 // Definitions for static const data members of money_base.
54 const money_base::pattern
55 money_base::_S_default_pattern
= { {symbol
, sign
, none
, value
} };
57 const char* money_base::_S_atoms
= "-0123456789";
59 const char* __num_base::_S_atoms_in
= "-+xX0123456789abcdefABCDEF";
60 const char* __num_base::_S_atoms_out
="-+xX0123456789abcdef0123456789ABCDEF";
62 // _GLIBCXX_RESOLVE_LIB_DEFECTS
63 // According to the resolution of DR 231, about 22.2.2.2.2, p11,
64 // "str.precision() is specified in the conversion specification".
66 __num_base::_S_format_float(const ios_base
& __io
, char* __fptr
, char __mod
)
68 ios_base::fmtflags __flags
= __io
.flags();
70 // [22.2.2.2.2] Table 60
71 if (__flags
& ios_base::showpos
)
73 if (__flags
& ios_base::showpoint
)
76 // As per DR 231: _always_, not only when
77 // __flags & ios_base::fixed || __prec > 0
83 ios_base::fmtflags __fltfield
= __flags
& ios_base::floatfield
;
84 // [22.2.2.2.2] Table 58
85 if (__fltfield
== ios_base::fixed
)
87 else if (__fltfield
== ios_base::scientific
)
88 *__fptr
++ = (__flags
& ios_base::uppercase
) ? 'E' : 'e';
90 *__fptr
++ = (__flags
& ios_base::uppercase
) ? 'G' : 'g';
95 __verify_grouping(const char* __grouping
, size_t __grouping_size
,
96 const string
& __grouping_tmp
)
98 const size_t __n
= __grouping_tmp
.size() - 1;
99 const size_t __min
= std::min(__n
, size_t(__grouping_size
- 1));
103 // Parsed number groupings have to match the
104 // numpunct::grouping string exactly, starting at the
105 // right-most point of the parsed sequence of elements ...
106 for (size_t __j
= 0; __j
< __min
&& __test
; --__i
, ++__j
)
107 __test
= __grouping_tmp
[__i
] == __grouping
[__j
];
108 for (; __i
&& __test
; --__i
)
109 __test
= __grouping_tmp
[__i
] == __grouping
[__min
];
110 // ... but the first parsed grouping can be <= numpunct
111 // grouping (only do the check if the numpunct char is > 0
112 // because <= 0 means any size is ok).
113 if (static_cast<signed char>(__grouping
[__min
]) > 0)
114 __test
&= __grouping_tmp
[0] <= __grouping
[__min
];
118 _GLIBCXX_END_NAMESPACE