/home/ntakagi/work/STLport-5.1.5/stlport/stl/_num_get.h

Go to the documentation of this file.
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 
00038 #ifndef _STLP_INTERNAL_CTYPE_H
00039 #  include <stl/_ctype.h>
00040 #endif
00041 
00042 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
00043 #  include <stl/_iostream_string.h>
00044 #endif
00045 
00046 _STLP_BEGIN_NAMESPACE
00047 
00048 //----------------------------------------------------------------------
00049 // num_get facets
00050 
00051 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
00052 template <class _CharT, class _InputIter>
00053 #else
00054 template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
00055 #endif
00056 class num_get: public locale::facet {
00057   friend class _Locale_impl;
00058 public:
00059   typedef _CharT     char_type;
00060   typedef _InputIter iter_type;
00061 
00062   explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
00063 
00064 #if !defined (_STLP_NO_BOOL)
00065   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00066                  ios_base::iostate& __err, bool& __val) const
00067   { return do_get(__ii, __end, __str, __err, __val); }
00068 #endif
00069 
00070 #if defined (_STLP_FIX_LIBRARY_ISSUES)
00071   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00072                  ios_base::iostate& __err, short& __val) const
00073   { return do_get(__ii, __end, __str, __err, __val); }
00074 
00075   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00076                  ios_base::iostate& __err, int& __val) const
00077   { return do_get(__ii, __end, __str, __err, __val); }
00078 #endif
00079 
00080   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00081                  ios_base::iostate& __err, long& __val) const
00082   { return do_get(__ii, __end, __str, __err, __val); }
00083 
00084   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00085                  ios_base::iostate& __err, unsigned short& __val) const
00086   { return do_get(__ii, __end, __str, __err, __val); }
00087 
00088   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00089                  ios_base::iostate& __err, unsigned int& __val) const
00090   { return do_get(__ii, __end, __str, __err, __val); }
00091 
00092   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00093                  ios_base::iostate& __err, unsigned long& __val) const
00094   { return do_get(__ii, __end, __str, __err, __val); }
00095 
00096 #if defined (_STLP_LONG_LONG)
00097   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00098                  ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
00099   { return do_get(__ii, __end, __str, __err, __val); }
00100 
00101   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00102                  ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
00103   { return do_get(__ii, __end, __str, __err, __val); }
00104 #endif /* _STLP_LONG_LONG */
00105 
00106   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00107                  ios_base::iostate& __err, float& __val) const
00108   { return do_get(__ii, __end, __str, __err, __val); }
00109 
00110   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00111                  ios_base::iostate& __err, double& __val) const
00112   { return do_get(__ii, __end, __str, __err, __val); }
00113 
00114 #if !defined (_STLP_NO_LONG_DOUBLE)
00115   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00116                  ios_base::iostate& __err, long double& __val) const
00117   { return do_get(__ii, __end, __str, __err, __val); }
00118 # endif
00119 
00120   _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
00121                  ios_base::iostate& __err, void*& __val) const
00122   { return do_get(__ii, __end, __str, __err, __val); }
00123 
00124   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
00125 
00126 protected:
00127   ~num_get() {}
00128 
00129   typedef string               string_type;
00130   typedef ctype<_CharT>        _Ctype;
00131   typedef numpunct<_CharT>     _Numpunct;
00132 
00133 #if !defined (_STLP_NO_BOOL)
00134   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00135                             ios_base::iostate& __err, bool& __val) const;
00136 #endif
00137 
00138   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00139                             ios_base::iostate& __err, long& __val) const;
00140   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00141                             ios_base::iostate& __err, unsigned short& __val) const;
00142   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00143                             ios_base::iostate& __err, unsigned int& __val) const;
00144   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00145                             ios_base::iostate& __err, unsigned long& __val) const;
00146 
00147 #if defined (_STLP_FIX_LIBRARY_ISSUES)
00148   // issue 118 : those are actually not supposed to be here
00149   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00150                             ios_base::iostate& __err, short& __val) const;
00151   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00152                             ios_base::iostate& __err, int& __val) const;
00153 #endif
00154 
00155   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00156                             ios_base::iostate& __err, float& __val) const;
00157   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00158                             ios_base::iostate& __err, double& __val) const;
00159   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00160                             ios_base::iostate& __err, void*& __p) const;
00161 
00162 #if !defined (_STLP_NO_LONG_DOUBLE)
00163   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00164                             ios_base::iostate& __err, long double& __val) const;
00165 #endif
00166 
00167 #if defined (_STLP_LONG_LONG)
00168   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00169                             ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
00170   virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
00171                             ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
00172 #endif
00173 
00174 };
00175 
00176 
00177 #if defined (_STLP_USE_TEMPLATE_EXPORT)
00178 _STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
00179 // _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
00180 #  if !defined (_STLP_NO_WCHAR_T)
00181 _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
00182 // _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
00183 #  endif
00184 #endif
00185 
00186 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
00187 
00188 _STLP_MOVE_TO_PRIV_NAMESPACE
00189 
00190 _STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
00191 
00192 template <class _InputIter, class _Integer, class _CharT>
00193 bool _STLP_CALL
00194 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
00195 
00196 #  if !defined (_STLP_NO_WCHAR_T)
00197 bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
00198 bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
00199 #  endif
00200 
00201 inline void  _STLP_CALL
00202 _Initialize_get_float(const ctype<char>&,
00203                        char& Plus, char& Minus,
00204                        char& pow_e, char& pow_E,
00205                        char*) {
00206   Plus = '+';
00207   Minus = '-';
00208   pow_e = 'e';
00209   pow_E = 'E';
00210 }
00211 
00212 #  if !defined (_STLP_NO_WCHAR_T)
00213 void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
00214                                                      wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
00215 #  endif
00216 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
00217 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
00218 #  if !defined (_STLP_NO_LONG_DOUBLE)
00219 void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
00220 #  endif
00221 
00222 _STLP_MOVE_TO_STD_NAMESPACE
00223 
00224 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
00225 
00226 _STLP_END_NAMESPACE
00227 
00228 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
00229 #  include <stl/_num_get.c>
00230 #endif
00231 
00232 #endif /* _STLP_INTERNAL_NUM_GET_H */
00233 
00234 // Local Variables:
00235 // mode:C++
00236 // End:
00237 



Generated on Mon Mar 10 15:32:31 2008 by  doxygen 1.5.1