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