Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
locale_global.cpp
Go to the documentation of this file.
1
29#define _RWSTD_LIB_SRC
30
31#include <rw/_defs.h>
32#include <rw/_mutex.h>
33
34#include <locale.h>
35#include <string.h>
36
37#include <loc/_facet.h>
38#include <loc/_locale.h>
39
40#include "locale_body.h"
41
42
44
45extern __rw_mutex __rw_setlocale_mutex;
46
47} // namespace __rw
48
50
51/* static */ locale locale::global (const locale &rhs)
52{
53 _RWSTD_ASSERT (rhs._C_body);
54 _RWSTD_ASSERT (rhs._C_body->_C_name);
55
56 if (!strchr (rhs.name ().c_str (), '*')) {
57
58 // if the global locale has a name, call setlocale()
59
60 _RWSTD_MT_GUARD (_RW::__rw_setlocale_mutex);
61
62 // assumes all locale names (i.e., including those of combined
63 // locales) are in a format understandable by setlocale()
64 setlocale (_RWSTD_LC_ALL, rhs.name ().c_str ());
65
66 // FIXME:
67 // handle unnamed locales (i.e., locales containing non-standard
68 // facets)
69 }
70
71 // set the global locale to `body', retrieve the previous value
72 _RW::__rw_locale* const tmp = _RW::__rw_locale::_C_manage (rhs._C_body, 0);
73
74 _RWSTD_ASSERT (0 != tmp);
75
76 // do not decrement ref count here, done in dtor of the returned temporary
77 return locale (*tmp);
78}
79
80
81} // namespace std
#define rhs
Definition 17.names.cpp:536
#define tmp
Definition 17.names.cpp:553
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _RWSTD_MT_GUARD(ignore)
Definition _defs.h:695
#define _RWSTD_ASSERT(ignore)
Definition _defs.h:1108
Definition json.h:5363