epoc32/include/stdapis/stlport/stl/_num_get.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_num_get.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/_num_get.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,316 @@
     1.4 -_num_get.h
     1.5 +/*
     1.6 + * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.7 + * Copyright (c) 1999
     1.8 + * Silicon Graphics Computer Systems, Inc.
     1.9 + *
    1.10 + * Copyright (c) 1999 
    1.11 + * Boris Fomitchev
    1.12 + *
    1.13 + * This material is provided "as is", with absolutely no warranty expressed
    1.14 + * or implied. Any use is at your own risk.
    1.15 + *
    1.16 + * Permission to use or copy this software for any purpose is hereby granted 
    1.17 + * without fee, provided the above notices are retained on all copies.
    1.18 + * Permission to modify the code and to distribute modified code is granted,
    1.19 + * provided the above notices are retained, and a notice that the code was
    1.20 + * modified is included with the above copyright notice.
    1.21 + *
    1.22 + */ 
    1.23 +// WARNING: This is an internal header file, included by other C++
    1.24 +// standard library headers.  You should not attempt to use this header
    1.25 +// file directly.
    1.26 +
    1.27 +
    1.28 +#ifndef _STLP_INTERNAL_NUM_GET_H
    1.29 +#define _STLP_INTERNAL_NUM_GET_H
    1.30 +
    1.31 +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
    1.32 +# include <stl/_istreambuf_iterator.h>
    1.33 +#endif
    1.34 +
    1.35 +# ifndef _STLP_C_LOCALE_H
    1.36 +#  include <stl/c_locale.h>
    1.37 +# endif
    1.38 +
    1.39 +#ifndef _STLP_INTERNAL_NUMPUNCT_H
    1.40 +# include <stl/_numpunct.h>
    1.41 +#endif
    1.42 +#ifndef _STLP_INTERNAL_CTYPE_H
    1.43 +# include <stl/_ctype.h>
    1.44 +#endif
    1.45 +
    1.46 +_STLP_BEGIN_NAMESPACE
    1.47 +
    1.48 +//----------------------------------------------------------------------
    1.49 +// num_get facets
    1.50 +
    1.51 +# ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
    1.52 +template <class _CharT, class _InputIter>  
    1.53 +# else
    1.54 +template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >  
    1.55 +# endif
    1.56 +#ifdef __SYMBIAN32__
    1.57 +class num_get : public locale::facet
    1.58 +#else
    1.59 +class num_get: public locale::facet
    1.60 +#endif
    1.61 +{
    1.62 +  friend class _Locale;
    1.63 +public:
    1.64 +  typedef _CharT     char_type;
    1.65 +  typedef _InputIter iter_type;
    1.66 +
    1.67 +  explicit   num_get(size_t __refs = 0): locale::facet(__refs) {}
    1.68 +    
    1.69 +# ifndef _STLP_NO_BOOL
    1.70 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
    1.71 +                ios_base::iostate& __err, bool& __val) const {
    1.72 +    return do_get(__stl_in, __end, __str, __err, __val);
    1.73 +  }
    1.74 +# endif
    1.75 +
    1.76 +//# ifdef _STLP_FIX_LIBRARY_ISSUES
    1.77 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
    1.78 +                ios_base::iostate& __err, short& __val) const {
    1.79 +    return do_get(__stl_in, __end, __str, __err, __val);
    1.80 +  }
    1.81 +
    1.82 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
    1.83 +                ios_base::iostate& __err, int& __val) const {
    1.84 +    return do_get(__stl_in, __end, __str, __err, __val);
    1.85 +  }
    1.86 +//# endif
    1.87 +
    1.88 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
    1.89 +                ios_base::iostate& __err, long& __val) const {
    1.90 +    return do_get(__stl_in, __end, __str, __err, __val);
    1.91 +  }
    1.92 +
    1.93 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
    1.94 +                ios_base::iostate& __err, unsigned short& __val) const {
    1.95 +    return do_get(__stl_in, __end, __str, __err, __val);
    1.96 +  }
    1.97 +
    1.98 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
    1.99 +                ios_base::iostate& __err, unsigned int& __val) const {
   1.100 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.101 +  }
   1.102 +
   1.103 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.104 +                ios_base::iostate& __err, unsigned long& __val) const {
   1.105 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.106 +  }
   1.107 +
   1.108 +#ifdef _STLP_LONG_LONG
   1.109 +
   1.110 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.111 +                ios_base::iostate& __err, _STLP_LONG_LONG& __val) const {
   1.112 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.113 +  }
   1.114 +
   1.115 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.116 +                ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const {
   1.117 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.118 +  }
   1.119 +
   1.120 +#endif /* _STLP_LONG_LONG */
   1.121 +
   1.122 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.123 +                 ios_base::iostate& __err, float& __val) const {
   1.124 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.125 +  }
   1.126 +
   1.127 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.128 +                ios_base::iostate& __err, double& __val) const {
   1.129 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.130 +  }
   1.131 +
   1.132 +# ifndef _STLP_NO_LONG_DOUBLE
   1.133 +
   1.134 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.135 +                ios_base::iostate& __err, long double& __val) const {
   1.136 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.137 +  }
   1.138 +# endif
   1.139 +
   1.140 +  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.141 +                ios_base::iostate& __err, void*& __val) const {
   1.142 +    return do_get(__stl_in, __end, __str, __err, __val);
   1.143 +  }
   1.144 +
   1.145 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.146 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.147 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator<wchar_t, char_traits<wchar_t> >* );
   1.148 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const wchar_t**);
   1.149 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator<char, char_traits<char> >* );
   1.150 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const char**);
   1.151 +    
   1.152 +#else
   1.153 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.154 +#endif
   1.155 +
   1.156 +protected:
   1.157 +  ~num_get() {}
   1.158 +
   1.159 +  typedef string               string_type; 
   1.160 +  typedef ctype<_CharT>        _Ctype;
   1.161 +  typedef numpunct<_CharT>     _Numpunct;
   1.162 +
   1.163 +# ifndef _STLP_NO_BOOL
   1.164 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end,
   1.165 +                           ios_base& __str, ios_base::iostate& __err, bool& __val) const;
   1.166 +# endif
   1.167 +
   1.168 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.169 +                           ios_base::iostate& __err, long& __val) const;
   1.170 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.171 +                           ios_base::iostate& __err, unsigned short& __val) const;
   1.172 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.173 +                           ios_base::iostate& __err, unsigned int& __val) const;
   1.174 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.175 +                           ios_base::iostate& __err, unsigned long& __val) const;
   1.176 +//# ifdef _STLP_FIX_LIBRARY_ISSUES
   1.177 +  // issue 118 : those are actually not supposed to be here
   1.178 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.179 +                           ios_base::iostate& __err, short& __val) const;
   1.180 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.181 +                           ios_base::iostate& __err, int& __val) const;
   1.182 +//# endif
   1.183 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.184 +                          ios_base::iostate& __err, float& __val) const;
   1.185 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.186 +                           ios_base::iostate& __err, double& __val) const;
   1.187 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.188 +                           ios_base::iostate& __err,
   1.189 +                           void*& __p) const;
   1.190 +
   1.191 +#ifndef _STLP_NO_LONG_DOUBLE
   1.192 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.193 +                           ios_base::iostate& __err, long double& __val) const;
   1.194 +#endif /* _STLP_NO_LONG_DOUBLE */
   1.195 +
   1.196 +#ifdef _STLP_LONG_LONG
   1.197 +
   1.198 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.199 +                            ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
   1.200 +  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   1.201 +                           ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
   1.202 +#endif /* _STLP_LONG_LONG */
   1.203 +
   1.204 +};
   1.205 +
   1.206 +
   1.207 +# ifdef _STLP_USE_TEMPLATE_EXPORT
   1.208 +_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
   1.209 +// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
   1.210 +#  ifndef _STLP_NO_WCHAR_T
   1.211 +_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
   1.212 +// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
   1.213 +#  endif /* _STLP_NO_WCHAR_T */
   1.214 +# endif
   1.215 +
   1.216 +# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
   1.217 +
   1.218 +_STLP_DECLSPEC extern bool  _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
   1.219 +
   1.220 +template <class _InputIter, class _Integer>
   1.221 +bool _STLP_CALL
   1.222 +__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val);
   1.223 +
   1.224 +inline bool _STLP_CALL __get_fdigit(char& __c, const char*);
   1.225 +inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *);
   1.226 +# ifndef _STLP_NO_WCHAR_T
   1.227 +inline bool _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
   1.228 +inline bool _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
   1.229 +# endif
   1.230 +
   1.231 +inline void  _STLP_CALL
   1.232 +_Initialize_get_float(const ctype<char>&,
   1.233 +                       char& Plus, char& Minus,
   1.234 +                       char& pow_e, char& pow_E,
   1.235 +                       char*)
   1.236 +{
   1.237 +  Plus = '+';
   1.238 +  Minus = '-';
   1.239 +  pow_e = 'e';
   1.240 +  pow_E = 'E';
   1.241 +}
   1.242 +// Helper functions for _M_do_get_float.
   1.243 +
   1.244 +# ifndef _STLP_NO_WCHAR_T
   1.245 +
   1.246 +inline void  _STLP_CALL
   1.247 +_Initialize_get_float( const ctype<wchar_t>& ct,
   1.248 +                       wchar_t& Plus, wchar_t& Minus,
   1.249 +                       wchar_t& pow_e, wchar_t& pow_E,
   1.250 +                       wchar_t* digits)
   1.251 +{
   1.252 +  char ndigits[11] = "0123456789";
   1.253 +  Plus  = ct.widen('+');
   1.254 +  Minus = ct.widen('-');
   1.255 +  pow_e = ct.widen('e');
   1.256 +  pow_E = ct.widen('E');
   1.257 +  ct.widen(ndigits + 0, ndigits + 10, digits);
   1.258 +}
   1.259 +
   1.260 +# endif /* WCHAR_T */
   1.261 +
   1.262 +#ifdef __SYMBIAN32__
   1.263 +template<class _CharT>
   1.264 +inline void  _STLP_CALL
   1.265 +_Initialize_get_float( const ctype<_CharT>& ct,
   1.266 +                       _CharT& Plus, _CharT& Minus,
   1.267 +                       _CharT& pow_e, _CharT& pow_E,
   1.268 +                       _CharT* digits)
   1.269 +{
   1.270 +  char ndigits[11] = "0123456789";
   1.271 +  Plus  = ct.widen('+');
   1.272 +  Minus = ct.widen('-');
   1.273 +  pow_e = ct.widen('e');
   1.274 +  pow_E = ct.widen('E');
   1.275 +  ct.widen(ndigits + 0, ndigits + 10, digits);
   1.276 +}
   1.277 +#endif
   1.278 +
   1.279 +int  _STLP_CALL __string_to_float(const string&, float&);
   1.280 +int  _STLP_CALL __string_to_float(const string&, double&);
   1.281 +# ifndef _STLP_NO_LONG_DOUBLE
   1.282 +int  _STLP_CALL __string_to_float(const string&, long double&);
   1.283 +# endif
   1.284 +# endif
   1.285 +
   1.286 +# if defined (__BORLANDC__) && defined (_RTLDLL)
   1.287 +inline void _Stl_loc_init_num_get() {  
   1.288 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.289 +  num_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()._M_index = 12;
   1.290 +  num_get<char, const char*>::GetFacetLocaleId()._M_index = 13;
   1.291 +#else
   1.292 +  num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
   1.293 +  num_get<char, const char*>::id._M_index = 13;
   1.294 +#endif
   1.295 +# ifndef _STLP_NO_WCHAR_T
   1.296 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.297 +  num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()._M_index = 31;
   1.298 +  num_get<wchar_t, const wchar_t*>::GetFacetLocaleId()._M_index = 32;
   1.299 +#else
   1.300 +  num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 31;
   1.301 +  num_get<wchar_t, const wchar_t*>::id._M_index = 32;
   1.302 +#endif
   1.303 +# endif
   1.304 +} 
   1.305 +# endif
   1.306 +
   1.307 +_STLP_DECLSPEC unsigned char* _STLP_CALL __get_digit_val_table(void);
   1.308 +_STLP_DECLSPEC char* _STLP_CALL __get_narrow_atoms(void);
   1.309 +_STLP_END_NAMESPACE
   1.310 +
   1.311 +#  if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
   1.312 +#   include <stl/_num_get.c>
   1.313 +#  endif
   1.314 +
   1.315 +#endif /* _STLP_INTERNAL_NUM_GET_H */
   1.316 +
   1.317 +// Local Variables:
   1.318 +// mode:C++
   1.319 +// End:
   1.320 +