]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/stl/stl/_num_put.h
Add STLport 5.1.4
[polintos/scott/priv.git] / include / c++ / stl / stl / _num_put.h
1 /*
2  * Copyright (c) 1999
3  * Silicon Graphics Computer Systems, Inc.
4  *
5  * Copyright (c) 1999
6  * Boris Fomitchev
7  *
8  * This material is provided "as is", with absolutely no warranty expressed
9  * or implied. Any use is at your own risk.
10  *
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.
16  *
17  */
18 // WARNING: This is an internal header file, included by other C++
19 // standard library headers.  You should not attempt to use this header
20 // file directly.
21
22
23 #ifndef _STLP_INTERNAL_NUM_PUT_H
24 #define _STLP_INTERNAL_NUM_PUT_H
25
26 #ifndef _STLP_INTERNAL_NUMPUNCT_H
27 # include <stl/_numpunct.h>
28 #endif
29
30 #ifndef _STLP_INTERNAL_CTYPE_H
31 # include <stl/_ctype.h>
32 #endif
33
34 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
35 # include <stl/_ostreambuf_iterator.h>
36 #endif
37
38 #ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
39 # include <stl/_iostream_string.h>
40 #endif
41
42 _STLP_BEGIN_NAMESPACE
43
44 //----------------------------------------------------------------------
45 // num_put facet
46
47 #if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
48 template <class _CharT, class _OutputIter>
49 #else
50 template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
51 #endif
52 class num_put: public locale::facet {
53   friend class _Locale_impl;
54 public:
55   typedef _CharT      char_type;
56   typedef _OutputIter iter_type;
57
58   explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
59
60 #if !defined (_STLP_NO_BOOL)
61   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
62                 bool __val) const {
63     return do_put(__s, __f, __fill, __val);
64   }
65 #endif
66   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
67                long __val) const {
68     return do_put(__s, __f, __fill, __val);
69   }
70
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);
74   }
75
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);
80   }
81
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);
85   }
86 #endif
87
88   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
89                 double __val) const {
90     return do_put(__s, __f, __fill, (double)__val);
91   }
92
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);
97   }
98 #endif
99
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);
103   }
104
105   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
106
107 protected:
108   ~num_put() {}
109 #if !defined (_STLP_NO_BOOL)
110   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
111 #endif
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;
117 #endif
118
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 ;
123 #endif
124   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
125 };
126
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*>;
133 #  endif
134 #endif
135
136 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
137
138 _STLP_MOVE_TO_PRIV_NAMESPACE
139
140 template <class _Integer>
141 char* _STLP_CALL
142 __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
143
144 /*
145  * Returns the position on the right of the digits that has to be considered
146  * for the application of the grouping policy.
147  */
148 extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double);
149 #  if !defined (_STLP_NO_LONG_DOUBLE)
150 extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double);
151 #  endif
152
153 /*
154  * Gets the digits of the integer part.
155  */
156 void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
157
158 template <class _CharT>
159 void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
160
161 #  if !defined (_STLP_NO_WCHAR_T)
162 extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype<wchar_t>&, wchar_t, bool = true);
163 #  endif
164 extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
165
166 extern char* _STLP_CALL
167 __write_integer(char* buf, ios_base::fmtflags flags, long x);
168
169 extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
170 extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int);
171 #  if !defined (_STLP_NO_WCHAR_T)
172 extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
173 extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int);
174 #  endif
175
176 _STLP_MOVE_TO_STD_NAMESPACE
177
178 #endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
179
180 _STLP_END_NAMESPACE
181
182 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
183 #  include <stl/_num_put.c>
184 #endif
185
186 #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
187
188 // Local Variables:
189 // mode:C++
190 // End: