williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
|
williamr@2
|
3 |
*
|
williamr@2
|
4 |
* Copyright (c) 1999
|
williamr@2
|
5 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@2
|
6 |
*
|
williamr@2
|
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@2
|
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@2
|
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@2
|
31 |
#ifndef _STLP_INTERNAL_CTYPE_H
|
williamr@2
|
32 |
# include <stl/_ctype.h>
|
williamr@2
|
33 |
#endif
|
williamr@2
|
34 |
#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
|
williamr@2
|
35 |
# include <stl/_ostreambuf_iterator.h>
|
williamr@2
|
36 |
#endif
|
williamr@2
|
37 |
|
williamr@2
|
38 |
_STLP_BEGIN_NAMESPACE
|
williamr@2
|
39 |
|
williamr@2
|
40 |
//----------------------------------------------------------------------
|
williamr@2
|
41 |
// num_put facet
|
williamr@2
|
42 |
|
williamr@2
|
43 |
# ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
|
williamr@2
|
44 |
template <class _CharT, class _OutputIter>
|
williamr@2
|
45 |
# else
|
williamr@2
|
46 |
template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
|
williamr@2
|
47 |
# endif
|
williamr@2
|
48 |
class num_put: public locale::facet
|
williamr@2
|
49 |
{
|
williamr@2
|
50 |
friend class _Locale;
|
williamr@2
|
51 |
public:
|
williamr@2
|
52 |
typedef _CharT char_type;
|
williamr@2
|
53 |
typedef _OutputIter iter_type;
|
williamr@2
|
54 |
|
williamr@2
|
55 |
explicit num_put(size_t __refs = 0) : _BaseFacet(__refs) {}
|
williamr@2
|
56 |
|
williamr@2
|
57 |
# ifndef _STLP_NO_BOOL
|
williamr@2
|
58 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
59 |
bool __val) const {
|
williamr@2
|
60 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
61 |
}
|
williamr@2
|
62 |
# endif
|
williamr@2
|
63 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
64 |
long __val) const {
|
williamr@2
|
65 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
66 |
}
|
williamr@2
|
67 |
|
williamr@2
|
68 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
69 |
unsigned long __val) const {
|
williamr@2
|
70 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
71 |
}
|
williamr@2
|
72 |
|
williamr@2
|
73 |
#ifdef _STLP_LONG_LONG
|
williamr@2
|
74 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
75 |
_STLP_LONG_LONG __val) const {
|
williamr@2
|
76 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
77 |
}
|
williamr@2
|
78 |
|
williamr@2
|
79 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
80 |
unsigned _STLP_LONG_LONG __val) const {
|
williamr@2
|
81 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
82 |
}
|
williamr@2
|
83 |
#endif
|
williamr@2
|
84 |
|
williamr@2
|
85 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
86 |
double __val) const {
|
williamr@2
|
87 |
return do_put(__s, __f, __fill, (double)__val);
|
williamr@2
|
88 |
}
|
williamr@2
|
89 |
|
williamr@2
|
90 |
#ifndef _STLP_NO_LONG_DOUBLE
|
williamr@2
|
91 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
92 |
long double __val) const {
|
williamr@2
|
93 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
94 |
}
|
williamr@2
|
95 |
# endif
|
williamr@2
|
96 |
|
williamr@2
|
97 |
iter_type put(iter_type __s, ios_base& __f, char_type __fill,
|
williamr@2
|
98 |
const void * __val) const {
|
williamr@2
|
99 |
return do_put(__s, __f, __fill, __val);
|
williamr@2
|
100 |
}
|
williamr@2
|
101 |
|
williamr@2
|
102 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
103 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
104 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id&
|
williamr@2
|
105 |
GetFacetLocaleId(ostreambuf_iterator<char, char_traits<char> > *);
|
williamr@2
|
106 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(char**);
|
williamr@2
|
107 |
//wchar_t
|
williamr@2
|
108 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id&
|
williamr@2
|
109 |
GetFacetLocaleId(ostreambuf_iterator<wchar_t, char_traits<wchar_t> > *);
|
williamr@2
|
110 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(wchar_t**);
|
williamr@2
|
111 |
//adding for new iterator type
|
williamr@2
|
112 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id&
|
williamr@2
|
113 |
GetFacetLocaleId(back_insert_iterator<string> *);
|
williamr@2
|
114 |
#else
|
williamr@2
|
115 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
116 |
#endif
|
williamr@2
|
117 |
|
williamr@2
|
118 |
protected:
|
williamr@2
|
119 |
~num_put() {}
|
williamr@2
|
120 |
# ifndef _STLP_NO_BOOL
|
williamr@2
|
121 |
virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
|
williamr@2
|
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@2
|
126 |
#ifndef _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@2
|
130 |
#ifdef _STLP_LONG_LONG
|
williamr@2
|
131 |
virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
|
williamr@2
|
132 |
virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
|
williamr@2
|
133 |
unsigned _STLP_LONG_LONG __val) const ;
|
williamr@2
|
134 |
#endif /* _STLP_LONG_LONG */
|
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@2
|
138 |
# ifdef _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@2
|
141 |
# ifndef _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@2
|
144 |
# endif /* _STLP_NO_WCHAR_T */
|
williamr@2
|
145 |
# endif
|
williamr@2
|
146 |
|
williamr@2
|
147 |
# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
|
williamr@2
|
148 |
|
williamr@2
|
149 |
template <class _Integer>
|
williamr@2
|
150 |
char* _STLP_CALL
|
williamr@2
|
151 |
__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
|
williamr@2
|
152 |
|
williamr@2
|
153 |
extern _STLP_DECLSPEC int _STLP_CALL __string_to_float(const string&, float&);
|
williamr@2
|
154 |
extern _STLP_DECLSPEC int _STLP_CALL __string_to_float(const string&, double&);
|
williamr@2
|
155 |
extern _STLP_DECLSPEC void _STLP_CALL __write_float(string&, ios_base::fmtflags, int, double);
|
williamr@2
|
156 |
# ifndef _STLP_NO_LONG_DOUBLE
|
williamr@2
|
157 |
int _STLP_CALL __string_to_float(const string&, long double&);
|
williamr@2
|
158 |
extern _STLP_DECLSPEC void _STLP_CALL __write_float(string&, ios_base::fmtflags, int, long double);
|
williamr@2
|
159 |
# endif
|
williamr@2
|
160 |
|
williamr@2
|
161 |
#ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
162 |
extern _STLP_DECLSPEC wchar_t* _STLP_CALL __convert_float_buffer(const char*, const char*, wchar_t*, const ctype<wchar_t>&, wchar_t);
|
williamr@2
|
163 |
#endif
|
williamr@2
|
164 |
extern _STLP_DECLSPEC void _STLP_CALL __adjust_float_buffer(char*, char*, char);
|
williamr@2
|
165 |
|
williamr@2
|
166 |
extern _STLP_DECLSPEC char* _STLP_CALL
|
williamr@2
|
167 |
__write_integer(char* buf, ios_base::fmtflags flags, long x);
|
williamr@2
|
168 |
|
williamr@2
|
169 |
extern _STLP_DECLSPEC ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
|
williamr@2
|
170 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
171 |
extern _STLP_DECLSPEC ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
|
williamr@2
|
172 |
# endif
|
williamr@2
|
173 |
|
williamr@2
|
174 |
# endif
|
williamr@2
|
175 |
|
williamr@2
|
176 |
# if defined (__BORLANDC__) && defined (_RTLDLL)
|
williamr@2
|
177 |
inline void _Stl_loc_init_num_put() {
|
williamr@2
|
178 |
|
williamr@2
|
179 |
num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 14;
|
williamr@2
|
180 |
num_put<char, char*>::id._M_index = 15;
|
williamr@2
|
181 |
|
williamr@2
|
182 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
183 |
num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 33;
|
williamr@2
|
184 |
num_put<wchar_t, wchar_t*>::id._M_index = 34;
|
williamr@2
|
185 |
# endif
|
williamr@2
|
186 |
|
williamr@2
|
187 |
}
|
williamr@2
|
188 |
|
williamr@2
|
189 |
# endif
|
williamr@2
|
190 |
|
williamr@2
|
191 |
_STLP_END_NAMESPACE
|
williamr@2
|
192 |
|
williamr@2
|
193 |
# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
|
williamr@2
|
194 |
# include <stl/_num_put.c>
|
williamr@2
|
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:
|
williamr@2
|
202 |
|