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>
42 #ifndef _STLP_FACETS_FWD_H
43 # include <stl/_facets_fwd.h>
48 //----------------------------------------------------------------------
51 template <class _CharT
, class _OutputIter
>
52 class num_put
: public locale::facet
{
54 typedef _CharT char_type
;
55 typedef _OutputIter iter_type
;
57 explicit num_put(size_t __refs
= 0) : locale::facet(__refs
) {}
59 #if !defined (_STLP_NO_BOOL)
60 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
62 return do_put(__s
, __f
, __fill
, __val
);
65 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
67 return do_put(__s
, __f
, __fill
, __val
);
70 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
71 unsigned long __val
) const {
72 return do_put(__s
, __f
, __fill
, __val
);
75 #if defined (_STLP_LONG_LONG)
76 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
77 _STLP_LONG_LONG __val
) const {
78 return do_put(__s
, __f
, __fill
, __val
);
81 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
82 unsigned _STLP_LONG_LONG __val
) const {
83 return do_put(__s
, __f
, __fill
, __val
);
87 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
89 return do_put(__s
, __f
, __fill
, (double)__val
);
92 #if !defined (_STLP_NO_LONG_DOUBLE)
93 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
94 long double __val
) const {
95 return do_put(__s
, __f
, __fill
, __val
);
99 iter_type
put(iter_type __s
, ios_base
& __f
, char_type __fill
,
100 const void * __val
) const {
101 return do_put(__s
, __f
, __fill
, __val
);
104 static locale::id id
;
108 #if !defined (_STLP_NO_BOOL)
109 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, bool __val
) const;
111 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, long __val
) const;
112 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, unsigned long __val
) const;
113 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, double __val
) const;
114 #if !defined (_STLP_NO_LONG_DOUBLE)
115 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, long double __val
) const;
118 #if defined (_STLP_LONG_LONG)
119 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, _STLP_LONG_LONG __val
) const;
120 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
,
121 unsigned _STLP_LONG_LONG __val
) const ;
123 virtual _OutputIter
do_put(_OutputIter __s
, ios_base
& __f
, _CharT __fill
, const void* __val
) const;
126 #if defined (_STLP_USE_TEMPLATE_EXPORT)
127 _STLP_EXPORT_TEMPLATE_CLASS num_put
<char, ostreambuf_iterator
<char, char_traits
<char> > >;
128 # if !defined (_STLP_NO_WCHAR_T)
129 _STLP_EXPORT_TEMPLATE_CLASS num_put
<wchar_t, ostreambuf_iterator
<wchar_t, char_traits
<wchar_t> > >;
133 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
135 _STLP_MOVE_TO_PRIV_NAMESPACE
137 template <class _Integer
>
139 __write_integer_backward(char* __buf
, ios_base::fmtflags __flags
, _Integer __x
);
142 * Returns the position on the right of the digits that has to be considered
143 * for the application of the grouping policy.
145 extern size_t _STLP_CALL
__write_float(__iostring
&, ios_base::fmtflags
, int, double);
146 # if !defined (_STLP_NO_LONG_DOUBLE)
147 extern size_t _STLP_CALL
__write_float(__iostring
&, ios_base::fmtflags
, int, long double);
151 * Gets the digits of the integer part.
153 void _STLP_CALL
__get_floor_digits(__iostring
&, _STLP_LONGEST_FLOAT_TYPE
);
155 template <class _CharT
>
156 void _STLP_CALL
__get_money_digits(_STLP_BASIC_IOSTRING(_CharT
)&, ios_base
&, _STLP_LONGEST_FLOAT_TYPE
);
158 # if !defined (_STLP_NO_WCHAR_T)
159 extern void _STLP_CALL
__convert_float_buffer(__iostring
const&, __iowstring
&, const ctype
<wchar_t>&, wchar_t, bool = true);
161 extern void _STLP_CALL
__adjust_float_buffer(__iostring
&, char);
163 extern char* _STLP_CALL
164 __write_integer(char* buf
, ios_base::fmtflags flags
, long x
);
166 extern ptrdiff_t _STLP_CALL
__insert_grouping(char* first
, char* last
, const string
&, char, char, char, int);
167 extern void _STLP_CALL
__insert_grouping(__iostring
&, size_t, const string
&, char, char, char, int);
168 # if !defined (_STLP_NO_WCHAR_T)
169 extern ptrdiff_t _STLP_CALL
__insert_grouping(wchar_t*, wchar_t*, const string
&, wchar_t, wchar_t, wchar_t, int);
170 extern void _STLP_CALL
__insert_grouping(__iowstring
&, size_t, const string
&, wchar_t, wchar_t, wchar_t, int);
173 _STLP_MOVE_TO_STD_NAMESPACE
175 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
179 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
180 # include <stl/_num_put.c>
183 #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */