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