3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
11 * Permission to use or copy this software for any purpose is hereby granted
12 * without fee, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
18 // WARNING: This is an internal header file, included by other C++
19 // standard library headers. You should not attempt to use this header
23 #ifndef _STLP_INTERNAL_NUM_GET_H
24 #define _STLP_INTERNAL_NUM_GET_H
26 #ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
27 # include <stl/_istreambuf_iterator.h>
30 #ifndef _STLP_C_LOCALE_H
31 # include <stl/c_locale.h>
34 #ifndef _STLP_INTERNAL_NUMPUNCT_H
35 # include <stl/_numpunct.h>
38 #ifndef _STLP_INTERNAL_CTYPE_H
39 # include <stl/_ctype.h>
42 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
43 # include <stl/_iostream_string.h>
48 //----------------------------------------------------------------------
51 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
52 template <class _CharT, class _InputIter>
54 template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
56 class num_get: public locale::facet {
57 friend class _Locale_impl;
59 typedef _CharT char_type;
60 typedef _InputIter iter_type;
62 explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
64 #if !defined (_STLP_NO_BOOL)
65 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
66 ios_base::iostate& __err, bool& __val) const
67 { return do_get(__ii, __end, __str, __err, __val); }
70 #if defined (_STLP_FIX_LIBRARY_ISSUES)
71 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
72 ios_base::iostate& __err, short& __val) const
73 { return do_get(__ii, __end, __str, __err, __val); }
75 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
76 ios_base::iostate& __err, int& __val) const
77 { return do_get(__ii, __end, __str, __err, __val); }
80 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
81 ios_base::iostate& __err, long& __val) const
82 { return do_get(__ii, __end, __str, __err, __val); }
84 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
85 ios_base::iostate& __err, unsigned short& __val) const
86 { return do_get(__ii, __end, __str, __err, __val); }
88 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
89 ios_base::iostate& __err, unsigned int& __val) const
90 { return do_get(__ii, __end, __str, __err, __val); }
92 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
93 ios_base::iostate& __err, unsigned long& __val) const
94 { return do_get(__ii, __end, __str, __err, __val); }
96 #if defined (_STLP_LONG_LONG)
97 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
98 ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
99 { return do_get(__ii, __end, __str, __err, __val); }
101 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
102 ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
103 { return do_get(__ii, __end, __str, __err, __val); }
104 #endif /* _STLP_LONG_LONG */
106 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
107 ios_base::iostate& __err, float& __val) const
108 { return do_get(__ii, __end, __str, __err, __val); }
110 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
111 ios_base::iostate& __err, double& __val) const
112 { return do_get(__ii, __end, __str, __err, __val); }
114 #if !defined (_STLP_NO_LONG_DOUBLE)
115 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
116 ios_base::iostate& __err, long double& __val) const
117 { return do_get(__ii, __end, __str, __err, __val); }
120 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
121 ios_base::iostate& __err, void*& __val) const
122 { return do_get(__ii, __end, __str, __err, __val); }
124 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
129 typedef string string_type;
130 typedef ctype<_CharT> _Ctype;
131 typedef numpunct<_CharT> _Numpunct;
133 #if !defined (_STLP_NO_BOOL)
134 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
135 ios_base::iostate& __err, bool& __val) const;
138 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
139 ios_base::iostate& __err, long& __val) const;
140 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
141 ios_base::iostate& __err, unsigned short& __val) const;
142 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
143 ios_base::iostate& __err, unsigned int& __val) const;
144 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
145 ios_base::iostate& __err, unsigned long& __val) const;
147 #if defined (_STLP_FIX_LIBRARY_ISSUES)
148 // issue 118 : those are actually not supposed to be here
149 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
150 ios_base::iostate& __err, short& __val) const;
151 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
152 ios_base::iostate& __err, int& __val) const;
155 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
156 ios_base::iostate& __err, float& __val) const;
157 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
158 ios_base::iostate& __err, double& __val) const;
159 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
160 ios_base::iostate& __err, void*& __p) const;
162 #if !defined (_STLP_NO_LONG_DOUBLE)
163 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
164 ios_base::iostate& __err, long double& __val) const;
167 #if defined (_STLP_LONG_LONG)
168 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
169 ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
170 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
171 ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
177 #if defined (_STLP_USE_TEMPLATE_EXPORT)
178 _STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
179 // _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
180 # if !defined (_STLP_NO_WCHAR_T)
181 _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
182 // _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
186 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
188 _STLP_MOVE_TO_PRIV_NAMESPACE
190 extern bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
192 template <class _InputIter, class _Integer, class _CharT>
194 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
196 # if !defined (_STLP_NO_WCHAR_T)
197 bool _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
198 bool _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
201 inline void _STLP_CALL
202 _Initialize_get_float(const ctype<char>&,
203 char& Plus, char& Minus,
204 char& pow_e, char& pow_E,
212 # if !defined (_STLP_NO_WCHAR_T)
213 void _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
214 wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
216 void _STLP_CALL __string_to_float(const __iostring&, float&);
217 void _STLP_CALL __string_to_float(const __iostring&, double&);
218 # if !defined (_STLP_NO_LONG_DOUBLE)
219 void _STLP_CALL __string_to_float(const __iostring&, long double&);
222 _STLP_MOVE_TO_STD_NAMESPACE
224 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
228 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
229 # include <stl/_num_get.c>
232 #endif /* _STLP_INTERNAL_NUM_GET_H */