]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/stl/stl/_numpunct.h
Add STLport 5.1.4
[polintos/scott/priv.git] / include / c++ / stl / stl / _numpunct.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_NUMPUNCT_H
24 #define _STLP_INTERNAL_NUMPUNCT_H
25
26 #ifndef _STLP_IOS_BASE_H
27 # include <stl/_ios_base.h>
28 #endif
29
30 # ifndef _STLP_C_LOCALE_H
31 #  include <stl/c_locale.h>
32 # endif
33
34 #ifndef _STLP_INTERNAL_STRING_H
35 # include <stl/_string.h>
36 #endif
37
38 _STLP_BEGIN_NAMESPACE
39
40 //----------------------------------------------------------------------
41 // numpunct facets
42
43 template <class _CharT> class numpunct {};
44 template <class _CharT> class numpunct_byname {};
45 template <class _Ch, class _InIt> class num_get;
46
47 _STLP_TEMPLATE_NULL
48 class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
49 {
50   friend class _Locale_impl;
51
52 #ifndef _STLP_NO_FRIEND_TEMPLATES
53   template <class _Ch, class _InIt> friend class num_get;
54 #endif
55 public:
56   typedef char               char_type;
57   typedef string             string_type;
58
59   explicit numpunct(size_t __refs = 0)
60     : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
61
62   char decimal_point() const { return do_decimal_point(); }
63   char thousands_sep() const { return do_thousands_sep(); }
64   string grouping() const { return do_grouping(); }
65   string truename() const { return do_truename(); }
66   string falsename() const { return do_falsename(); }
67
68   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
69
70 #ifndef _STLP_NO_FRIEND_TEMPLATES
71 protected:
72 #endif
73   ~numpunct();
74
75   string  _M_truename;
76   string  _M_falsename;
77   string  _M_grouping;
78
79   virtual char do_decimal_point() const;
80   virtual char do_thousands_sep() const;
81   virtual string do_grouping() const;
82   virtual string do_truename() const;
83   virtual string do_falsename()  const;
84 };
85
86 # if ! defined (_STLP_NO_WCHAR_T)
87
88 _STLP_TEMPLATE_NULL
89 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
90 {
91   friend class _Locale_impl;
92 public:
93   typedef wchar_t               char_type;
94   typedef wstring               string_type;
95
96   explicit numpunct(size_t __refs = 0)
97     : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
98
99   wchar_t decimal_point() const { return do_decimal_point(); }
100   wchar_t thousands_sep() const { return do_thousands_sep(); }
101   string grouping() const { return do_grouping(); }
102   wstring truename() const { return do_truename(); }
103   wstring falsename() const { return do_falsename(); }
104
105   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
106
107 protected:
108   wstring _M_truename;
109   wstring _M_falsename;
110   string _M_grouping;
111
112   ~numpunct();
113
114   virtual wchar_t do_decimal_point() const;
115   virtual wchar_t do_thousands_sep() const;
116   virtual string do_grouping() const;
117   virtual wstring do_truename() const;
118   virtual wstring do_falsename()  const;
119 };
120
121 # endif /* WCHAR_T */
122
123 _STLP_TEMPLATE_NULL
124 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
125 public:
126   typedef char                char_type;
127   typedef string              string_type;
128
129   explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
130
131 protected:
132
133   ~numpunct_byname();
134
135   virtual char   do_decimal_point() const;
136   virtual char   do_thousands_sep() const;
137   virtual string do_grouping()      const;
138
139 private:
140   _Locale_numeric* _M_numeric;
141
142   //explicitely defined as private to avoid warnings:
143   typedef numpunct_byname<char> _Self;
144   numpunct_byname(_Self const&);
145   _Self& operator = (_Self const&);
146   friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
147 };
148
149 # ifndef _STLP_NO_WCHAR_T
150 _STLP_TEMPLATE_NULL
151 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
152 public:
153   typedef wchar_t               char_type;
154   typedef wstring               string_type;
155
156   explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
157
158 protected:
159
160   ~numpunct_byname();
161
162   virtual wchar_t   do_decimal_point() const;
163   virtual wchar_t   do_thousands_sep() const;
164   virtual string do_grouping() const;
165
166 private:
167   _Locale_numeric* _M_numeric;
168
169   //explicitely defined as private to avoid warnings:
170   typedef numpunct_byname<wchar_t> _Self;
171   numpunct_byname(_Self const&);
172   _Self& operator = (_Self const&);
173 };
174
175 # endif /* WCHAR_T */
176
177 _STLP_END_NAMESPACE
178
179 #endif /* _STLP_NUMPUNCT_H */
180
181 // Local Variables:
182 // mode:C++
183 // End:
184