epoc32/include/stdapis/stlport/stl/_num_put.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.
     1 /*
     2  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     3  *
     4  * Copyright (c) 1999
     5  * Silicon Graphics Computer Systems, Inc.
     6  *
     7  * Copyright (c) 1999 
     8  * Boris Fomitchev
     9  *
    10  * This material is provided "as is", with absolutely no warranty expressed
    11  * or implied. Any use is at your own risk.
    12  *
    13  * Permission to use or copy this software for any purpose is hereby granted 
    14  * without fee, provided the above notices are retained on all copies.
    15  * Permission to modify the code and to distribute modified code is granted,
    16  * provided the above notices are retained, and a notice that the code was
    17  * modified is included with the above copyright notice.
    18  *
    19  */ 
    20 // WARNING: This is an internal header file, included by other C++
    21 // standard library headers.  You should not attempt to use this header
    22 // file directly.
    23 
    24 
    25 #ifndef _STLP_INTERNAL_NUM_PUT_H
    26 #define _STLP_INTERNAL_NUM_PUT_H
    27 
    28 #ifndef _STLP_INTERNAL_NUMPUNCT_H
    29 # include <stl/_numpunct.h>
    30 #endif
    31 #ifndef _STLP_INTERNAL_CTYPE_H
    32 # include <stl/_ctype.h>
    33 #endif
    34 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
    35 # include <stl/_ostreambuf_iterator.h>
    36 #endif
    37 
    38 _STLP_BEGIN_NAMESPACE
    39 
    40 //----------------------------------------------------------------------
    41 // num_put facet
    42 
    43 # ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
    44 template <class _CharT, class _OutputIter>  
    45 # else
    46 template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >  
    47 # endif
    48 class num_put: public locale::facet
    49 {
    50   friend class _Locale;
    51 public:
    52   typedef _CharT      char_type;
    53   typedef _OutputIter iter_type;
    54 
    55   explicit  num_put(size_t __refs = 0) : _BaseFacet(__refs) {}
    56 
    57 # ifndef _STLP_NO_BOOL
    58   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    59                 bool __val) const {
    60     return do_put(__s, __f, __fill, __val);
    61   }
    62 # endif
    63   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    64                long __val) const {
    65     return do_put(__s, __f, __fill, __val);
    66   }
    67 
    68   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    69                 unsigned long __val) const {
    70     return do_put(__s, __f, __fill, __val);
    71   }
    72 
    73 #ifdef _STLP_LONG_LONG
    74   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    75                 _STLP_LONG_LONG __val) const {
    76     return do_put(__s, __f, __fill, __val);
    77   }
    78 
    79   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    80                 unsigned _STLP_LONG_LONG __val) const {
    81     return do_put(__s, __f, __fill, __val);
    82   }
    83 #endif
    84 
    85   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    86                 double __val) const {
    87     return do_put(__s, __f, __fill, (double)__val);
    88   }
    89 
    90 #ifndef _STLP_NO_LONG_DOUBLE
    91   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    92                 long double __val) const {
    93     return do_put(__s, __f, __fill, __val);
    94   }
    95 # endif
    96 
    97   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
    98                 const void * __val) const {
    99     return do_put(__s, __f, __fill, __val);
   100   }
   101 
   102 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   103     _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   104     _STLP_STATIC_MEMBER_DECLSPEC static locale::id&
   105                 GetFacetLocaleId(ostreambuf_iterator<char, char_traits<char> > *);
   106     _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(char**);
   107 	//wchar_t
   108     _STLP_STATIC_MEMBER_DECLSPEC static locale::id&
   109 	                GetFacetLocaleId(ostreambuf_iterator<wchar_t, char_traits<wchar_t> > *);
   110     _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(wchar_t**);
   111     //adding for new iterator type
   112     _STLP_STATIC_MEMBER_DECLSPEC static locale::id&
   113 	                GetFacetLocaleId(back_insert_iterator<string> *);
   114 #else
   115   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   116 #endif
   117 
   118 protected:
   119   ~num_put() {}   
   120 # ifndef _STLP_NO_BOOL
   121   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
   122 # endif
   123   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
   124   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
   125   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
   126 #ifndef _STLP_NO_LONG_DOUBLE
   127   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
   128 #endif
   129 
   130 #ifdef _STLP_LONG_LONG
   131   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
   132   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 
   133                            unsigned _STLP_LONG_LONG __val) const ;
   134 #endif /* _STLP_LONG_LONG  */
   135   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
   136 };
   137 
   138 # ifdef _STLP_USE_TEMPLATE_EXPORT
   139 _STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
   140 // _STLP_EXPORT_TEMPLATE_CLASS num_put<char, char*>;
   141 #  ifndef _STLP_NO_WCHAR_T
   142 _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
   143 // _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, wchar_t*>;
   144 #  endif /* _STLP_NO_WCHAR_T */
   145 # endif
   146 
   147 # if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
   148 
   149 template <class _Integer>
   150 char* _STLP_CALL
   151 __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
   152 
   153 extern _STLP_DECLSPEC int  _STLP_CALL __string_to_float(const string&, float&);
   154 extern _STLP_DECLSPEC int  _STLP_CALL __string_to_float(const string&, double&);
   155 extern _STLP_DECLSPEC void _STLP_CALL __write_float(string&, ios_base::fmtflags, int, double);
   156 # ifndef _STLP_NO_LONG_DOUBLE
   157 int  _STLP_CALL __string_to_float(const string&, long double&);
   158 extern _STLP_DECLSPEC void _STLP_CALL __write_float(string&, ios_base::fmtflags, int, long double);
   159 # endif
   160 
   161 #ifndef _STLP_NO_WCHAR_T
   162 extern _STLP_DECLSPEC wchar_t* _STLP_CALL __convert_float_buffer(const char*, const char*, wchar_t*, const ctype<wchar_t>&, wchar_t);
   163 #endif
   164 extern _STLP_DECLSPEC void _STLP_CALL __adjust_float_buffer(char*, char*, char);
   165 
   166 extern _STLP_DECLSPEC char* _STLP_CALL
   167 __write_integer(char* buf, ios_base::fmtflags flags, long x);
   168 
   169 extern _STLP_DECLSPEC ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
   170 #  ifndef _STLP_NO_WCHAR_T
   171 extern _STLP_DECLSPEC ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
   172 #  endif
   173 
   174 # endif
   175 
   176 # if defined (__BORLANDC__) && defined (_RTLDLL)
   177 inline void _Stl_loc_init_num_put() {
   178   
   179   num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 14;
   180   num_put<char, char*>::id._M_index = 15;
   181   
   182 # ifndef _STLP_NO_WCHAR_T
   183   num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 33;
   184   num_put<wchar_t, wchar_t*>::id._M_index = 34;
   185 # endif
   186   
   187 }
   188  
   189 # endif
   190 
   191 _STLP_END_NAMESPACE
   192 
   193 #  if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
   194 #   include <stl/_num_put.c>
   195 #  endif
   196 
   197 #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
   198 
   199 // Local Variables:
   200 // mode:C++
   201 // End:
   202