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