ReactOS  0.4.15-dev-492-ga1108f6
_Messages Class Reference

#include <message_facets.h>

Collaboration diagram for _Messages:

Public Types

typedef messages_base::catalog catalog
 

Public Member Functions

 _Messages (bool, const char *name)
 
 _Messages (bool, _Locale_messages *)
 
catalog do_open (const string &__fn, const locale &__loc) const
 
string do_get (catalog __c, int __set, int __msgid, const string &__dfault) const
 
wstring do_get (catalog __c, int __set, int __msgid, const wstring &__dfault) const
 
void do_close (catalog __c) const
 
 ~_Messages ()
 

Private Member Functions

 _Messages (const _Messages &)
 
_Messagesoperator= (const _Messages &)
 

Private Attributes

_Locale_messages * _M_message_obj
 
_Catalog_locale_map_M_map
 
_Catalog_nl_catd_map _M_cat
 

Detailed Description

Definition at line 117 of file message_facets.h.

Member Typedef Documentation

◆ catalog

Definition at line 119 of file message_facets.h.

Constructor & Destructor Documentation

◆ _Messages() [1/3]

_Messages::_Messages ( bool  is_wide,
const char name 
)

Definition at line 100 of file messages.cpp.

100  :
101  _M_message_obj(0), _M_map(0) {
102  if (!name)
104 
105  int __err_code;
108  if (!_M_message_obj)
109  locale::_M_throw_on_creation_failure(__err_code, name, "messages");
110 
111  if (is_wide)
113 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Locale_messages *_STLP_CALL __acquire_messages(const char *&name, char *buf, _Locale_name_hint *hint, int *__err_code)
static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_creation_failure(int __err_code, const char *name, const char *facet)
Definition: locale.cpp:68
_Catalog_locale_map * _M_map
static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_null_name()
Definition: locale.cpp:57
#define _STLP_PRIV
Definition: _dm.h:70
#define _Locale_MAX_SIMPLE_NAME
Definition: c_locale.h:54
Definition: name.c:38
_Locale_messages * _M_message_obj

◆ _Messages() [2/3]

_Messages::_Messages ( bool  is_wide,
_Locale_messages *  msg 
)

Definition at line 115 of file messages.cpp.

115  :
116  _M_message_obj(msg), _M_map(is_wide ? new _Catalog_locale_map() : 0)
117 {}
_Catalog_locale_map * _M_map
#define msg(x)
Definition: auth_time.c:54
_Locale_messages * _M_message_obj

◆ ~_Messages()

_Messages::~_Messages ( )

Definition at line 119 of file messages.cpp.

119  {
121  delete _M_map;
122 }
void _STLP_CALL __release_messages(_Locale_messages *cat)
_Catalog_locale_map * _M_map
_Locale_messages * _M_message_obj

◆ _Messages() [3/3]

_Messages::_Messages ( const _Messages )
private

Member Function Documentation

◆ do_close()

void _Messages::do_close ( catalog  __c) const

Definition at line 177 of file messages.cpp.

177  {
178  if (_M_message_obj)
179  _Locale_catclose(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]);
180  if (_M_map) _M_map->erase(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]);
181  _STLP_MUTABLE(_Messages_impl, _M_cat).erase( thecat );
182 }
_Catalog_nl_catd_map _M_cat
void erase(nl_catd_type key)
Definition: messages.cpp:54
#define _STLP_MUTABLE(type, x)
Definition: features.h:634
_Catalog_locale_map * _M_map
void _Locale_catclose(struct _Locale_messages *, nl_catd_type)
_Locale_messages * _M_message_obj

◆ do_get() [1/2]

string _Messages::do_get ( catalog  __c,
int  __set,
int  __msgid,
const string __dfault 
) const

Definition at line 138 of file messages.cpp.

139  {
140  return _M_message_obj != 0 && cat >= 0
141  ? string(_Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[cat],
142  set, p_id, dfault.c_str()))
143  : dfault;
144 }
const char * _Locale_catgets(struct _Locale_messages *, nl_catd_type, int, int, const char *)
_Catalog_nl_catd_map _M_cat
#define _STLP_MUTABLE(type, x)
Definition: features.h:634
char string[160]
Definition: util.h:11
_Locale_messages * _M_message_obj
Definition: _set.h:46

◆ do_get() [2/2]

wstring _Messages::do_get ( catalog  __c,
int  __set,
int  __msgid,
const wstring &  __dfault 
) const

Definition at line 149 of file messages.cpp.

150  {
151  typedef ctype<wchar_t> wctype;
152  const wctype& ct = use_facet<wctype>(_M_map->lookup(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]));
153 
154  const char* str = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "");
155 
156  // Verify that the lookup failed; an empty string might represent success.
157  if (!str)
158  return dfault;
159  else if (str[0] == '\0') {
160  const char* str2 = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "*");
161  if (!str2 || ((str2[0] == '*') && (str2[1] == '\0')))
162  return dfault;
163  }
164 
165  // str is correct. Now we must widen it to get a wstring.
166  size_t n = strlen(str);
167 
168  // NOT PORTABLE. What we're doing relies on internal details of the
169  // string implementation. (Contiguity of string elements.)
170  wstring result(n, wchar_t(0));
171  ct.widen(str, str + n, &*result.begin());
172  return result;
173 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble n
Definition: glext.h:7729
locale lookup(nl_catd_type key) const
Definition: messages.cpp:59
const char * _Locale_catgets(struct _Locale_messages *, nl_catd_type, int, int, const char *)
_Catalog_nl_catd_map _M_cat
const WCHAR * str
#define _STLP_MUTABLE(type, x)
Definition: features.h:634
_Catalog_locale_map * _M_map
wctype_t __cdecl wctype(const char *)
_Locale_messages * _M_message_obj
Definition: _set.h:46
GLuint64EXT * result
Definition: glext.h:11304

◆ do_open()

_Messages::catalog _Messages::do_open ( const string __fn,
const locale __loc 
) const

Definition at line 124 of file messages.cpp.

124  {
126  : (nl_catd_type)(-1);
127 
128  if ( result != (nl_catd_type)(-1) ) {
129  if ( _M_map != 0 ) {
130  _M_map->insert(result, L);
131  }
132  return _STLP_MUTABLE(_Messages_impl, _M_cat).insert( result );
133  }
134 
135  return -1;
136 }
void insert(nl_catd_type key, const locale &L)
Definition: messages.cpp:29
int nl_catd_type
Definition: c_locale.h:39
const char * filename
Definition: ioapi.h:135
_Catalog_nl_catd_map _M_cat
#define _STLP_MUTABLE(type, x)
Definition: features.h:634
_Catalog_locale_map * _M_map
static const WCHAR L[]
Definition: oid.c:1250
nl_catd_type _Locale_catopen(struct _Locale_messages *, const char *)
_Locale_messages * _M_message_obj
GLuint64EXT * result
Definition: glext.h:11304

◆ operator=()

Member Data Documentation

◆ _M_cat

_Catalog_nl_catd_map _Messages::_M_cat
mutableprivate

Definition at line 137 of file message_facets.h.

Referenced by do_close(), do_get(), and do_open().

◆ _M_map

_Catalog_locale_map* _Messages::_M_map
private

Definition at line 136 of file message_facets.h.

Referenced by _Messages(), do_close(), do_get(), do_open(), and ~_Messages().

◆ _M_message_obj

_Locale_messages* _Messages::_M_message_obj
private

Definition at line 135 of file message_facets.h.

Referenced by _Messages(), do_close(), do_get(), do_open(), and ~_Messages().


The documentation for this class was generated from the following files: