3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
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.
19 // WARNING: This is an internal header file, included by other C++
20 // standard library headers. You should not attempt to use this header
24 #ifndef _STLP_INTERNAL_MESSAGES_H
25 #define _STLP_INTERNAL_MESSAGES_H
27 #ifndef _STLP_IOS_BASE_H
28 # include <stl/_ios_base.h>
31 #ifndef _STLP_C_LOCALE_H
32 # include <stl/c_locale.h>
35 #ifndef _STLP_INTERNAL_STRING_H
36 # include <stl/_string.h>
48 template <class _CharT
> class messages
{};
50 _STLP_MOVE_TO_PRIV_NAMESPACE
52 _STLP_MOVE_TO_STD_NAMESPACE
55 class _STLP_CLASS_DECLSPEC messages
<char> : public locale::facet
, public messages_base
{
57 typedef messages_base::catalog catalog
;
58 typedef char char_type
;
59 typedef string string_type
;
61 explicit messages(size_t __refs
= 0);
63 catalog
open(const string
& __fn
, const locale
& __loc
) const
64 { return do_open(__fn
, __loc
); }
65 string_type
get(catalog __c
, int __set
, int __msgid
,
66 const string_type
& __dfault
) const
67 { return do_get(__c
, __set
, __msgid
, __dfault
); }
68 inline void close(catalog __c
) const
71 static _STLP_STATIC_DECLSPEC
locale::id id
;
76 virtual catalog
do_open(const string
& __fn
, const locale
& __loc
) const
78 virtual string_type
do_get(catalog __c
, int __set
, int __msgid
,
79 const string_type
& __dfault
) const
81 virtual void do_close(catalog __c
) const
85 #if !defined (_STLP_NO_WCHAR_T)
88 class _STLP_CLASS_DECLSPEC messages
<wchar_t> : public locale::facet
, public messages_base
{
90 typedef messages_base::catalog catalog
;
91 typedef wchar_t char_type
;
92 typedef wstring string_type
;
94 explicit messages(size_t __refs
= 0);
96 inline catalog
open(const string
& __fn
, const locale
& __loc
) const
97 { return do_open(__fn
, __loc
); }
98 inline string_type
get(catalog __c
, int __set
, int __msgid
,
99 const string_type
& __dfault
) const
100 { return do_get(__c
, __set
, __msgid
, __dfault
); }
101 inline void close(catalog __c
) const
104 static _STLP_STATIC_DECLSPEC
locale::id id
;
109 virtual catalog
do_open(const string
& __fn
, const locale
& __loc
) const
111 virtual string_type
do_get(catalog __c
, int __set
, int __msgid
,
112 const string_type
& __dfault
) const
114 virtual void do_close(catalog __c
) const
120 template <class _CharT
> class messages_byname
{};
123 class _STLP_CLASS_DECLSPEC messages_byname
<char> : public messages
<char> {
124 friend class _Locale_impl
;
126 typedef messages_base::catalog catalog
;
127 typedef string string_type
;
129 explicit messages_byname(const char* __name
, size_t __refs
= 0);
134 virtual catalog
do_open(const string
& __fn
, const locale
& __loc
) const;
135 virtual string_type
do_get(catalog __c
, int __set
, int __msgid
,
136 const string_type
& __dfault
) const;
137 virtual void do_close(catalog __c
) const;
140 messages_byname(_Locale_messages
*);
141 typedef messages_byname
<char> _Self
;
142 //explicitely defined as private to avoid warnings:
143 messages_byname(_Self
const&);
144 _Self
& operator = (_Self
const&);
146 _STLP_PRIV _Messages
* _M_impl
;
149 #if !defined (_STLP_NO_WCHAR_T)
151 class _STLP_CLASS_DECLSPEC messages_byname
<wchar_t> : public messages
<wchar_t> {
152 friend class _Locale_impl
;
154 typedef messages_base::catalog catalog
;
155 typedef wstring string_type
;
157 explicit messages_byname(const char* __name
, size_t __refs
= 0);
162 virtual catalog
do_open(const string
& __fn
, const locale
& __loc
) const;
163 virtual string_type
do_get(catalog __c
, int __set
, int __msgid
,
164 const string_type
& __dfault
) const;
165 virtual void do_close(catalog __c
) const;
168 messages_byname(_Locale_messages
*);
169 typedef messages_byname
<wchar_t> _Self
;
170 //explicitely defined as private to avoid warnings:
171 messages_byname(_Self
const&);
172 _Self
& operator = (_Self
const&);
174 _STLP_PRIV _Messages
* _M_impl
;
180 #endif /* _STLP_INTERNAL_MESSAGES_H */