williamr@2
|
1 |
/*
|
williamr@4
|
2 |
* Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
|
williamr@4
|
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_NUM_GET_H
|
williamr@2
|
26 |
#define _STLP_INTERNAL_NUM_GET_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
|
williamr@4
|
29 |
# include <stl/_istreambuf_iterator.h>
|
williamr@2
|
30 |
#endif
|
williamr@2
|
31 |
|
williamr@4
|
32 |
#ifndef _STLP_C_LOCALE_H
|
williamr@2
|
33 |
# include <stl/c_locale.h>
|
williamr@4
|
34 |
#endif
|
williamr@2
|
35 |
|
williamr@2
|
36 |
#ifndef _STLP_INTERNAL_NUMPUNCT_H
|
williamr@4
|
37 |
# include <stl/_numpunct.h>
|
williamr@2
|
38 |
#endif
|
williamr@4
|
39 |
|
williamr@2
|
40 |
#ifndef _STLP_INTERNAL_CTYPE_H
|
williamr@4
|
41 |
# include <stl/_ctype.h>
|
williamr@4
|
42 |
#endif
|
williamr@4
|
43 |
|
williamr@4
|
44 |
#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
|
williamr@4
|
45 |
# include <stl/_iostream_string.h>
|
williamr@2
|
46 |
#endif
|
williamr@2
|
47 |
|
williamr@2
|
48 |
_STLP_BEGIN_NAMESPACE
|
williamr@2
|
49 |
|
williamr@2
|
50 |
//----------------------------------------------------------------------
|
williamr@2
|
51 |
// num_get facets
|
williamr@2
|
52 |
|
williamr@4
|
53 |
#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
|
williamr@4
|
54 |
template <class _CharT, class _InputIter>
|
williamr@2
|
55 |
#else
|
williamr@4
|
56 |
template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
|
williamr@2
|
57 |
#endif
|
williamr@4
|
58 |
class num_get: public locale::facet {
|
williamr@4
|
59 |
friend class _Locale_impl;
|
williamr@2
|
60 |
public:
|
williamr@2
|
61 |
typedef _CharT char_type;
|
williamr@2
|
62 |
typedef _InputIter iter_type;
|
williamr@2
|
63 |
|
williamr@4
|
64 |
explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
|
williamr@4
|
65 |
|
williamr@4
|
66 |
#if !defined (_STLP_NO_BOOL)
|
williamr@4
|
67 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
68 |
ios_base::iostate& __err, bool& __val) const
|
williamr@4
|
69 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
70 |
#endif
|
williamr@4
|
71 |
|
williamr@4
|
72 |
#if defined (_STLP_FIX_LIBRARY_ISSUES)
|
williamr@4
|
73 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
74 |
ios_base::iostate& __err, short& __val) const
|
williamr@4
|
75 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
76 |
|
williamr@4
|
77 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
78 |
ios_base::iostate& __err, int& __val) const
|
williamr@4
|
79 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
80 |
#endif
|
williamr@4
|
81 |
|
williamr@4
|
82 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
83 |
ios_base::iostate& __err, long& __val) const
|
williamr@4
|
84 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
85 |
|
williamr@4
|
86 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
87 |
ios_base::iostate& __err, unsigned short& __val) const
|
williamr@4
|
88 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
89 |
|
williamr@4
|
90 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
91 |
ios_base::iostate& __err, unsigned int& __val) const
|
williamr@4
|
92 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
93 |
|
williamr@4
|
94 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
95 |
ios_base::iostate& __err, unsigned long& __val) const
|
williamr@4
|
96 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
97 |
|
williamr@4
|
98 |
#if defined (_STLP_LONG_LONG)
|
williamr@4
|
99 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
100 |
ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
|
williamr@4
|
101 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
102 |
|
williamr@4
|
103 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
104 |
ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
|
williamr@4
|
105 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
106 |
#endif /* _STLP_LONG_LONG */
|
williamr@4
|
107 |
|
williamr@4
|
108 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
109 |
ios_base::iostate& __err, float& __val) const
|
williamr@4
|
110 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
111 |
|
williamr@4
|
112 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
113 |
ios_base::iostate& __err, double& __val) const
|
williamr@4
|
114 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@4
|
115 |
|
williamr@4
|
116 |
#if !defined (_STLP_NO_LONG_DOUBLE)
|
williamr@4
|
117 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
118 |
ios_base::iostate& __err, long double& __val) const
|
williamr@4
|
119 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@2
|
120 |
# endif
|
williamr@2
|
121 |
|
williamr@4
|
122 |
_InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
123 |
ios_base::iostate& __err, void*& __val) const
|
williamr@4
|
124 |
{ return do_get(__ii, __end, __str, __err, __val); }
|
williamr@2
|
125 |
|
williamr@4
|
126 |
#if defined(__SYMBIAN32__WSD__)
|
williamr@4
|
127 |
static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
|
williamr@4
|
128 |
#elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
|
williamr@4
|
129 |
static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
|
williamr@4
|
130 |
static locale::id id;
|
williamr@2
|
131 |
#else
|
williamr@4
|
132 |
// NOTE: Symbian doesn't support exporting static data.
|
williamr@4
|
133 |
// Users of this class should use GetFacetLocaleId() to access the data member id
|
williamr@4
|
134 |
static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
|
williamr@2
|
135 |
#endif
|
williamr@2
|
136 |
|
williamr@2
|
137 |
protected:
|
williamr@2
|
138 |
~num_get() {}
|
williamr@2
|
139 |
|
williamr@4
|
140 |
typedef string string_type;
|
williamr@2
|
141 |
typedef ctype<_CharT> _Ctype;
|
williamr@2
|
142 |
typedef numpunct<_CharT> _Numpunct;
|
williamr@2
|
143 |
|
williamr@4
|
144 |
#if !defined (_STLP_NO_BOOL)
|
williamr@4
|
145 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
146 |
ios_base::iostate& __err, bool& __val) const;
|
williamr@4
|
147 |
#endif
|
williamr@2
|
148 |
|
williamr@4
|
149 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
150 |
ios_base::iostate& __err, long& __val) const;
|
williamr@4
|
151 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
152 |
ios_base::iostate& __err, unsigned short& __val) const;
|
williamr@4
|
153 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
154 |
ios_base::iostate& __err, unsigned int& __val) const;
|
williamr@4
|
155 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
156 |
ios_base::iostate& __err, unsigned long& __val) const;
|
williamr@4
|
157 |
|
williamr@4
|
158 |
#if defined (_STLP_FIX_LIBRARY_ISSUES)
|
williamr@2
|
159 |
// issue 118 : those are actually not supposed to be here
|
williamr@4
|
160 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
161 |
ios_base::iostate& __err, short& __val) const;
|
williamr@4
|
162 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
163 |
ios_base::iostate& __err, int& __val) const;
|
williamr@4
|
164 |
#endif
|
williamr@2
|
165 |
|
williamr@4
|
166 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
167 |
ios_base::iostate& __err, float& __val) const;
|
williamr@4
|
168 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
169 |
ios_base::iostate& __err, double& __val) const;
|
williamr@4
|
170 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
171 |
ios_base::iostate& __err, void*& __p) const;
|
williamr@2
|
172 |
|
williamr@4
|
173 |
#if !defined (_STLP_NO_LONG_DOUBLE)
|
williamr@4
|
174 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
175 |
ios_base::iostate& __err, long double& __val) const;
|
williamr@4
|
176 |
#endif
|
williamr@2
|
177 |
|
williamr@4
|
178 |
#if defined (_STLP_LONG_LONG)
|
williamr@4
|
179 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@2
|
180 |
ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
|
williamr@4
|
181 |
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
|
williamr@4
|
182 |
ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
|
williamr@4
|
183 |
#endif
|
williamr@2
|
184 |
|
williamr@2
|
185 |
};
|
williamr@2
|
186 |
|
williamr@2
|
187 |
|
williamr@4
|
188 |
#if defined (_STLP_USE_TEMPLATE_EXPORT)
|
williamr@2
|
189 |
_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
|
williamr@2
|
190 |
// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
|
williamr@4
|
191 |
# if !defined (_STLP_NO_WCHAR_T)
|
williamr@2
|
192 |
_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
|
williamr@2
|
193 |
// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
|
williamr@4
|
194 |
# endif
|
williamr@4
|
195 |
#endif
|
williamr@2
|
196 |
|
williamr@4
|
197 |
#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
|
williamr@2
|
198 |
|
williamr@4
|
199 |
_STLP_MOVE_TO_PRIV_NAMESPACE
|
williamr@2
|
200 |
|
williamr@4
|
201 |
_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
|
williamr@4
|
202 |
|
williamr@4
|
203 |
template <class _InputIter, class _Integer, class _CharT>
|
williamr@2
|
204 |
bool _STLP_CALL
|
williamr@4
|
205 |
__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
|
williamr@2
|
206 |
|
williamr@4
|
207 |
# if !defined (_STLP_NO_WCHAR_T)
|
williamr@4
|
208 |
bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
|
williamr@4
|
209 |
bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
|
williamr@4
|
210 |
# endif
|
williamr@2
|
211 |
|
williamr@2
|
212 |
inline void _STLP_CALL
|
williamr@2
|
213 |
_Initialize_get_float(const ctype<char>&,
|
williamr@2
|
214 |
char& Plus, char& Minus,
|
williamr@2
|
215 |
char& pow_e, char& pow_E,
|
williamr@4
|
216 |
char*) {
|
williamr@2
|
217 |
Plus = '+';
|
williamr@2
|
218 |
Minus = '-';
|
williamr@2
|
219 |
pow_e = 'e';
|
williamr@2
|
220 |
pow_E = 'E';
|
williamr@2
|
221 |
}
|
williamr@2
|
222 |
|
williamr@4
|
223 |
# if !defined (_STLP_NO_WCHAR_T)
|
williamr@4
|
224 |
void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
|
williamr@4
|
225 |
wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
|
williamr@4
|
226 |
# endif
|
williamr@4
|
227 |
void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
|
williamr@4
|
228 |
void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
|
williamr@4
|
229 |
# if !defined (_STLP_NO_LONG_DOUBLE)
|
williamr@4
|
230 |
void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
|
williamr@4
|
231 |
# endif
|
williamr@2
|
232 |
|
williamr@4
|
233 |
_STLP_MOVE_TO_STD_NAMESPACE
|
williamr@2
|
234 |
|
williamr@4
|
235 |
#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
|
williamr@2
|
236 |
|
williamr@2
|
237 |
_STLP_END_NAMESPACE
|
williamr@2
|
238 |
|
williamr@4
|
239 |
#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
|
williamr@4
|
240 |
# include <stl/_num_get.c>
|
williamr@4
|
241 |
#endif
|
williamr@2
|
242 |
|
williamr@2
|
243 |
#endif /* _STLP_INTERNAL_NUM_GET_H */
|
williamr@2
|
244 |
|
williamr@2
|
245 |
// Local Variables:
|
williamr@2
|
246 |
// mode:C++
|
williamr@2
|
247 |
// End:
|
williamr@2
|
248 |
|