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