williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 1999
|
williamr@4
|
3 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@4
|
4 |
*
|
williamr@4
|
5 |
* Copyright (c) 1999
|
williamr@4
|
6 |
* Boris Fomitchev
|
williamr@4
|
7 |
*
|
williamr@4
|
8 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@4
|
9 |
* or implied. Any use is at your own risk.
|
williamr@4
|
10 |
*
|
williamr@4
|
11 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@4
|
12 |
* without fee, provided the above notices are retained on all copies.
|
williamr@4
|
13 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@4
|
14 |
* provided the above notices are retained, and a notice that the code was
|
williamr@4
|
15 |
* modified is included with the above copyright notice.
|
williamr@4
|
16 |
*
|
williamr@4
|
17 |
*/
|
williamr@4
|
18 |
// WARNING: This is an internal header file, included by other C++
|
williamr@4
|
19 |
// standard library headers. You should not attempt to use this header
|
williamr@4
|
20 |
// file directly.
|
williamr@4
|
21 |
|
williamr@4
|
22 |
|
williamr@4
|
23 |
#ifndef _STLP_INTERNAL_NUMPUNCT_H
|
williamr@4
|
24 |
#define _STLP_INTERNAL_NUMPUNCT_H
|
williamr@4
|
25 |
|
williamr@4
|
26 |
#ifndef _STLP_IOS_BASE_H
|
williamr@4
|
27 |
# include <stl/_ios_base.h>
|
williamr@4
|
28 |
#endif
|
williamr@4
|
29 |
|
williamr@4
|
30 |
# ifndef _STLP_C_LOCALE_H
|
williamr@4
|
31 |
# include <stl/c_locale.h>
|
williamr@4
|
32 |
# endif
|
williamr@4
|
33 |
|
williamr@4
|
34 |
#ifndef _STLP_INTERNAL_STRING_H
|
williamr@4
|
35 |
# include <stl/_string.h>
|
williamr@4
|
36 |
#endif
|
williamr@4
|
37 |
|
williamr@4
|
38 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
39 |
|
williamr@4
|
40 |
//----------------------------------------------------------------------
|
williamr@4
|
41 |
// numpunct facets
|
williamr@4
|
42 |
|
williamr@4
|
43 |
template <class _CharT> class numpunct {};
|
williamr@4
|
44 |
template <class _CharT> class numpunct_byname {};
|
williamr@4
|
45 |
template <class _Ch, class _InIt> class num_get;
|
williamr@4
|
46 |
|
williamr@4
|
47 |
_STLP_TEMPLATE_NULL
|
williamr@4
|
48 |
class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
|
williamr@4
|
49 |
{
|
williamr@4
|
50 |
friend class _Locale_impl;
|
williamr@4
|
51 |
|
williamr@4
|
52 |
#ifndef _STLP_NO_FRIEND_TEMPLATES
|
williamr@4
|
53 |
template <class _Ch, class _InIt> friend class num_get;
|
williamr@4
|
54 |
#endif
|
williamr@4
|
55 |
public:
|
williamr@4
|
56 |
typedef char char_type;
|
williamr@4
|
57 |
typedef string string_type;
|
williamr@4
|
58 |
|
williamr@4
|
59 |
explicit numpunct(size_t __refs = 0)
|
williamr@4
|
60 |
: locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
|
williamr@4
|
61 |
|
williamr@4
|
62 |
char decimal_point() const { return do_decimal_point(); }
|
williamr@4
|
63 |
char thousands_sep() const { return do_thousands_sep(); }
|
williamr@4
|
64 |
string grouping() const { return do_grouping(); }
|
williamr@4
|
65 |
string truename() const { return do_truename(); }
|
williamr@4
|
66 |
string falsename() const { return do_falsename(); }
|
williamr@4
|
67 |
|
williamr@4
|
68 |
static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
|
williamr@4
|
69 |
|
williamr@4
|
70 |
#ifndef _STLP_NO_FRIEND_TEMPLATES
|
williamr@4
|
71 |
protected:
|
williamr@4
|
72 |
#endif
|
williamr@4
|
73 |
~numpunct();
|
williamr@4
|
74 |
|
williamr@4
|
75 |
string _M_truename;
|
williamr@4
|
76 |
string _M_falsename;
|
williamr@4
|
77 |
string _M_grouping;
|
williamr@4
|
78 |
|
williamr@4
|
79 |
virtual char do_decimal_point() const;
|
williamr@4
|
80 |
virtual char do_thousands_sep() const;
|
williamr@4
|
81 |
virtual string do_grouping() const;
|
williamr@4
|
82 |
virtual string do_truename() const;
|
williamr@4
|
83 |
virtual string do_falsename() const;
|
williamr@4
|
84 |
};
|
williamr@4
|
85 |
|
williamr@4
|
86 |
# if ! defined (_STLP_NO_WCHAR_T)
|
williamr@4
|
87 |
|
williamr@4
|
88 |
_STLP_TEMPLATE_NULL
|
williamr@4
|
89 |
class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
|
williamr@4
|
90 |
{
|
williamr@4
|
91 |
friend class _Locale_impl;
|
williamr@4
|
92 |
public:
|
williamr@4
|
93 |
typedef wchar_t char_type;
|
williamr@4
|
94 |
typedef wstring string_type;
|
williamr@4
|
95 |
|
williamr@4
|
96 |
explicit numpunct(size_t __refs = 0)
|
williamr@4
|
97 |
: locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
|
williamr@4
|
98 |
|
williamr@4
|
99 |
wchar_t decimal_point() const { return do_decimal_point(); }
|
williamr@4
|
100 |
wchar_t thousands_sep() const { return do_thousands_sep(); }
|
williamr@4
|
101 |
string grouping() const { return do_grouping(); }
|
williamr@4
|
102 |
wstring truename() const { return do_truename(); }
|
williamr@4
|
103 |
wstring falsename() const { return do_falsename(); }
|
williamr@4
|
104 |
|
williamr@4
|
105 |
static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
|
williamr@4
|
106 |
|
williamr@4
|
107 |
protected:
|
williamr@4
|
108 |
wstring _M_truename;
|
williamr@4
|
109 |
wstring _M_falsename;
|
williamr@4
|
110 |
string _M_grouping;
|
williamr@4
|
111 |
|
williamr@4
|
112 |
~numpunct();
|
williamr@4
|
113 |
|
williamr@4
|
114 |
virtual wchar_t do_decimal_point() const;
|
williamr@4
|
115 |
virtual wchar_t do_thousands_sep() const;
|
williamr@4
|
116 |
virtual string do_grouping() const;
|
williamr@4
|
117 |
virtual wstring do_truename() const;
|
williamr@4
|
118 |
virtual wstring do_falsename() const;
|
williamr@4
|
119 |
};
|
williamr@4
|
120 |
|
williamr@4
|
121 |
# endif /* WCHAR_T */
|
williamr@4
|
122 |
|
williamr@4
|
123 |
_STLP_TEMPLATE_NULL
|
williamr@4
|
124 |
class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
|
williamr@4
|
125 |
public:
|
williamr@4
|
126 |
typedef char char_type;
|
williamr@4
|
127 |
typedef string string_type;
|
williamr@4
|
128 |
|
williamr@4
|
129 |
explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
|
williamr@4
|
130 |
|
williamr@4
|
131 |
protected:
|
williamr@4
|
132 |
|
williamr@4
|
133 |
~numpunct_byname();
|
williamr@4
|
134 |
|
williamr@4
|
135 |
virtual char do_decimal_point() const;
|
williamr@4
|
136 |
virtual char do_thousands_sep() const;
|
williamr@4
|
137 |
virtual string do_grouping() const;
|
williamr@4
|
138 |
|
williamr@4
|
139 |
private:
|
williamr@4
|
140 |
_Locale_numeric* _M_numeric;
|
williamr@4
|
141 |
|
williamr@4
|
142 |
//explicitely defined as private to avoid warnings:
|
williamr@4
|
143 |
typedef numpunct_byname<char> _Self;
|
williamr@4
|
144 |
numpunct_byname(_Self const&);
|
williamr@4
|
145 |
_Self& operator = (_Self const&);
|
williamr@4
|
146 |
friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
|
williamr@4
|
147 |
};
|
williamr@4
|
148 |
|
williamr@4
|
149 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@4
|
150 |
_STLP_TEMPLATE_NULL
|
williamr@4
|
151 |
class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
|
williamr@4
|
152 |
public:
|
williamr@4
|
153 |
typedef wchar_t char_type;
|
williamr@4
|
154 |
typedef wstring string_type;
|
williamr@4
|
155 |
|
williamr@4
|
156 |
explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
|
williamr@4
|
157 |
|
williamr@4
|
158 |
protected:
|
williamr@4
|
159 |
|
williamr@4
|
160 |
~numpunct_byname();
|
williamr@4
|
161 |
|
williamr@4
|
162 |
virtual wchar_t do_decimal_point() const;
|
williamr@4
|
163 |
virtual wchar_t do_thousands_sep() const;
|
williamr@4
|
164 |
virtual string do_grouping() const;
|
williamr@4
|
165 |
|
williamr@4
|
166 |
private:
|
williamr@4
|
167 |
_Locale_numeric* _M_numeric;
|
williamr@4
|
168 |
|
williamr@4
|
169 |
//explicitely defined as private to avoid warnings:
|
williamr@4
|
170 |
typedef numpunct_byname<wchar_t> _Self;
|
williamr@4
|
171 |
numpunct_byname(_Self const&);
|
williamr@4
|
172 |
_Self& operator = (_Self const&);
|
williamr@4
|
173 |
};
|
williamr@4
|
174 |
|
williamr@4
|
175 |
# endif /* WCHAR_T */
|
williamr@4
|
176 |
|
williamr@4
|
177 |
_STLP_END_NAMESPACE
|
williamr@4
|
178 |
|
williamr@4
|
179 |
#endif /* _STLP_NUMPUNCT_H */
|
williamr@4
|
180 |
|
williamr@4
|
181 |
// Local Variables:
|
williamr@4
|
182 |
// mode:C++
|
williamr@4
|
183 |
// End:
|
williamr@4
|
184 |
|