_num_get.h

00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999 
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted 
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */ 
00018 // WARNING: This is an internal header file, included by other C++
00019 // standard library headers.  You should not attempt to use this header
00020 // file directly.
00021 
00022 
00023 #ifndef _STLP_INTERNAL_NUM_GET_H
00024 #define _STLP_INTERNAL_NUM_GET_H
00025 
00026 #ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
00027 # include <stl/_istreambuf_iterator.h>
00028 #endif
00029 
00030 # ifndef _STLP_C_LOCALE_H
00031 #  include <stl/c_locale.h>
00032 # endif
00033 
00034 #ifndef _STLP_INTERNAL_NUMPUNCT_H
00035 # include <stl/_numpunct.h>
00036 #endif
00037 #ifndef _STLP_INTERNAL_CTYPE_H
00038 # include <stl/_ctype.h>
00039 #endif
00040 
00041 _STLP_BEGIN_NAMESPACE
00042 
00043 //----------------------------------------------------------------------
00044 // num_get facets
00045 
00046 # ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
00047 template <class _CharT, class _InputIter>  
00048 # else
00049 template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >  
00050 # endif
00051 class num_get: public locale::facet
00052 {
00053   friend class _Locale;
00054 public:
00055   typedef _CharT     char_type;
00056   typedef _InputIter iter_type;
00057 
00058   explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
00059     
00060 # ifndef _STLP_NO_BOOL
00061   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00062                 ios_base::iostate& __err, bool& __val) const {
00063     return do_get(__in, __end, __str, __err, __val);
00064   }
00065 # endif
00066 
00067 # ifdef _STLP_FIX_LIBRARY_ISSUES
00068   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00069                 ios_base::iostate& __err, short& __val) const {
00070     return do_get(__in, __end, __str, __err, __val);
00071   }
00072 
00073   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00074                 ios_base::iostate& __err, int& __val) const {
00075     return do_get(__in, __end, __str, __err, __val);
00076   }
00077 # endif
00078 
00079   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00080                 ios_base::iostate& __err, long& __val) const {
00081     return do_get(__in, __end, __str, __err, __val);
00082   }
00083 
00084   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00085                 ios_base::iostate& __err, unsigned short& __val) const {
00086     return do_get(__in, __end, __str, __err, __val);
00087   }
00088 
00089   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00090                 ios_base::iostate& __err, unsigned int& __val) const {
00091     return do_get(__in, __end, __str, __err, __val);
00092   }
00093 
00094   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00095                 ios_base::iostate& __err, unsigned long& __val) const {
00096     return do_get(__in, __end, __str, __err, __val);
00097   }
00098 
00099 #ifdef _STLP_LONG_LONG
00100 
00101   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00102                 ios_base::iostate& __err, _STLP_LONG_LONG& __val) const {
00103     return do_get(__in, __end, __str, __err, __val);
00104   }
00105 
00106   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00107                 ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const {
00108     return do_get(__in, __end, __str, __err, __val);
00109   }
00110 
00111 #endif /* _STLP_LONG_LONG */
00112 
00113   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00114                  ios_base::iostate& __err, float& __val) const {
00115     return do_get(__in, __end, __str, __err, __val);
00116   }
00117 
00118   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00119                 ios_base::iostate& __err, double& __val) const {
00120     return do_get(__in, __end, __str, __err, __val);
00121   }
00122 
00123 # ifndef _STLP_NO_LONG_DOUBLE
00124 
00125   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00126                 ios_base::iostate& __err, long double& __val) const {
00127     return do_get(__in, __end, __str, __err, __val);
00128   }
00129 # endif
00130 
00131   _InputIter get(_InputIter __in, _InputIter __end, ios_base& __str,
00132                 ios_base::iostate& __err, void*& __val) const {
00133     return do_get(__in, __end, __str, __err, __val);
00134   }
00135 
00136   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
00137 
00138 protected:
00139   ~num_get() {}
00140 
00141   typedef string               string_type; 
00142   typedef ctype<_CharT>        _Ctype;
00143   typedef numpunct<_CharT>     _Numpunct;
00144 
00145 # ifndef _STLP_NO_BOOL
00146   virtual _InputIter do_get(_InputIter __in, _InputIter __end,
00147                            ios_base& __str, ios_base::iostate& __err, bool& __val) const;
00148 # endif
00149 
00150   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00151                            ios_base::iostate& __err, long& __val) const;
00152   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00153                            ios_base::iostate& __err, unsigned short& __val) const;
00154   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00155                            ios_base::iostate& __err, unsigned int& __val) const;
00156   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00157                            ios_base::iostate& __err, unsigned long& __val) const;
00158 # ifdef _STLP_FIX_LIBRARY_ISSUES
00159   // issue 118 : those are actually not supposed to be here
00160   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00161                            ios_base::iostate& __err, short& __val) const;
00162   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00163                            ios_base::iostate& __err, int& __val) const;
00164 # endif
00165   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00166                           ios_base::iostate& __err, float& __val) const;
00167   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00168                            ios_base::iostate& __err, double& __val) const;
00169   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00170                            ios_base::iostate& __err,
00171                            void*& __p) const;
00172 
00173 #ifndef _STLP_NO_LONG_DOUBLE
00174   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00175                            ios_base::iostate& __err, long double& __val) const;
00176 #endif /* _STLP_LONG_DOUBLE */
00177 
00178 #ifdef _STLP_LONG_LONG
00179 
00180   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00181                             ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
00182   virtual _InputIter do_get(_InputIter __in, _InputIter __end, ios_base& __str,
00183                            ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
00184 #endif /* _STLP_LONG_LONG */
00185 
00186 };
00187 
00188 
00189 # ifdef _STLP_USE_TEMPLATE_EXPORT
00190 _STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
00191 // _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
00192 #  ifndef _STLP_NO_WCHAR_T
00193 _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
00194 // _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
00195 #  endif /* _STLP_NO_WCHAR_T */
00196 # endif
00197 
00198 # if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
00199 
00200 extern bool  _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
00201 
00202 template <class _InputIter, class _Integer>
00203 bool _STLP_CALL
00204 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val);
00205 
00206 inline bool _STLP_CALL __get_fdigit(char& __c, const char*);
00207 inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *);
00208 # ifndef _STLP_NO_WCHAR_T
00209 bool _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
00210 bool _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
00211 # endif
00212 
00213 inline void  _STLP_CALL
00214 _Initialize_get_float(const ctype<char>&,
00215                        char& Plus, char& Minus,
00216                        char& pow_e, char& pow_E,
00217                        char*)
00218 {
00219   Plus = '+';
00220   Minus = '-';
00221   pow_e = 'e';
00222   pow_E = 'E';
00223 }
00224 
00225 # ifndef _STLP_NO_WCHAR_T
00226 void  _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
00227                                         wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
00228 # endif
00229 void  _STLP_CALL __string_to_float(const string&, float&);
00230 void  _STLP_CALL __string_to_float(const string&, double&);
00231 # ifndef _STLP_NO_LONG_DOUBLE
00232 void  _STLP_CALL __string_to_float(const string&, long double&);
00233 # endif
00234 # endif
00235 
00236 # if defined (__BORLANDC__) && defined (_RTLDLL)
00237 inline void _Stl_loc_init_num_get() {  
00238   num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
00239   num_get<char, const char*>::id._M_index = 13;
00240   
00241 # ifndef _STLP_NO_WCHAR_T
00242   num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 31;
00243   num_get<wchar_t, const wchar_t*>::id._M_index = 32;
00244 # endif
00245 } 
00246 # endif
00247 
00248 _STLP_END_NAMESPACE
00249 
00250 #  if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
00251 #   include <stl/_num_get.c>
00252 #  endif
00253 
00254 #endif /* _STLP_INTERNAL_NUM_GET_H */
00255 
00256 // Local Variables:
00257 // mode:C++
00258 // End:
00259 

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6