• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef _STLP_FACETS_FWD_H
47 #  include <stl/_facets_fwd.h>
48 #endif
49 
50 _STLP_BEGIN_NAMESPACE
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 
facet(__refs)61   explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
62 
63 #if !defined (_STLP_NO_BOOL)
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,bool & __val)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)
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,short & __val)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 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,int & __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); }
77 #endif
78 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,long & __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); }
82 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned short & __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); }
86 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned int & __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); }
90 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned long & __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); }
94 
95 #if defined (_STLP_LONG_LONG)
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,_STLP_LONG_LONG & __val)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); }
99 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned _STLP_LONG_LONG & __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 */
104 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,float & __val)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 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,double & __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); }
112 
113 #if !defined (_STLP_NO_LONG_DOUBLE)
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,long double & __val)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 
get(_InputIter __ii,_InputIter __end,ios_base & __str,ios_base::iostate & __err,void * & __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); }
122 
123   static locale::id id;
124 
125 protected:
~num_get()126   ~num_get() {}
127 
128   typedef string               string_type;
129   typedef ctype<_CharT>        _Ctype;
130   typedef numpunct<_CharT>     _Numpunct;
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)
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*>;
182 #  endif
183 #endif
184 
185 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
186 
187 _STLP_MOVE_TO_PRIV_NAMESPACE
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
_Initialize_get_float(const ctype<char> &,char & Plus,char & Minus,char & pow_e,char & pow_E,char *)201 _Initialize_get_float(const ctype<char>&,
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)
212 void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
213                                                      wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
214 #  endif
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&);
219 #  endif
220 
221 _STLP_MOVE_TO_STD_NAMESPACE
222 
223 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
224 
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 
238