epoc32/include/stdapis/stlport/stl/_num_get.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
 * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
williamr@4
     3
 * Copyright (c) 1999
williamr@4
     4
 * Silicon Graphics Computer Systems, Inc.
williamr@4
     5
 *
williamr@4
     6
 * Copyright (c) 1999 
williamr@4
     7
 * Boris Fomitchev
williamr@4
     8
 *
williamr@4
     9
 * This material is provided "as is", with absolutely no warranty expressed
williamr@4
    10
 * or implied. Any use is at your own risk.
williamr@4
    11
 *
williamr@4
    12
 * Permission to use or copy this software for any purpose is hereby granted 
williamr@4
    13
 * without fee, provided the above notices are retained on all copies.
williamr@4
    14
 * Permission to modify the code and to distribute modified code is granted,
williamr@4
    15
 * provided the above notices are retained, and a notice that the code was
williamr@4
    16
 * modified is included with the above copyright notice.
williamr@4
    17
 *
williamr@4
    18
 */ 
williamr@4
    19
// WARNING: This is an internal header file, included by other C++
williamr@4
    20
// standard library headers.  You should not attempt to use this header
williamr@4
    21
// file directly.
williamr@4
    22
williamr@4
    23
williamr@4
    24
#ifndef _STLP_INTERNAL_NUM_GET_H
williamr@4
    25
#define _STLP_INTERNAL_NUM_GET_H
williamr@4
    26
williamr@4
    27
#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
williamr@4
    28
# include <stl/_istreambuf_iterator.h>
williamr@4
    29
#endif
williamr@4
    30
williamr@4
    31
# ifndef _STLP_C_LOCALE_H
williamr@4
    32
#  include <stl/c_locale.h>
williamr@4
    33
# endif
williamr@4
    34
williamr@4
    35
#ifndef _STLP_INTERNAL_NUMPUNCT_H
williamr@4
    36
# include <stl/_numpunct.h>
williamr@4
    37
#endif
williamr@4
    38
#ifndef _STLP_INTERNAL_CTYPE_H
williamr@4
    39
# include <stl/_ctype.h>
williamr@4
    40
#endif
williamr@4
    41
williamr@4
    42
_STLP_BEGIN_NAMESPACE
williamr@4
    43
williamr@4
    44
//----------------------------------------------------------------------
williamr@4
    45
// num_get facets
williamr@4
    46
williamr@4
    47
# ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
williamr@4
    48
template <class _CharT, class _InputIter>  
williamr@4
    49
# else
williamr@4
    50
template <class _CharT, class _InputIter = istreambuf_iterator<_CharT> >  
williamr@4
    51
# endif
williamr@4
    52
#ifdef __SYMBIAN32__
williamr@4
    53
class num_get : public locale::facet
williamr@4
    54
#else
williamr@4
    55
class num_get: public locale::facet
williamr@4
    56
#endif
williamr@4
    57
{
williamr@4
    58
  friend class _Locale;
williamr@4
    59
public:
williamr@4
    60
  typedef _CharT     char_type;
williamr@4
    61
  typedef _InputIter iter_type;
williamr@4
    62
williamr@4
    63
  explicit   num_get(size_t __refs = 0): locale::facet(__refs) {}
williamr@4
    64
    
williamr@4
    65
# ifndef _STLP_NO_BOOL
williamr@4
    66
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
    67
                ios_base::iostate& __err, bool& __val) const {
williamr@4
    68
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
    69
  }
williamr@4
    70
# endif
williamr@4
    71
williamr@4
    72
//# ifdef _STLP_FIX_LIBRARY_ISSUES
williamr@4
    73
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
    74
                ios_base::iostate& __err, short& __val) const {
williamr@4
    75
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
    76
  }
williamr@4
    77
williamr@4
    78
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
    79
                ios_base::iostate& __err, int& __val) const {
williamr@4
    80
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
    81
  }
williamr@4
    82
//# endif
williamr@4
    83
williamr@4
    84
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
    85
                ios_base::iostate& __err, long& __val) const {
williamr@4
    86
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
    87
  }
williamr@4
    88
williamr@4
    89
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
    90
                ios_base::iostate& __err, unsigned short& __val) const {
williamr@4
    91
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
    92
  }
williamr@4
    93
williamr@4
    94
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
    95
                ios_base::iostate& __err, unsigned int& __val) const {
williamr@4
    96
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
    97
  }
williamr@4
    98
williamr@4
    99
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   100
                ios_base::iostate& __err, unsigned long& __val) const {
williamr@4
   101
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   102
  }
williamr@4
   103
williamr@4
   104
#ifdef _STLP_LONG_LONG
williamr@4
   105
williamr@4
   106
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   107
                ios_base::iostate& __err, _STLP_LONG_LONG& __val) const {
williamr@4
   108
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   109
  }
williamr@4
   110
williamr@4
   111
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   112
                ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const {
williamr@4
   113
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   114
  }
williamr@4
   115
williamr@4
   116
#endif /* _STLP_LONG_LONG */
williamr@4
   117
williamr@4
   118
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   119
                 ios_base::iostate& __err, float& __val) const {
williamr@4
   120
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   121
  }
williamr@4
   122
williamr@4
   123
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   124
                ios_base::iostate& __err, double& __val) const {
williamr@4
   125
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   126
  }
williamr@4
   127
williamr@4
   128
# ifndef _STLP_NO_LONG_DOUBLE
williamr@4
   129
williamr@4
   130
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   131
                ios_base::iostate& __err, long double& __val) const {
williamr@4
   132
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   133
  }
williamr@4
   134
# endif
williamr@4
   135
williamr@4
   136
  _InputIter get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   137
                ios_base::iostate& __err, void*& __val) const {
williamr@4
   138
    return do_get(__stl_in, __end, __str, __err, __val);
williamr@4
   139
  }
williamr@4
   140
williamr@4
   141
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
williamr@4
   142
    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
williamr@4
   143
    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator<wchar_t, char_traits<wchar_t> >* );
williamr@4
   144
    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const wchar_t**);
williamr@4
   145
    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator<char, char_traits<char> >* );
williamr@4
   146
    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const char**);
williamr@4
   147
    
williamr@4
   148
#else
williamr@4
   149
    _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
williamr@4
   150
#endif
williamr@4
   151
williamr@4
   152
protected:
williamr@4
   153
  ~num_get() {}
williamr@4
   154
williamr@4
   155
  typedef string               string_type; 
williamr@4
   156
  typedef ctype<_CharT>        _Ctype;
williamr@4
   157
  typedef numpunct<_CharT>     _Numpunct;
williamr@4
   158
williamr@4
   159
# ifndef _STLP_NO_BOOL
williamr@4
   160
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end,
williamr@4
   161
                           ios_base& __str, ios_base::iostate& __err, bool& __val) const;
williamr@4
   162
# endif
williamr@4
   163
williamr@4
   164
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   165
                           ios_base::iostate& __err, long& __val) const;
williamr@4
   166
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   167
                           ios_base::iostate& __err, unsigned short& __val) const;
williamr@4
   168
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   169
                           ios_base::iostate& __err, unsigned int& __val) const;
williamr@4
   170
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   171
                           ios_base::iostate& __err, unsigned long& __val) const;
williamr@4
   172
//# ifdef _STLP_FIX_LIBRARY_ISSUES
williamr@4
   173
  // issue 118 : those are actually not supposed to be here
williamr@4
   174
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   175
                           ios_base::iostate& __err, short& __val) const;
williamr@4
   176
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   177
                           ios_base::iostate& __err, int& __val) const;
williamr@4
   178
//# endif
williamr@4
   179
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   180
                          ios_base::iostate& __err, float& __val) const;
williamr@4
   181
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   182
                           ios_base::iostate& __err, double& __val) const;
williamr@4
   183
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   184
                           ios_base::iostate& __err,
williamr@4
   185
                           void*& __p) const;
williamr@4
   186
williamr@4
   187
#ifndef _STLP_NO_LONG_DOUBLE
williamr@4
   188
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   189
                           ios_base::iostate& __err, long double& __val) const;
williamr@4
   190
#endif /* _STLP_NO_LONG_DOUBLE */
williamr@4
   191
williamr@4
   192
#ifdef _STLP_LONG_LONG
williamr@4
   193
williamr@4
   194
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   195
                            ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
williamr@4
   196
  virtual _InputIter do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
williamr@4
   197
                           ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
williamr@4
   198
#endif /* _STLP_LONG_LONG */
williamr@4
   199
williamr@4
   200
};
williamr@4
   201
williamr@4
   202
williamr@4
   203
# ifdef _STLP_USE_TEMPLATE_EXPORT
williamr@4
   204
_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
williamr@4
   205
// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
williamr@4
   206
#  ifndef _STLP_NO_WCHAR_T
williamr@4
   207
_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
williamr@4
   208
// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
williamr@4
   209
#  endif /* _STLP_NO_WCHAR_T */
williamr@4
   210
# endif
williamr@4
   211
williamr@4
   212
# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
williamr@4
   213
williamr@4
   214
_STLP_DECLSPEC extern bool  _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
williamr@4
   215
williamr@4
   216
template <class _InputIter, class _Integer>
williamr@4
   217
bool _STLP_CALL
williamr@4
   218
__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val);
williamr@4
   219
williamr@4
   220
inline bool _STLP_CALL __get_fdigit(char& __c, const char*);
williamr@4
   221
inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *);
williamr@4
   222
# ifndef _STLP_NO_WCHAR_T
williamr@4
   223
inline bool _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
williamr@4
   224
inline bool _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
williamr@4
   225
# endif
williamr@4
   226
williamr@4
   227
inline void  _STLP_CALL
williamr@4
   228
_Initialize_get_float(const ctype<char>&,
williamr@4
   229
                       char& Plus, char& Minus,
williamr@4
   230
                       char& pow_e, char& pow_E,
williamr@4
   231
                       char*)
williamr@4
   232
{
williamr@4
   233
  Plus = '+';
williamr@4
   234
  Minus = '-';
williamr@4
   235
  pow_e = 'e';
williamr@4
   236
  pow_E = 'E';
williamr@4
   237
}
williamr@4
   238
// Helper functions for _M_do_get_float.
williamr@4
   239
williamr@4
   240
# ifndef _STLP_NO_WCHAR_T
williamr@4
   241
williamr@4
   242
inline void  _STLP_CALL
williamr@4
   243
_Initialize_get_float( const ctype<wchar_t>& ct,
williamr@4
   244
                       wchar_t& Plus, wchar_t& Minus,
williamr@4
   245
                       wchar_t& pow_e, wchar_t& pow_E,
williamr@4
   246
                       wchar_t* digits)
williamr@4
   247
{
williamr@4
   248
  char ndigits[11] = "0123456789";
williamr@4
   249
  Plus  = ct.widen('+');
williamr@4
   250
  Minus = ct.widen('-');
williamr@4
   251
  pow_e = ct.widen('e');
williamr@4
   252
  pow_E = ct.widen('E');
williamr@4
   253
  ct.widen(ndigits + 0, ndigits + 10, digits);
williamr@4
   254
}
williamr@4
   255
williamr@4
   256
# endif /* WCHAR_T */
williamr@4
   257
williamr@4
   258
#ifdef __SYMBIAN32__
williamr@4
   259
template<class _CharT>
williamr@4
   260
inline void  _STLP_CALL
williamr@4
   261
_Initialize_get_float( const ctype<_CharT>& ct,
williamr@4
   262
                       _CharT& Plus, _CharT& Minus,
williamr@4
   263
                       _CharT& pow_e, _CharT& pow_E,
williamr@4
   264
                       _CharT* digits)
williamr@4
   265
{
williamr@4
   266
  char ndigits[11] = "0123456789";
williamr@4
   267
  Plus  = ct.widen('+');
williamr@4
   268
  Minus = ct.widen('-');
williamr@4
   269
  pow_e = ct.widen('e');
williamr@4
   270
  pow_E = ct.widen('E');
williamr@4
   271
  ct.widen(ndigits + 0, ndigits + 10, digits);
williamr@4
   272
}
williamr@4
   273
#endif
williamr@4
   274
williamr@4
   275
int  _STLP_CALL __string_to_float(const string&, float&);
williamr@4
   276
int  _STLP_CALL __string_to_float(const string&, double&);
williamr@4
   277
# ifndef _STLP_NO_LONG_DOUBLE
williamr@4
   278
int  _STLP_CALL __string_to_float(const string&, long double&);
williamr@4
   279
# endif
williamr@4
   280
# endif
williamr@4
   281
williamr@4
   282
# if defined (__BORLANDC__) && defined (_RTLDLL)
williamr@4
   283
inline void _Stl_loc_init_num_get() {  
williamr@4
   284
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
williamr@4
   285
  num_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()._M_index = 12;
williamr@4
   286
  num_get<char, const char*>::GetFacetLocaleId()._M_index = 13;
williamr@4
   287
#else
williamr@4
   288
  num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
williamr@4
   289
  num_get<char, const char*>::id._M_index = 13;
williamr@4
   290
#endif
williamr@4
   291
# ifndef _STLP_NO_WCHAR_T
williamr@4
   292
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
williamr@4
   293
  num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()._M_index = 31;
williamr@4
   294
  num_get<wchar_t, const wchar_t*>::GetFacetLocaleId()._M_index = 32;
williamr@4
   295
#else
williamr@4
   296
  num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 31;
williamr@4
   297
  num_get<wchar_t, const wchar_t*>::id._M_index = 32;
williamr@4
   298
#endif
williamr@4
   299
# endif
williamr@4
   300
} 
williamr@4
   301
# endif
williamr@4
   302
williamr@4
   303
_STLP_DECLSPEC unsigned char* _STLP_CALL __get_digit_val_table(void);
williamr@4
   304
_STLP_DECLSPEC char* _STLP_CALL __get_narrow_atoms(void);
williamr@4
   305
_STLP_END_NAMESPACE
williamr@4
   306
williamr@4
   307
#  if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
williamr@4
   308
#   include <stl/_num_get.c>
williamr@4
   309
#  endif
williamr@4
   310
williamr@4
   311
#endif /* _STLP_INTERNAL_NUM_GET_H */
williamr@4
   312
williamr@4
   313
// Local Variables:
williamr@4
   314
// mode:C++
williamr@4
   315
// End:
williamr@4
   316