2 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
5 * Silicon Graphics Computer Systems, Inc.
10 * This material is provided "as is", with absolutely no warranty expressed
11 * or implied. Any use is at your own risk.
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.
20 // WARNING: This is an internal header file, included by other C++
21 // standard library headers. You should not attempt to use this header
25 #ifndef _STLP_INTERNAL_NUM_PUT_H
26 #define _STLP_INTERNAL_NUM_PUT_H
28 #ifndef _STLP_INTERNAL_NUMPUNCT_H
29 # include <stl/_numpunct.h>
32 #ifndef _STLP_INTERNAL_CTYPE_H
33 # include <stl/_ctype.h>
36 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
37 # include <stl/_ostreambuf_iterator.h>
40 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
41 # include <stl/_iostream_string.h>
46 //----------------------------------------------------------------------
49 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
50 template <class _CharT, class _OutputIter>
52 template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
54 class num_put: public locale::facet {
55 friend class _Locale_impl;
57 typedef _CharT char_type;
58 typedef _OutputIter iter_type;
60 explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
62 #if !defined (_STLP_NO_BOOL)
63 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
65 return do_put(__s, __f, __fill, __val);
68 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
70 return do_put(__s, __f, __fill, __val);
73 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
74 unsigned long __val) const {
75 return do_put(__s, __f, __fill, __val);
78 #if defined (_STLP_LONG_LONG)
79 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
80 _STLP_LONG_LONG __val) const {
81 return do_put(__s, __f, __fill, __val);
84 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
85 unsigned _STLP_LONG_LONG __val) const {
86 return do_put(__s, __f, __fill, __val);
90 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
92 return do_put(__s, __f, __fill, (double)__val);
95 #if !defined (_STLP_NO_LONG_DOUBLE)
96 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
97 long double __val) const {
98 return do_put(__s, __f, __fill, __val);
102 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
103 const void * __val) const {
104 return do_put(__s, __f, __fill, __val);
107 #if defined(__SYMBIAN32__WSD__)
108 static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
109 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
110 static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
111 static locale::id id;
113 // NOTE: Symbian doesn't support exporting static data.
114 // Users of this class should use GetFacetLocaleId() to access the data member id
115 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
120 #if !defined (_STLP_NO_BOOL)
121 virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
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 #if !defined (_STLP_NO_LONG_DOUBLE)
127 virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
130 #if defined (_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 ;
135 virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
138 #if defined (_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 # if !defined (_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*>;
147 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
149 _STLP_MOVE_TO_PRIV_NAMESPACE
151 template <class _Integer>
153 __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
156 * Returns the position on the right of the digits that has to be considered
157 * for the application of the grouping policy.
159 _STLP_DECLSPEC size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double); //RVCT 3.1 export issue: _STLP_DECLSPEC added.
160 # if !defined (_STLP_NO_LONG_DOUBLE)
161 _STLP_DECLSPEC size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double);
165 * Gets the digits of the integer part.
167 _STLP_DECLSPEC void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
169 template <class _CharT>
170 void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
172 # if !defined (_STLP_NO_WCHAR_T)
173 _STLP_DECLSPEC void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype<wchar_t>&, wchar_t, bool = true);
175 extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
177 extern char* _STLP_CALL
178 __write_integer(char* buf, ios_base::fmtflags flags, long x);
180 _STLP_DECLSPEC ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
181 _STLP_DECLSPEC void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int);
182 # if !defined (_STLP_NO_WCHAR_T)
183 _STLP_DECLSPEC ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
184 _STLP_DECLSPEC void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int);
187 _STLP_MOVE_TO_STD_NAMESPACE
189 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
193 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
194 # include <stl/_num_put.c>
197 #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */