ReactOS  0.4.14-dev-115-g4576127
_num_get.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999
3  * Silicon Graphics Computer Systems, Inc.
4  *
5  * Copyright (c) 1999
6  * Boris Fomitchev
7  *
8  * This material is provided "as is", with absolutely no warranty expressed
9  * or implied. Any use is at your own risk.
10  *
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.
16  *
17  */
18 // WARNING: This is an internal header file, included by other C++
19 // standard library headers. You should not attempt to use this header
20 // file directly.
21 
22 
23 #ifndef _STLP_INTERNAL_NUM_GET_H
24 #define _STLP_INTERNAL_NUM_GET_H
25 
26 #ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
28 #endif
29 
30 #ifndef _STLP_C_LOCALE_H
31 # include <stl/c_locale.h>
32 #endif
33 
34 #ifndef _STLP_INTERNAL_NUMPUNCT_H
35 # include <stl/_numpunct.h>
36 #endif
37 
38 #ifndef _STLP_INTERNAL_CTYPE_H
39 # include <stl/_ctype.h>
40 #endif
41 
42 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
43 # include <stl/_iostream_string.h>
44 #endif
45 
46 #ifndef _STLP_FACETS_FWD_H
47 # include <stl/_facets_fwd.h>
48 #endif
49 
51 
52 //----------------------------------------------------------------------
53 // num_get facets
54 
55 template <class _CharT, class _InputIter>
56 class num_get: public locale::facet {
57 public:
58  typedef _CharT char_type;
59  typedef _InputIter iter_type;
60 
61  explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
62 
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); }
67 #endif
68 
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); }
73 
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); }
77 #endif
78 
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); }
82 
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); }
86 
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); }
90 
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); }
94 
95 #if defined (_STLP_LONG_LONG)
96  _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
98  { return do_get(__ii, __end, __str, __err, __val); }
99 
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 */
104 
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); }
108 
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); }
112 
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); }
117 # endif
118 
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); }
122 
123  static locale::id id;
124 
125 protected:
126  ~num_get() {}
127 
128  typedef string string_type;
131 
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;
135 #endif
136 
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;
145 
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;
152 #endif
153 
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;
160 
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;
164 #endif
165 
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;
171 #endif
172 
173 };
174 
175 
176 #if defined (_STLP_USE_TEMPLATE_EXPORT)
178 // _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
179 # if !defined (_STLP_NO_WCHAR_T)
181 // _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
182 # endif
183 #endif
184 
185 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
186 
188 
189 _STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
190 
191 template <class _InputIter, class _Integer, class _CharT>
192 bool _STLP_CALL
193 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
194 
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*);
198 # endif
199 
200 inline void _STLP_CALL
202  char& Plus, char& Minus,
203  char& pow_e, char& pow_E,
204  char*) {
205  Plus = '+';
206  Minus = '-';
207  pow_e = 'e';
208  pow_E = 'E';
209 }
210 
211 # if !defined (_STLP_NO_WCHAR_T)
213  wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
214 # endif
217 # if !defined (_STLP_NO_LONG_DOUBLE)
218 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
219 # endif
220 
222 
223 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
224 
225 
227 
228 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
229 # include <stl/_num_get.c>
230 #endif
231 
232 #endif /* _STLP_INTERNAL_NUM_GET_H */
233 
234 // Local Variables:
235 // mode:C++
236 // End:
237 
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE void _STLP_CALL _Initialize_get_float(const ctype< wchar_t > &ct, wchar_t &Plus, wchar_t &Minus, wchar_t &pow_e, wchar_t &pow_E, wchar_t *digits)
bool _STLP_CALL __get_fdigit_or_sep(char &__c, char __sep, const char *__digits)
Definition: _num_get.c:41
ctype< _CharT > _Ctype
Definition: _num_get.h:129
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, long &__val) const
Definition: _num_get.h:79
~num_get()
Definition: _num_get.h:126
_CharT char_type
Definition: _num_get.h:58
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, float &__val) const
Definition: _num_get.h:105
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
Definition: _locale.h:75
string string_type
Definition: _num_get.h:128
#define _STLP_LONG_LONG
Definition: _apcc.h:12
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
Definition: _ctype.h:58
numpunct< _CharT > _Numpunct
Definition: _num_get.h:130
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, double &__val) const
Definition: _num_get.h:109
num_get(size_t __refs=0)
Definition: _num_get.h:61
_InputIter iter_type
Definition: _num_get.h:59
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, unsigned short &__val) const
Definition: _num_get.h:83
bool _STLP_CALL __get_decimal_integer(_InputIter &__first, _InputIter &__last, _Integer &__val, _CharT *)
Definition: _num_get.c:239
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
#define _STLP_EXPORT_TEMPLATE_CLASS
Definition: features.h:987
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, bool &__val) const
Definition: _num_get.c:499
int iostate
Definition: _ios_base.h:58
facet(size_t __init_count=0)
Definition: _locale.h:84
#define _STLP_DECLSPEC
Definition: features.h:982
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, unsigned int &__val) const
Definition: _num_get.h:87
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE bool _STLP_CALL __valid_grouping(const char *first1, const char *last1, const char *first2, const char *last2)
Definition: num_get.cpp:38
bool _STLP_CALL __get_fdigit(char __c, const char *)
Definition: _num_get.c:38
#define _STLP_END_NAMESPACE
Definition: features.h:503
void _STLP_CALL __string_to_float(const __iostring &v, float &val)
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, long double &__val) const
Definition: _num_get.h:114
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, void *&__val) const
Definition: _num_get.h:119
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
static locale::id id
Definition: _num_get.h:123
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, unsigned long &__val) const
Definition: _num_get.h:91
_InputIter get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, bool &__val) const
Definition: _num_get.h:64
#define _STLP_CALL
Definition: _bc.h:131