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