]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/stl/stl/_messages_facets.h
Add STLport 5.1.4
[polintos/scott/priv.git] / include / c++ / stl / stl / _messages_facets.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
19 // WARNING: This is an internal header file, included by other C++
20 // standard library headers.  You should not attempt to use this header
21 // file directly.
22
23
24 #ifndef _STLP_INTERNAL_MESSAGES_H
25 #define _STLP_INTERNAL_MESSAGES_H
26
27 #ifndef _STLP_IOS_BASE_H
28 #  include <stl/_ios_base.h>
29 #endif
30
31 #ifndef _STLP_C_LOCALE_H
32 #  include <stl/c_locale.h>
33 #endif
34
35 #ifndef _STLP_INTERNAL_STRING_H
36 #  include <stl/_string.h>
37 #endif
38
39 _STLP_BEGIN_NAMESPACE
40
41 // messages facets
42
43 class messages_base {
44   public:
45     typedef int catalog;
46 };
47
48 template <class _CharT> class messages {};
49
50 _STLP_MOVE_TO_PRIV_NAMESPACE
51 class _Messages;
52 _STLP_MOVE_TO_STD_NAMESPACE
53
54 _STLP_TEMPLATE_NULL
55 class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
56   friend class _Locale_impl;
57 public:
58   typedef messages_base::catalog catalog;
59   typedef char                   char_type;
60   typedef string    string_type;
61
62   explicit messages(size_t __refs = 0);
63
64   catalog open(const string& __fn, const locale& __loc) const
65   { return do_open(__fn, __loc); }
66   string_type get(catalog __c, int __set, int __msgid,
67                   const string_type& __dfault) const
68   { return do_get(__c, __set, __msgid, __dfault); }
69   inline void close(catalog __c) const
70   { do_close(__c); }
71
72   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
73
74 private:
75   messages(_STLP_PRIV _Messages*);
76
77 protected:
78   messages(size_t, _Locale_messages*);
79   ~messages();
80
81   virtual catalog     do_open(const string& __fn, const locale& __loc) const;
82   virtual string_type do_get(catalog __c, int __set, int __msgid,
83                              const string_type& __dfault) const;
84   virtual void        do_close(catalog __c) const;
85
86   void _M_initialize(const char* __name);
87
88 private:
89   _STLP_PRIV _Messages* _M_impl;
90 };
91
92 #if !defined (_STLP_NO_WCHAR_T)
93
94 _STLP_TEMPLATE_NULL
95 class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
96   friend class _Locale_impl;
97 public:
98   typedef messages_base::catalog catalog;
99   typedef wchar_t                char_type;
100   typedef wstring  string_type;
101
102   explicit messages(size_t __refs = 0);
103
104   inline catalog open(const string& __fn, const locale& __loc) const
105     { return do_open(__fn, __loc); }
106   inline string_type get(catalog __c, int __set, int __msgid,
107                          const string_type& __dfault) const
108     { return do_get(__c, __set, __msgid, __dfault); }
109   inline void close(catalog __c) const
110     { do_close(__c); }
111
112   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
113
114 private:
115   messages(_STLP_PRIV _Messages*);
116
117 protected:
118   messages(size_t, _Locale_messages*);
119   ~messages();
120
121   virtual catalog     do_open(const string& __fn, const locale& __loc) const;
122   virtual string_type do_get(catalog __c, int __set, int __msgid,
123                              const string_type& __dfault) const;
124   virtual void        do_close(catalog __c) const;
125
126   void _M_initialize(const char* __name);
127
128 private:
129   _STLP_PRIV _Messages* _M_impl;
130 };
131
132 #endif
133
134 template <class _CharT> class messages_byname {};
135
136 _STLP_TEMPLATE_NULL
137 class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
138 public:
139   typedef messages_base::catalog catalog;
140   typedef string     string_type;
141
142   explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
143
144 protected:
145   ~messages_byname();
146
147 private:
148   typedef messages_byname<char> _Self;
149   //explicitely defined as private to avoid warnings:
150   messages_byname(_Self const&);
151   _Self& operator = (_Self const&);
152 };
153
154 #if !defined (_STLP_NO_WCHAR_T)
155 _STLP_TEMPLATE_NULL
156 class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
157 public:
158   typedef messages_base::catalog catalog;
159   typedef wstring                string_type;
160
161   explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
162
163 protected:
164   ~messages_byname();
165
166 private:
167   typedef messages_byname<wchar_t> _Self;
168   //explicitely defined as private to avoid warnings:
169   messages_byname(_Self const&);
170   _Self& operator = (_Self const&);
171 };
172 #endif /* WCHAR_T */
173
174 _STLP_END_NAMESPACE
175
176 #endif /* _STLP_INTERNAL_MESSAGES_H */
177
178 // Local Variables:
179 // mode:C++
180 // End:
181