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