2 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
5 * Silicon Graphics Computer Systems, Inc.
10 * This material is provided "as is", with absolutely no warranty expressed
11 * or implied. Any use is at your own risk.
13 * Permission to use or copy this software for any purpose is hereby granted
14 * without fee, provided the above notices are retained on all copies.
15 * Permission to modify the code and to distribute modified code is granted,
16 * provided the above notices are retained, and a notice that the code was
17 * modified is included with the above copyright notice.
20 // WARNING: This is an internal header file, included by other C++
21 // standard library headers. You should not attempt to use this header
25 #ifndef _STLP_INTERNAL_NUM_GET_H
26 #define _STLP_INTERNAL_NUM_GET_H
28 #ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
29 # include <stl/_istreambuf_iterator.h>
32 #ifndef _STLP_C_LOCALE_H
33 # include <stl/c_locale.h>
36 #ifndef _STLP_INTERNAL_NUMPUNCT_H
37 # include <stl/_numpunct.h>
40 #ifndef _STLP_INTERNAL_CTYPE_H
41 # include <stl/_ctype.h>
44 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
45 # include <stl/_iostream_string.h>
50 //----------------------------------------------------------------------
53 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
54 template <class _CharT, class _InputIter>
56 template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
58 class num_get: public locale::facet {
59 friend class _Locale_impl;
61 typedef _CharT char_type;
62 typedef _InputIter iter_type;
64 explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
66 #if !defined (_STLP_NO_BOOL)
67 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
68 ios_base::iostate& __err, bool& __val) const
69 { return do_get(__ii, __end, __str, __err, __val); }
72 #if defined (_STLP_FIX_LIBRARY_ISSUES)
73 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
74 ios_base::iostate& __err, short& __val) const
75 { return do_get(__ii, __end, __str, __err, __val); }
77 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
78 ios_base::iostate& __err, int& __val) const
79 { return do_get(__ii, __end, __str, __err, __val); }
82 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
83 ios_base::iostate& __err, long& __val) const
84 { return do_get(__ii, __end, __str, __err, __val); }
86 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
87 ios_base::iostate& __err, unsigned short& __val) const
88 { return do_get(__ii, __end, __str, __err, __val); }
90 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
91 ios_base::iostate& __err, unsigned int& __val) const
92 { return do_get(__ii, __end, __str, __err, __val); }
94 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
95 ios_base::iostate& __err, unsigned long& __val) const
96 { return do_get(__ii, __end, __str, __err, __val); }
98 #if defined (_STLP_LONG_LONG)
99 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
100 ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
101 { return do_get(__ii, __end, __str, __err, __val); }
103 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
104 ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
105 { return do_get(__ii, __end, __str, __err, __val); }
106 #endif /* _STLP_LONG_LONG */
108 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
109 ios_base::iostate& __err, float& __val) const
110 { return do_get(__ii, __end, __str, __err, __val); }
112 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
113 ios_base::iostate& __err, double& __val) const
114 { return do_get(__ii, __end, __str, __err, __val); }
116 #if !defined (_STLP_NO_LONG_DOUBLE)
117 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
118 ios_base::iostate& __err, long double& __val) const
119 { return do_get(__ii, __end, __str, __err, __val); }
122 _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
123 ios_base::iostate& __err, void*& __val) const
124 { return do_get(__ii, __end, __str, __err, __val); }
126 #if defined(__SYMBIAN32__WSD__)
127 static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
128 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
129 static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
130 static locale::id id;
132 // NOTE: Symbian doesn't support exporting static data.
133 // Users of this class should use GetFacetLocaleId() to access the data member id
134 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
140 typedef string string_type;
141 typedef ctype<_CharT> _Ctype;
142 typedef numpunct<_CharT> _Numpunct;
144 #if !defined (_STLP_NO_BOOL)
145 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
146 ios_base::iostate& __err, bool& __val) const;
149 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
150 ios_base::iostate& __err, long& __val) const;
151 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
152 ios_base::iostate& __err, unsigned short& __val) const;
153 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
154 ios_base::iostate& __err, unsigned int& __val) const;
155 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
156 ios_base::iostate& __err, unsigned long& __val) const;
158 #if defined (_STLP_FIX_LIBRARY_ISSUES)
159 // issue 118 : those are actually not supposed to be here
160 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
161 ios_base::iostate& __err, short& __val) const;
162 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
163 ios_base::iostate& __err, int& __val) const;
166 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
167 ios_base::iostate& __err, float& __val) const;
168 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
169 ios_base::iostate& __err, double& __val) const;
170 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
171 ios_base::iostate& __err, void*& __p) const;
173 #if !defined (_STLP_NO_LONG_DOUBLE)
174 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
175 ios_base::iostate& __err, long double& __val) const;
178 #if defined (_STLP_LONG_LONG)
179 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
180 ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
181 virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
182 ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
188 #if defined (_STLP_USE_TEMPLATE_EXPORT)
189 _STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
190 // _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
191 # if !defined (_STLP_NO_WCHAR_T)
192 _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
193 // _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
197 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
199 _STLP_MOVE_TO_PRIV_NAMESPACE
201 _STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
203 template <class _InputIter, class _Integer, class _CharT>
205 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
207 # if !defined (_STLP_NO_WCHAR_T)
208 bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
209 bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
212 inline void _STLP_CALL
213 _Initialize_get_float(const ctype<char>&,
214 char& Plus, char& Minus,
215 char& pow_e, char& pow_E,
223 # if !defined (_STLP_NO_WCHAR_T)
224 void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
225 wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
227 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
228 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
229 # if !defined (_STLP_NO_LONG_DOUBLE)
230 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
233 _STLP_MOVE_TO_STD_NAMESPACE
235 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
239 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
240 # include <stl/_num_get.c>
243 #endif /* _STLP_INTERNAL_NUM_GET_H */