]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/stl/stl/_num_get.h
Add STLport 5.1.4
[polintos/scott/priv.git] / include / c++ / stl / stl / _num_get.h
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
27 #  include <stl/_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 _STLP_BEGIN_NAMESPACE
47
48 //----------------------------------------------------------------------
49 // num_get facets
50
51 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
52 template <class _CharT, class _InputIter>
53 #else
54 template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
55 #endif
56 class num_get: public locale::facet {
57   friend class _Locale_impl;
58 public:
59   typedef _CharT     char_type;
60   typedef _InputIter iter_type;
61
62   explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
63
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); }
68 #endif
69
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); }
74
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); }
78 #endif
79
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); }
83
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); }
87
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); }
91
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); }
95
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); }
100
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 */
105
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); }
109
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); }
113
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); }
118 # endif
119
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); }
123
124   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
125
126 protected:
127   ~num_get() {}
128
129   typedef string               string_type;
130   typedef ctype<_CharT>        _Ctype;
131   typedef numpunct<_CharT>     _Numpunct;
132
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;
136 #endif
137
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;
146
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;
153 #endif
154
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;
161
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;
165 #endif
166
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;
172 #endif
173
174 };
175
176
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*>;
183 #  endif
184 #endif
185
186 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
187
188 _STLP_MOVE_TO_PRIV_NAMESPACE
189
190 _STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
191
192 template <class _InputIter, class _Integer, class _CharT>
193 bool _STLP_CALL
194 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
195
196 #  if !defined (_STLP_NO_WCHAR_T)
197 bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
198 bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
199 #  endif
200
201 inline void  _STLP_CALL
202 _Initialize_get_float(const ctype<char>&,
203                        char& Plus, char& Minus,
204                        char& pow_e, char& pow_E,
205                        char*) {
206   Plus = '+';
207   Minus = '-';
208   pow_e = 'e';
209   pow_E = 'E';
210 }
211
212 #  if !defined (_STLP_NO_WCHAR_T)
213 void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
214                                                      wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
215 #  endif
216 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
217 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
218 #  if !defined (_STLP_NO_LONG_DOUBLE)
219 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
220 #  endif
221
222 _STLP_MOVE_TO_STD_NAMESPACE
223
224 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
225
226 _STLP_END_NAMESPACE
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