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>
46 #ifndef _STLP_FACETS_FWD_H
47 # include <stl/_facets_fwd.h>
52 //----------------------------------------------------------------------
55 template <class _CharT
, class _InputIter
>
56 class num_get
: public locale::facet
{
58 typedef _CharT char_type
;
59 typedef _InputIter iter_type
;
61 explicit num_get(size_t __refs
= 0): locale::facet(__refs
) {}
63 #if !defined (_STLP_NO_BOOL)
64 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
65 ios_base::iostate
& __err
, bool& __val
) const
66 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
69 #if defined (_STLP_FIX_LIBRARY_ISSUES)
70 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
71 ios_base::iostate
& __err
, short& __val
) const
72 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
74 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
75 ios_base::iostate
& __err
, int& __val
) const
76 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
79 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
80 ios_base::iostate
& __err
, long& __val
) const
81 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
83 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
84 ios_base::iostate
& __err
, unsigned short& __val
) const
85 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
87 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
88 ios_base::iostate
& __err
, unsigned int& __val
) const
89 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
91 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
92 ios_base::iostate
& __err
, unsigned long& __val
) const
93 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
95 #if defined (_STLP_LONG_LONG)
96 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
97 ios_base::iostate
& __err
, _STLP_LONG_LONG
& __val
) const
98 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
100 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
101 ios_base::iostate
& __err
, unsigned _STLP_LONG_LONG
& __val
) const
102 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
103 #endif /* _STLP_LONG_LONG */
105 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
106 ios_base::iostate
& __err
, float& __val
) const
107 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
109 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
110 ios_base::iostate
& __err
, double& __val
) const
111 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
113 #if !defined (_STLP_NO_LONG_DOUBLE)
114 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
115 ios_base::iostate
& __err
, long double& __val
) const
116 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
119 _InputIter
get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
120 ios_base::iostate
& __err
, void*& __val
) const
121 { return do_get(__ii
, __end
, __str
, __err
, __val
); }
123 static locale::id id
;
128 typedef string string_type
;
129 typedef ctype
<_CharT
> _Ctype
;
130 typedef numpunct
<_CharT
> _Numpunct
;
132 #if !defined (_STLP_NO_BOOL)
133 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
134 ios_base::iostate
& __err
, bool& __val
) const;
137 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
138 ios_base::iostate
& __err
, long& __val
) const;
139 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
140 ios_base::iostate
& __err
, unsigned short& __val
) const;
141 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
142 ios_base::iostate
& __err
, unsigned int& __val
) const;
143 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
144 ios_base::iostate
& __err
, unsigned long& __val
) const;
146 #if defined (_STLP_FIX_LIBRARY_ISSUES)
147 // issue 118 : those are actually not supposed to be here
148 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
149 ios_base::iostate
& __err
, short& __val
) const;
150 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
151 ios_base::iostate
& __err
, int& __val
) const;
154 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
155 ios_base::iostate
& __err
, float& __val
) const;
156 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
157 ios_base::iostate
& __err
, double& __val
) const;
158 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
159 ios_base::iostate
& __err
, void*& __p
) const;
161 #if !defined (_STLP_NO_LONG_DOUBLE)
162 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
163 ios_base::iostate
& __err
, long double& __val
) const;
166 #if defined (_STLP_LONG_LONG)
167 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
168 ios_base::iostate
& __err
, _STLP_LONG_LONG
& __val
) const;
169 virtual _InputIter
do_get(_InputIter __ii
, _InputIter __end
, ios_base
& __str
,
170 ios_base::iostate
& __err
, unsigned _STLP_LONG_LONG
& __val
) const;
176 #if defined (_STLP_USE_TEMPLATE_EXPORT)
177 _STLP_EXPORT_TEMPLATE_CLASS num_get
<char, istreambuf_iterator
<char, char_traits
<char> > >;
178 // _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
179 # if !defined (_STLP_NO_WCHAR_T)
180 _STLP_EXPORT_TEMPLATE_CLASS num_get
<wchar_t, istreambuf_iterator
<wchar_t, char_traits
<wchar_t> > >;
181 // _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
185 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
187 _STLP_MOVE_TO_PRIV_NAMESPACE
189 _STLP_DECLSPEC
bool _STLP_CALL
__valid_grouping(const char*, const char*, const char*, const char*);
191 template <class _InputIter
, class _Integer
, class _CharT
>
193 __get_decimal_integer(_InputIter
& __first
, _InputIter
& __last
, _Integer
& __val
, _CharT
*);
195 # if !defined (_STLP_NO_WCHAR_T)
196 bool _STLP_DECLSPEC _STLP_CALL
__get_fdigit(wchar_t&, const wchar_t*);
197 bool _STLP_DECLSPEC _STLP_CALL
__get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
200 inline void _STLP_CALL
201 _Initialize_get_float(const ctype
<char>&,
202 char& Plus
, char& Minus
,
203 char& pow_e
, char& pow_E
,
211 # if !defined (_STLP_NO_WCHAR_T)
212 void _STLP_DECLSPEC _STLP_CALL
_Initialize_get_float(const ctype
<wchar_t>&,
213 wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
215 void _STLP_DECLSPEC _STLP_CALL
__string_to_float(const __iostring
&, float&);
216 void _STLP_DECLSPEC _STLP_CALL
__string_to_float(const __iostring
&, double&);
217 # if !defined (_STLP_NO_LONG_DOUBLE)
218 void _STLP_DECLSPEC _STLP_CALL
__string_to_float(const __iostring
&, long double&);
221 _STLP_MOVE_TO_STD_NAMESPACE
223 #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 */