3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
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.
18 // WARNING: This is an internal header file, included by other C++
19 // standard library headers. You should not attempt to use this header
23 #ifndef _STLP_INTERNAL_NUM_PUT_H
24 #define _STLP_INTERNAL_NUM_PUT_H
26 #ifndef _STLP_INTERNAL_NUMPUNCT_H
27 # include <stl/_numpunct.h>
30 #ifndef _STLP_INTERNAL_CTYPE_H
31 # include <stl/_ctype.h>
34 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
35 # include <stl/_ostreambuf_iterator.h>
38 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
39 # include <stl/_iostream_string.h>
44 //----------------------------------------------------------------------
47 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
48 template <class _CharT, class _OutputIter>
50 template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
52 class num_put: public locale::facet {
53 friend class _Locale_impl;
55 typedef _CharT char_type;
56 typedef _OutputIter iter_type;
58 explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
60 #if !defined (_STLP_NO_BOOL)
61 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
63 return do_put(__s, __f, __fill, __val);
66 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
68 return do_put(__s, __f, __fill, __val);
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);
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);
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);
88 iter_type put(iter_type __s, ios_base& __f, char_type __fill,
90 return do_put(__s, __f, __fill, (double)__val);
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);
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);
105 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
109 #if !defined (_STLP_NO_BOOL)
110 virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
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;
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 ;
124 virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
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*>;
136 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
138 _STLP_MOVE_TO_PRIV_NAMESPACE
140 template <class _Integer>
142 __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
144 void _STLP_CALL __string_to_float(const string&, float&);
145 void _STLP_CALL __string_to_float(const string&, double&);
147 * Returns the position on the right of the digits that has to be considered
148 * for the application of the grouping policy.
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);
157 * Gets the digits of the integer part.
159 void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
161 template <class _CharT>
162 void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
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);
167 extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
169 extern char* _STLP_CALL
170 __write_integer(char* buf, ios_base::fmtflags flags, long x);
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);
179 _STLP_MOVE_TO_STD_NAMESPACE
181 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
185 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
186 # include <stl/_num_put.c>
189 #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */