1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/src/locale_impl.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1138 @@
1.4 +/*
1.5 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.6 + *
1.7 + * Copyright (c) 1999
1.8 + * Silicon Graphics Computer Systems, Inc.
1.9 + *
1.10 + * Copyright (c) 1999
1.11 + * Boris Fomitchev
1.12 + *
1.13 + * This material is provided "as is", with absolutely no warranty expressed
1.14 + * or implied. Any use is at your own risk.
1.15 + *
1.16 + * Permission to use or copy this software for any purpose is hereby granted
1.17 + * without fee, provided the above notices are retained on all copies.
1.18 + * Permission to modify the code and to distribute modified code is granted,
1.19 + * provided the above notices are retained, and a notice that the code was
1.20 + * modified is included with the above copyright notice.
1.21 + *
1.22 + */
1.23 +#include "stlport_prefix.h"
1.24 +
1.25 +#include <locale>
1.26 +#include <typeinfo>
1.27 +#include <algorithm>
1.28 +#include <stdexcept>
1.29 +
1.30 +#include "c_locale.h"
1.31 +#include "aligned_buffer.h"
1.32 +#include "locale_impl.h"
1.33 +#include "message_facets.h"
1.34 +
1.35 +#if defined(__SYMBIAN32__WSD__)
1.36 +#include "libstdcppwsd.h"
1.37 +
1.38 +std::_Stl_aligned_buffer<std::_Locale_impl::Init>& get_Loc_init_buf()
1.39 + {
1.40 + return *(std::_Stl_aligned_buffer<std::_Locale_impl::Init> *)(get_libcpp_wsd().__Loc_init_buf);
1.41 + }
1.42 +
1.43 +#define __Loc_init_buf get_Loc_init_buf()
1.44 +#define _S_count get_Loc_init_S_count()
1.45 +#define _Index_lock get_locale_Index_lock()
1.46 +#define _S_index get_S_index()
1.47 +#define _S_max get_locale_id_S_max()
1.48 +#define _Stl_classic_locale get_Stl_classic_locale()
1.49 +#define _Stl_global_locale get_Stl_global_locale()
1.50 +
1.51 +#endif //__SYMBIAN32__WSD__
1.52 +
1.53 +_STLP_BEGIN_NAMESPACE
1.54 +
1.55 +#if defined(__SYMBIAN32__WSD__) && defined(_STLP_DEBUG)
1.56 +#define _Nameless *get_Nameless()
1.57 +#else
1.58 +static const string _Nameless("*");
1.59 +#endif
1.60 +
1.61 +static inline bool is_C_locale_name (const char* name)
1.62 +{ return ((name[0] == 'C') && (name[1] == 0)); }
1.63 +
1.64 +_Locale_impl * _STLP_CALL _copy_Locale_impl(_Locale_impl *loc)
1.65 +{
1.66 + _STLP_ASSERT( loc != 0 );
1.67 + loc->_M_incr();
1.68 + _Locale_impl *loc_new = new _Locale_impl(*loc);
1.69 + loc->_M_decr();
1.70 + return loc_new;
1.71 +}
1.72 +
1.73 +locale::facet * _STLP_CALL _get_facet(locale::facet *f)
1.74 +{
1.75 + if (f != 0)
1.76 + f->_M_incr();
1.77 + return f;
1.78 +}
1.79 +
1.80 +void _STLP_CALL _release_facet(locale::facet *&f)
1.81 +{
1.82 + if ((f != 0) && (f->_M_decr() == 0)) {
1.83 + delete f;
1.84 + f = 0;
1.85 + }
1.86 +}
1.87 +# if !defined(__SYMBIAN32__WSD__)
1.88 +# if !defined(__SYMBIAN32__NO_STATIC_IMPORTS__)
1.89 +_STLP_STATIC_MEMBER_DECLSPEC size_t locale::id::_S_max = 39;
1.90 +#else
1.91 +size_t locale::id::_S_max = 39;
1.92 +#endif
1.93 +# endif //__SYMBIAN32__WSD__
1.94 +
1.95 +static void _Stl_loc_assign_ids();
1.96 +
1.97 +#if !defined(__SYMBIAN32__WSD__)
1.98 +static _Stl_aligned_buffer<_Locale_impl::Init> __Loc_init_buf;
1.99 +#endif
1.100 +
1.101 +_Locale_impl::Init::Init() {
1.102 + if (_M_count()._M_incr() == 1) {
1.103 + _Locale_impl::_S_initialize();
1.104 + }
1.105 +}
1.106 +
1.107 +_Locale_impl::Init::~Init() {
1.108 + if (_M_count()._M_decr() == 0) {
1.109 + _Locale_impl::_S_uninitialize();
1.110 + }
1.111 +}
1.112 +
1.113 +_Refcount_Base& _Locale_impl::Init::_M_count() const {
1.114 +#if !defined(__SYMBIAN32__WSD__)
1.115 + static _Refcount_Base _S_count(0);
1.116 +#endif
1.117 + return _S_count;
1.118 +}
1.119 +
1.120 +_Locale_impl::_Locale_impl(const char* s)
1.121 + : _Refcount_Base(0), name(s), facets_vec() {
1.122 + facets_vec.reserve( locale::id::_S_max );
1.123 + new (&__Loc_init_buf) Init();
1.124 +}
1.125 +
1.126 +_Locale_impl::_Locale_impl( _Locale_impl const& locimpl )
1.127 + : _Refcount_Base(0), name(locimpl.name), facets_vec() {
1.128 + for_each( locimpl.facets_vec.begin(), locimpl.facets_vec.end(), _get_facet);
1.129 + facets_vec = locimpl.facets_vec;
1.130 + new (&__Loc_init_buf) Init();
1.131 +}
1.132 +
1.133 +_Locale_impl::_Locale_impl( size_t n, const char* s)
1.134 + : _Refcount_Base(0), name(s), facets_vec(n, 0) {
1.135 + new (&__Loc_init_buf) Init();
1.136 +}
1.137 +
1.138 +_Locale_impl::~_Locale_impl() {
1.139 + (&__Loc_init_buf)->~Init();
1.140 + for_each( facets_vec.begin(), facets_vec.end(), _release_facet);
1.141 +}
1.142 +
1.143 +// Initialization of the locale system. This must be called before
1.144 +// any locales are constructed. (Meaning that it must be called when
1.145 +// the I/O library itself is initialized.)
1.146 +void _STLP_CALL _Locale_impl::_S_initialize() {
1.147 +
1.148 +#if defined(__SYMBIAN32__WSD__)
1.149 + //initialize wsd obj pointer
1.150 + locale_impl_init();
1.151 +# endif
1.152 +
1.153 + _Stl_loc_assign_ids();
1.154 + make_classic_locale();
1.155 +
1.156 +#if defined(__SYMBIAN32__WSD__)
1.157 + global_iostream_init();
1.158 +# endif
1.159 +}
1.160 +
1.161 +// Release of the classic locale ressources. Has to be called after the last
1.162 +// locale destruction and not only after the classic locale destruction as
1.163 +// the facets can be shared between different facets.
1.164 +void _STLP_CALL _Locale_impl::_S_uninitialize() {
1.165 + //Not necessary anymore as classic facets are now 'normal' dynamically allocated
1.166 + //facets with a reference counter telling to _release_facet when the facet can be
1.167 + //deleted.
1.168 + //free_classic_locale();
1.169 +}
1.170 +
1.171 +// _Locale_impl non-inline member functions.
1.172 +void _STLP_CALL _Locale_impl::_M_throw_bad_cast() {
1.173 + _STLP_THROW(bad_cast());
1.174 +}
1.175 +
1.176 +void _Locale_impl::insert( _Locale_impl *from, const locale::id& n ) {
1.177 + size_t index = n._M_index;
1.178 + if (index > 0 && index < from->size()) {
1.179 + this->insert( from->facets_vec[index], index);
1.180 + }
1.181 +}
1.182 +
1.183 +locale::facet* _Locale_impl::insert(locale::facet *f, size_t index) {
1.184 + if (f == 0 || index == 0)
1.185 + return 0;
1.186 +
1.187 + if (index >= facets_vec.size()) {
1.188 + facets_vec.resize(index + 1);
1.189 + }
1.190 +
1.191 + if (f != facets_vec[index])
1.192 + {
1.193 + _release_facet(facets_vec[index]);
1.194 + facets_vec[index] = _get_facet(f);
1.195 + }
1.196 +
1.197 + return f;
1.198 +}
1.199 +
1.200 +#if !defined (__DMC__)
1.201 +_Locale_name_hint* _Locale_extract_hint(ctype_byname<char>* ct)
1.202 +{ return _Locale_get_ctype_hint(ct->_M_ctype); }
1.203 +_Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>* punct)
1.204 +{ return _Locale_get_numeric_hint(punct->_M_numeric); }
1.205 +# if defined (__GNUC__) && (__GNUC__ < 3)
1.206 +template <class _Ch, class _InIt>
1.207 +_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<_Ch, _InIt>* tget)
1.208 +# else
1.209 +_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >* tget)
1.210 +# endif
1.211 +{ return _Locale_get_time_hint(tget->_M_time); }
1.212 +_Locale_name_hint* _Locale_extract_hint(collate_byname<char>* coll)
1.213 +{ return _Locale_get_collate_hint(coll->_M_collate); }
1.214 +_Locale_name_hint* _Locale_extract_hint(moneypunct_byname<char, false>* money)
1.215 +{ return _Locale_get_monetary_hint(money->_M_monetary); }
1.216 +#endif
1.217 +
1.218 +//
1.219 +// <locale> content which is dependent on the name
1.220 +//
1.221 +#if defined(__SYMBIAN32__WSD__)
1.222 +#define id GetFacetLocaleId()
1.223 +#endif
1.224 +
1.225 +template <class Facet>
1.226 +static inline locale::facet* _Locale_insert(_Locale_impl *__that, Facet* f)
1.227 +{ return __that->insert(f, Facet::id._M_index); }
1.228 +
1.229 +/*
1.230 + * Six functions, one for each category. Each of them takes a
1.231 + * _Locale* and a name, constructs that appropriate category
1.232 + * facets by name, and inserts them into the locale.
1.233 + */
1.234 +_Locale_name_hint* _Locale_impl::insert_ctype_facets(const char* pname, _Locale_name_hint* hint) {
1.235 + char buf[_Locale_MAX_SIMPLE_NAME];
1.236 + _Locale_impl* i2 = locale::classic()._M_impl;
1.237 +
1.238 + if (pname == 0 || pname[0] == 0)
1.239 + pname = _Locale_ctype_default(buf);
1.240 +
1.241 + if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
1.242 + this->insert(i2, ctype<char>::id);
1.243 +#ifndef _STLP_NO_MBSTATE_T
1.244 + this->insert(i2, codecvt<char, char, mbstate_t>::id);
1.245 +#endif
1.246 +#ifndef _STLP_NO_WCHAR_T
1.247 + this->insert(i2, ctype<wchar_t>::id);
1.248 +# ifndef _STLP_NO_MBSTATE_T
1.249 + this->insert(i2, codecvt<wchar_t, char, mbstate_t>::id);
1.250 +# endif
1.251 +#endif
1.252 + } else {
1.253 + ctype<char>* ct = 0;
1.254 +#ifndef _STLP_NO_MBSTATE_T
1.255 + codecvt<char, char, mbstate_t>* cvt = 0;
1.256 +#endif
1.257 +#ifndef _STLP_NO_WCHAR_T
1.258 + ctype<wchar_t>* wct = 0;
1.259 + codecvt<wchar_t, char, mbstate_t>* wcvt = 0;
1.260 +#endif
1.261 + _STLP_TRY {
1.262 + ctype_byname<char> *ctbn = new ctype_byname<char>(pname, 0, hint);
1.263 + ct = ctbn;
1.264 +#if !defined (__DMC__)
1.265 + if (hint == 0) hint = _Locale_extract_hint(ctbn);
1.266 +#endif
1.267 +#ifndef _STLP_NO_MBSTATE_T
1.268 + cvt = new codecvt_byname<char, char, mbstate_t>(pname);
1.269 +#endif
1.270 +#ifndef _STLP_NO_WCHAR_T
1.271 + wct = new ctype_byname<wchar_t>(pname, 0, hint);
1.272 + wcvt = new codecvt_byname<wchar_t, char, mbstate_t>(pname, 0, hint);
1.273 +#endif
1.274 + }
1.275 +
1.276 +#ifndef _STLP_NO_WCHAR_T
1.277 +# ifdef _STLP_NO_MBSTATE_T
1.278 + _STLP_UNWIND(delete ct; delete wct; delete wcvt);
1.279 +# else
1.280 + _STLP_UNWIND(delete ct; delete wct; delete cvt; delete wcvt);
1.281 +# endif
1.282 +#else
1.283 +# ifdef _STLP_NO_MBSTATE_T
1.284 + _STLP_UNWIND(delete ct);
1.285 +# else
1.286 + _STLP_UNWIND(delete ct; delete cvt);
1.287 +# endif
1.288 +#endif
1.289 + _Locale_insert(this, ct);
1.290 +#ifndef _STLP_NO_MBSTATE_T
1.291 + _Locale_insert(this, cvt);
1.292 +#endif
1.293 +#ifndef _STLP_NO_WCHAR_T
1.294 + _Locale_insert(this, wct);
1.295 + _Locale_insert(this, wcvt);
1.296 +#endif
1.297 + }
1.298 + return hint;
1.299 +}
1.300 +
1.301 +_Locale_name_hint* _Locale_impl::insert_numeric_facets(const char* pname, _Locale_name_hint* hint) {
1.302 + _Locale_impl* i2 = locale::classic()._M_impl;
1.303 +
1.304 + numpunct<char>* punct = 0;
1.305 + num_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
1.306 + num_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
1.307 +#ifndef _STLP_NO_WCHAR_T
1.308 + numpunct<wchar_t>* wpunct = 0;
1.309 + num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
1.310 + num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
1.311 +#endif
1.312 +
1.313 + char buf[_Locale_MAX_SIMPLE_NAME];
1.314 + if (pname == 0 || pname[0] == 0)
1.315 + pname = _Locale_numeric_default(buf);
1.316 +
1.317 + if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
1.318 + this->insert(i2, numpunct<char>::id);
1.319 + this->insert(i2,
1.320 + num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
1.321 + this->insert(i2,
1.322 + num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
1.323 +#ifndef _STLP_NO_WCHAR_T
1.324 + this->insert(i2, numpunct<wchar_t>::id);
1.325 + this->insert(i2,
1.326 + num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
1.327 + this->insert(i2,
1.328 + num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
1.329 +#endif
1.330 + }
1.331 + else {
1.332 + _STLP_TRY {
1.333 + numpunct_byname<char> *punctbn = new numpunct_byname<char>(pname, 0, hint);
1.334 + punct = punctbn;
1.335 +#if !defined (__DMC__)
1.336 + if (hint == 0) hint = _Locale_extract_hint(punctbn);
1.337 +#endif
1.338 + get = new num_get<char, istreambuf_iterator<char, char_traits<char> > >;
1.339 + put = new num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
1.340 +#ifndef _STLP_NO_WCHAR_T
1.341 + wpunct = new numpunct_byname<wchar_t>(pname, 0, hint);
1.342 + wget = new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.343 + wput = new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.344 +#endif
1.345 + }
1.346 +#ifndef _STLP_NO_WCHAR_T
1.347 + _STLP_UNWIND(delete punct; delete wpunct; delete get; delete wget; delete put; delete wput);
1.348 +#else
1.349 + _STLP_UNWIND(delete punct; delete get;delete put);
1.350 +#endif
1.351 +
1.352 + _Locale_insert(this,punct);
1.353 + _Locale_insert(this,get);
1.354 + _Locale_insert(this,put);
1.355 +
1.356 +#ifndef _STLP_NO_WCHAR_T
1.357 + _Locale_insert(this,wpunct);
1.358 + _Locale_insert(this,wget);
1.359 + _Locale_insert(this,wput);
1.360 +#endif
1.361 + }
1.362 + return hint;
1.363 +}
1.364 +
1.365 +_Locale_name_hint* _Locale_impl::insert_time_facets(const char* pname, _Locale_name_hint* hint) {
1.366 + _Locale_impl* i2 = locale::classic()._M_impl;
1.367 + time_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
1.368 + time_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
1.369 +#ifndef _STLP_NO_WCHAR_T
1.370 + time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
1.371 + time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
1.372 +#endif
1.373 +
1.374 + char buf[_Locale_MAX_SIMPLE_NAME];
1.375 + if (pname == 0 || pname[0] == 0)
1.376 + pname = _Locale_time_default(buf);
1.377 +
1.378 + if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
1.379 +
1.380 + this->insert(i2,
1.381 + time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
1.382 + this->insert(i2,
1.383 + time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
1.384 +#ifndef _STLP_NO_WCHAR_T
1.385 + this->insert(i2,
1.386 + time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
1.387 + this->insert(i2,
1.388 + time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
1.389 +#endif
1.390 + } else {
1.391 + _STLP_TRY {
1.392 + time_get_byname<char, istreambuf_iterator<char, char_traits<char> > > *getbn =
1.393 + new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(pname, 0, hint);
1.394 + get = getbn;
1.395 +#if !defined (__DMC__)
1.396 + if (hint == 0) hint = _Locale_time_extract_hint(getbn);
1.397 +#endif
1.398 + put = new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >(pname, 0, hint);
1.399 +#ifndef _STLP_NO_WCHAR_T
1.400 + wget = new time_get_byname<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(pname, 0, hint);
1.401 + wput = new time_put_byname<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(pname, 0, hint);
1.402 +#endif
1.403 + }
1.404 +#ifndef _STLP_NO_WCHAR_T
1.405 + _STLP_UNWIND(delete get; delete wget; delete put; delete wput);
1.406 +#else
1.407 + _STLP_UNWIND(delete get; delete put);
1.408 +#endif
1.409 + _Locale_insert(this,get);
1.410 + _Locale_insert(this,put);
1.411 +#ifndef _STLP_NO_WCHAR_T
1.412 + _Locale_insert(this,wget);
1.413 + _Locale_insert(this,wput);
1.414 +#endif
1.415 + }
1.416 + return hint;
1.417 +}
1.418 +
1.419 +_Locale_name_hint* _Locale_impl::insert_collate_facets(const char* nam, _Locale_name_hint* hint) {
1.420 + _Locale_impl* i2 = locale::classic()._M_impl;
1.421 +
1.422 + collate<char> *col = 0;
1.423 +#ifndef _STLP_NO_WCHAR_T
1.424 + collate<wchar_t> *wcol = 0;
1.425 +#endif
1.426 +
1.427 + char buf[_Locale_MAX_SIMPLE_NAME];
1.428 + if (nam == 0 || nam[0] == 0)
1.429 + nam = _Locale_collate_default(buf);
1.430 +
1.431 + if (nam == 0 || nam[0] == 0 || is_C_locale_name(nam)) {
1.432 + this->insert(i2, collate<char>::id);
1.433 +#ifndef _STLP_NO_WCHAR_T
1.434 + this->insert(i2, collate<wchar_t>::id);
1.435 +#endif
1.436 + }
1.437 + else {
1.438 + _STLP_TRY {
1.439 + collate_byname<char> *colbn = new collate_byname<char>(nam, 0, hint);
1.440 + col = colbn;
1.441 +#if !defined (__DMC__)
1.442 + if (hint == 0) hint = _Locale_extract_hint(colbn);
1.443 +#endif
1.444 +#ifndef _STLP_NO_WCHAR_T
1.445 + wcol = new collate_byname<wchar_t>(nam, 0, hint);
1.446 +#endif
1.447 + }
1.448 +#ifndef _STLP_NO_WCHAR_T
1.449 + _STLP_UNWIND(delete col; delete wcol);
1.450 +#else
1.451 + _STLP_UNWIND(delete col);
1.452 +#endif
1.453 + _Locale_insert(this,col);
1.454 +#ifndef _STLP_NO_WCHAR_T
1.455 + _Locale_insert(this,wcol);
1.456 +#endif
1.457 + }
1.458 + return hint;
1.459 +}
1.460 +
1.461 +_Locale_name_hint* _Locale_impl::insert_monetary_facets(const char* pname, _Locale_name_hint* hint) {
1.462 + _Locale_impl* i2 = locale::classic()._M_impl;
1.463 +
1.464 + moneypunct<char, false> *punct = 0;
1.465 + moneypunct<char, true> *ipunct = 0;
1.466 + money_get<char, istreambuf_iterator<char, char_traits<char> > > *get = 0;
1.467 + money_put<char, ostreambuf_iterator<char, char_traits<char> > > *put = 0;
1.468 +
1.469 +#ifndef _STLP_NO_WCHAR_T
1.470 + moneypunct<wchar_t, false>* wpunct = 0;
1.471 + moneypunct<wchar_t, true>* wipunct = 0;
1.472 + money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wget = 0;
1.473 + money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > *wput = 0;
1.474 +#endif
1.475 +
1.476 + char buf[_Locale_MAX_SIMPLE_NAME];
1.477 + if (pname == 0 || pname[0] == 0)
1.478 + pname = _Locale_monetary_default(buf);
1.479 +
1.480 + if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
1.481 + this->insert(i2, moneypunct<char, false>::id);
1.482 + this->insert(i2, moneypunct<char, true>::id);
1.483 + this->insert(i2, money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
1.484 + this->insert(i2, money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
1.485 +#ifndef _STLP_NO_WCHAR_T
1.486 + this->insert(i2, moneypunct<wchar_t, false>::id);
1.487 + this->insert(i2, moneypunct<wchar_t, true>::id);
1.488 + this->insert(i2, money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
1.489 + this->insert(i2, money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
1.490 +#endif
1.491 + }
1.492 + else {
1.493 + _STLP_TRY {
1.494 + moneypunct_byname<char, false>* punctbn = new moneypunct_byname<char, false>(pname, 0, hint);
1.495 + punct = punctbn;
1.496 +#if !defined (__DMC__)
1.497 + if (hint == 0) hint = _Locale_extract_hint(punctbn);
1.498 +#endif
1.499 + ipunct = new moneypunct_byname<char, true>(pname, 0, hint);
1.500 + get = new money_get<char, istreambuf_iterator<char, char_traits<char> > >;
1.501 + put = new money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
1.502 +#ifndef _STLP_NO_WCHAR_T
1.503 + wpunct = new moneypunct_byname<wchar_t, false>(pname, 0, hint);
1.504 + wipunct = new moneypunct_byname<wchar_t, true>(pname, 0, hint);
1.505 + wget = new money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.506 + wput = new money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.507 +#endif
1.508 + }
1.509 +#ifndef _STLP_NO_WCHAR_T
1.510 + _STLP_UNWIND(delete punct; delete ipunct; delete wpunct; delete wipunct; delete get; delete wget; delete put; delete wput);
1.511 +#else
1.512 + _STLP_UNWIND(delete punct; delete ipunct; delete get; delete put);
1.513 +#endif
1.514 + _Locale_insert(this,punct);
1.515 + _Locale_insert(this,ipunct);
1.516 + _Locale_insert(this,get);
1.517 + _Locale_insert(this,put);
1.518 +#ifndef _STLP_NO_WCHAR_T
1.519 + _Locale_insert(this,wget);
1.520 + _Locale_insert(this,wpunct);
1.521 + _Locale_insert(this,wipunct);
1.522 + _Locale_insert(this,wput);
1.523 +#endif
1.524 + }
1.525 + return hint;
1.526 +}
1.527 +
1.528 +_Locale_name_hint* _Locale_impl::insert_messages_facets(const char* pname, _Locale_name_hint* hint) {
1.529 + _Locale_impl* i2 = locale::classic()._M_impl;
1.530 + messages<char> *msg = 0;
1.531 +#ifndef _STLP_NO_WCHAR_T
1.532 + messages<wchar_t> *wmsg = 0;
1.533 +#endif
1.534 +
1.535 + char buf[_Locale_MAX_SIMPLE_NAME];
1.536 + if (pname == 0 || pname[0] == 0)
1.537 + pname = _Locale_messages_default(buf);
1.538 +
1.539 + if (pname == 0 || pname[0] == 0 || is_C_locale_name(pname)) {
1.540 + this->insert(i2, messages<char>::id);
1.541 +#ifndef _STLP_NO_WCHAR_T
1.542 + this->insert(i2, messages<wchar_t>::id);
1.543 +#endif
1.544 + }
1.545 + else {
1.546 + _STLP_TRY {
1.547 + msg = new messages_byname<char>(pname, 0, hint);
1.548 +#ifndef _STLP_NO_WCHAR_T
1.549 + wmsg = new messages_byname<wchar_t>(pname, 0, hint);
1.550 +#endif
1.551 + }
1.552 +#ifndef _STLP_NO_WCHAR_T
1.553 + _STLP_UNWIND(delete msg; delete wmsg);
1.554 +#else
1.555 + _STLP_UNWIND(delete msg);
1.556 +#endif
1.557 + _Locale_insert(this,msg);
1.558 +#ifndef _STLP_NO_WCHAR_T
1.559 + _Locale_insert(this,wmsg);
1.560 +#endif
1.561 + }
1.562 + return hint;
1.563 +}
1.564 +
1.565 +static void _Stl_loc_assign_ids() {
1.566 + // This assigns ids to every facet that is a member of a category,
1.567 + // and also to money_get/put, num_get/put, and time_get/put
1.568 + // instantiated using ordinary pointers as the input/output
1.569 + // iterators. (The default is [io]streambuf_iterator.)
1.570 +
1.571 +#ifdef __SYMBIAN32__WSD__
1.572 + collate<char>::id._M_index = 1;
1.573 + ctype<char>::id._M_index = 2;
1.574 +
1.575 +#ifndef _STLP_NO_MBSTATE_T
1.576 + codecvt<char, char, mbstate_t>::id._M_index = 3;
1.577 +# ifndef _STLP_NO_WCHAR_T
1.578 + codecvt<wchar_t, char, mbstate_t>::id._M_index = 22;
1.579 +# endif
1.580 +#endif
1.581 + moneypunct<char, true>::id._M_index = 4;
1.582 + moneypunct<char, false>::id._M_index = 5;
1.583 + numpunct<char>::id._M_index = 6;
1.584 + messages<char>::id._M_index =7;
1.585 +
1.586 + collate<wchar_t>::id._M_index = 20;
1.587 + ctype<wchar_t>::id._M_index = 21;
1.588 + moneypunct<wchar_t, true>::id._M_index = 23;
1.589 + moneypunct<wchar_t, false>::id._M_index = 24;
1.590 + numpunct<wchar_t>::id._M_index = 25;
1.591 + messages<wchar_t>::id._M_index = 26;
1.592 +#endif
1.593 +
1.594 +
1.595 + money_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 8;
1.596 + //money_get<char, const char*>::id._M_index = 9;
1.597 + money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 10;
1.598 + //money_put<char, char*>::id._M_index = 11;
1.599 +
1.600 + num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
1.601 + //num_get<char, const char*>::id._M_index = 13;
1.602 + num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 14;
1.603 + //num_put<char, char*>::id._M_index = 15;
1.604 + time_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 16;
1.605 + //time_get<char, const char*>::id._M_index = 17;
1.606 + time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 18;
1.607 + //time_put<char, char*>::id._M_index = 19;
1.608 +
1.609 +#ifndef _STLP_NO_WCHAR_T
1.610 + money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 27;
1.611 + //money_get<wchar_t, const wchar_t*>::id._M_index = 28;
1.612 + money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 29;
1.613 + //money_put<wchar_t, wchar_t*>::id._M_index = 30;
1.614 +
1.615 + num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 31;
1.616 + //num_get<wchar_t, const wchar_t*>::id._M_index = 32;
1.617 + num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 33;
1.618 + //num_put<wchar_t, wchar_t*>::id._M_index = 34;
1.619 + time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 35;
1.620 + //time_get<wchar_t, const wchar_t*>::id._M_index = 36;
1.621 + time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 37;
1.622 + //time_put<wchar_t, wchar_t*>::id._M_index = 38;
1.623 +#endif
1.624 + // locale::id::_S_max = 39;
1.625 +}
1.626 +
1.627 +// To access those static instance use the getter below, they guaranty
1.628 +// a correct initialization.
1.629 +#if !defined(__SYMBIAN32__WSD__)
1.630 +static locale *_Stl_classic_locale = 0;
1.631 +static locale *_Stl_global_locale = 0;
1.632 +#endif
1.633 +
1.634 +static locale* _Stl_get_classic_locale() {
1.635 +#if !defined(__SYMBIAN32__WSD__)
1.636 + static _Locale_impl::Init init;
1.637 +#endif
1.638 + return _Stl_classic_locale;
1.639 +}
1.640 +
1.641 +static locale* _Stl_get_global_locale() {
1.642 +#if !defined(__SYMBIAN32__WSD__)
1.643 + static _Locale_impl::Init init;
1.644 +#endif
1.645 + return _Stl_global_locale;
1.646 +}
1.647 +
1.648 +#if defined (_STLP_MSVC) || defined (__ICL) || defined (__ISCPP__)
1.649 +/*
1.650 + * The following static variable needs to be initialized before STLport
1.651 + * users static variable in order for him to be able to use Standard
1.652 + * streams in its variable initialization.
1.653 + * This variable is here because MSVC do not allow to change the initialization
1.654 + * segment in a given translation unit, iostream.cpp already contains an
1.655 + * initialization segment specification.
1.656 + */
1.657 +# pragma warning (disable : 4073)
1.658 +# pragma init_seg(lib)
1.659 +#endif
1.660 +
1.661 +#if !defined(__SYMBIAN32__WSD__)
1.662 +static ios_base::Init _IosInit;
1.663 +#endif
1.664 +
1.665 +void _Locale_impl::make_classic_locale() {
1.666 + // This funcion will be called once: during build classic _Locale_impl
1.667 +
1.668 + // The classic locale contains every facet that belongs to a category.
1.669 + static _Stl_aligned_buffer<_Locale_impl> _Locale_classic_impl_buf;
1.670 + _Locale_impl *classic = new(&_Locale_classic_impl_buf) _Locale_impl("C");
1.671 +
1.672 + locale::facet* classic_facets[] = {
1.673 + 0,
1.674 + new collate<char>(1),
1.675 + new ctype<char>(0, false, 1),
1.676 +#ifndef _STLP_NO_MBSTATE_T
1.677 + new codecvt<char, char, mbstate_t>(1),
1.678 +#else
1.679 + 0,
1.680 +#endif
1.681 + new moneypunct<char, true>(1),
1.682 + new moneypunct<char, false>(1),
1.683 + new numpunct<char>(1),
1.684 + new messages<char>(new _STLP_PRIV _Messages()),
1.685 + new money_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
1.686 + 0,
1.687 + new money_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
1.688 + 0,
1.689 + new num_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
1.690 + 0,
1.691 + new num_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
1.692 + 0,
1.693 + new time_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
1.694 + 0,
1.695 + new time_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
1.696 + 0,
1.697 +#ifndef _STLP_NO_WCHAR_T
1.698 + new collate<wchar_t>(1),
1.699 + new ctype<wchar_t>(1),
1.700 +
1.701 +# ifndef _STLP_NO_MBSTATE_T
1.702 + new codecvt<wchar_t, char, mbstate_t>(1),
1.703 +# else
1.704 + 0,
1.705 +# endif
1.706 + new moneypunct<wchar_t, true>(1),
1.707 + new moneypunct<wchar_t, false>(1),
1.708 + new numpunct<wchar_t>(1),
1.709 + new messages<wchar_t>(new _STLP_PRIV _Messages()),
1.710 +
1.711 + new money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
1.712 + 0,
1.713 + new money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
1.714 + 0,
1.715 +
1.716 + new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
1.717 + 0,
1.718 + new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
1.719 + 0,
1.720 + new time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
1.721 + 0,
1.722 + new time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
1.723 + 0,
1.724 +#endif
1.725 + 0
1.726 + };
1.727 +
1.728 + const size_t nb_classic_facets = sizeof(classic_facets) / sizeof(locale::facet *);
1.729 + classic->facets_vec.reserve(nb_classic_facets);
1.730 + classic->facets_vec.assign(&classic_facets[0], &classic_facets[0] + nb_classic_facets);
1.731 +
1.732 +#if defined(__SYMBIAN32__WSD__)
1.733 + ::set_Stl_classic_locale(new (WSDAlloc(sizeof(locale))) locale(classic));
1.734 + ::set_Stl_global_locale (new (WSDAlloc(sizeof(locale))) locale(_copy_Locale_impl(classic)));
1.735 +#else
1.736 + static locale _Locale_classic(classic);
1.737 + _Stl_classic_locale = &_Locale_classic;
1.738 +
1.739 + static locale _Locale_global(_copy_Locale_impl(classic));
1.740 + _Stl_global_locale = &_Locale_global;
1.741 +#endif
1.742 +}
1.743 +
1.744 +#if defined (__BORLANDC__) && (__BORLANDC__ < 0x564)
1.745 +template <>
1.746 +_STLP_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.747 +/*
1.748 +template <>
1.749 +_STLP_DECLSPEC locale::id time_get<char, const char*>::id;
1.750 +*/
1.751 +
1.752 +template <>
1.753 +_STLP_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.754 +/*
1.755 +template <>
1.756 +_STLP_DECLSPEC locale::id time_put<char, char*>::id;
1.757 +*/
1.758 +
1.759 +# if !defined (_STLP_NO_WCHAR_T)
1.760 +template <>
1.761 +_STLP_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.762 +/*
1.763 +template <>
1.764 +_STLP_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id;
1.765 +*/
1.766 +
1.767 +template <>
1.768 +_STLP_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.769 +/*
1.770 +template <>
1.771 +_STLP_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id;
1.772 +*/
1.773 +# endif /* _STLP_NO_WCHAR_T */
1.774 +
1.775 +template <>
1.776 +_STLP_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.777 +/*
1.778 +template <>
1.779 +_STLP_DECLSPEC locale::id money_get<char, const char*>::id;
1.780 +*/
1.781 +
1.782 +template <>
1.783 +_STLP_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.784 +/*
1.785 +template <>
1.786 +_STLP_DECLSPEC locale::id money_put<char, char*>::id;
1.787 +*/
1.788 +
1.789 +# if !defined (_STLP_NO_WCHAR_T)
1.790 +template <>
1.791 +_STLP_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.792 +/*
1.793 +template <>
1.794 +_STLP_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id;
1.795 +*/
1.796 +
1.797 +template <>
1.798 +_STLP_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.799 +/*
1.800 +template <>
1.801 +_STLP_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id;
1.802 +*/
1.803 +# endif
1.804 +
1.805 +template <>
1.806 +_STLP_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.807 +/*
1.808 +template <>
1.809 +_STLP_DECLSPEC locale::id num_get<char, const char*>::id;
1.810 +*/
1.811 +
1.812 +# if !defined (STLP_NO_WCHAR_T)
1.813 +template <>
1.814 +_STLP_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.815 +/*
1.816 +template <>
1.817 +_STLP_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id;
1.818 +*/
1.819 +# endif
1.820 +
1.821 +template <>
1.822 +_STLP_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.823 +/*
1.824 +template <>
1.825 +_STLP_DECLSPEC locale::id num_put<char, char*>::id;
1.826 +*/
1.827 +
1.828 +# if !defined (_STLP_NO_WCHAR_T)
1.829 +template <>
1.830 +_STLP_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.831 +/*
1.832 +template <>
1.833 +_STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id;
1.834 +*/
1.835 +# endif
1.836 +#endif
1.837 +
1.838 +// Declarations of (non-template) facets' static data members
1.839 +# if defined(__SYMBIAN32__WSD__)
1.840 + /* no definitions */
1.841 +#elif defined (__EPOC32__)
1.842 +
1.843 +locale::id collate<char>::id = { 1 };
1.844 +locale::id ctype<char>::id = { 2 };
1.845 +
1.846 +#ifndef _STLP_NO_MBSTATE_T
1.847 +locale::id codecvt<char, char, mbstate_t>::id = { 3 };
1.848 +# ifndef _STLP_NO_WCHAR_T
1.849 +locale::id codecvt<wchar_t, char, mbstate_t>::id = { 22 };
1.850 +# endif
1.851 +#endif
1.852 +
1.853 +locale::id moneypunct<char, true>::id = { 4 };
1.854 +locale::id moneypunct<char, false>::id = { 5 };
1.855 +locale::id numpunct<char>::id = { 6 } ;
1.856 +locale::id messages<char>::id = { 7 };
1.857 +
1.858 +#ifndef _STLP_NO_WCHAR_T
1.859 +locale::id collate<wchar_t>::id = { 20 };
1.860 +locale::id ctype<wchar_t>::id = { 21 };
1.861 +
1.862 +locale::id moneypunct<wchar_t, true>::id = { 23 } ;
1.863 +locale::id moneypunct<wchar_t, false>::id = { 24 } ;
1.864 +
1.865 +locale::id numpunct<wchar_t>::id = { 25 };
1.866 +locale::id messages<wchar_t>::id = { 26 };
1.867 +#endif
1.868 +
1.869 +#if defined(__SYMBIAN32__NO_STATIC_IMPORTS__)
1.870 +//ACCESS FUNCTIONS
1.871 +_STLP_DECLSPEC locale::id& collate<char>::GetFacetLocaleId()
1.872 + {
1.873 + return collate<char>::id;
1.874 + }
1.875 +_STLP_DECLSPEC locale::id& ctype<char>::GetFacetLocaleId()
1.876 + {
1.877 + return ctype<char>::id;
1.878 + }
1.879 +#ifndef _STLP_NO_MBSTATE_T
1.880 +_STLP_DECLSPEC locale::id& codecvt<char, char, mbstate_t>::GetFacetLocaleId()
1.881 + {
1.882 + return codecvt<char, char, mbstate_t>::id;
1.883 + }
1.884 +# ifndef _STLP_NO_WCHAR_T
1.885 +_STLP_DECLSPEC locale::id& codecvt<wchar_t, char, mbstate_t>::GetFacetLocaleId()
1.886 + {
1.887 + return codecvt<wchar_t, char, mbstate_t>::id;
1.888 + }
1.889 +# endif
1.890 +#endif
1.891 +
1.892 +_STLP_DECLSPEC locale::id& moneypunct<char, true>::GetFacetLocaleId()
1.893 + {
1.894 + return moneypunct<char, true>::id;
1.895 + }
1.896 +_STLP_DECLSPEC locale::id& moneypunct<char, false>::GetFacetLocaleId()
1.897 + {
1.898 + return moneypunct<char, false>::id;
1.899 + }
1.900 +_STLP_DECLSPEC locale::id& numpunct<char>::GetFacetLocaleId()
1.901 + {
1.902 + return numpunct<char>::id;
1.903 + }
1.904 +_STLP_DECLSPEC locale::id& messages<char>::GetFacetLocaleId()
1.905 + {
1.906 + return messages<char>::id;
1.907 + }
1.908 +#ifndef _STLP_NO_WCHAR_T
1.909 +_STLP_DECLSPEC locale::id& collate<wchar_t>::GetFacetLocaleId()
1.910 + {
1.911 + return collate<wchar_t>::id;
1.912 + }
1.913 +_STLP_DECLSPEC locale::id& ctype<wchar_t>::GetFacetLocaleId()
1.914 + {
1.915 + return ctype<wchar_t>::id;
1.916 + }
1.917 +_STLP_DECLSPEC locale::id& moneypunct<wchar_t, true>::GetFacetLocaleId()
1.918 + {
1.919 + return moneypunct<wchar_t, true>::id;
1.920 + }
1.921 +_STLP_DECLSPEC locale::id& moneypunct<wchar_t, false>::GetFacetLocaleId()
1.922 + {
1.923 + return moneypunct<wchar_t, false>::id;
1.924 + }
1.925 +_STLP_DECLSPEC locale::id& numpunct<wchar_t>::GetFacetLocaleId()
1.926 + {
1.927 + return numpunct<wchar_t>::id;
1.928 + }
1.929 +_STLP_DECLSPEC locale::id& messages<wchar_t>::GetFacetLocaleId()
1.930 + {
1.931 + return messages<wchar_t>::id;
1.932 + }
1.933 +#endif
1.934 +template <>
1.935 +_STLP_DECLSPEC locale::id& money_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.936 + {
1.937 + return money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.938 + }
1.939 +template <>
1.940 +_STLP_DECLSPEC locale::id& money_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.941 + {
1.942 + return money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.943 + }
1.944 +# if !defined (_STLP_NO_WCHAR_T)
1.945 +template <>
1.946 +_STLP_DECLSPEC locale::id& money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.947 + {
1.948 + return money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.949 + }
1.950 +template <>
1.951 +_STLP_DECLSPEC locale::id& money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.952 + {
1.953 + return money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.954 + }
1.955 +# endif
1.956 +template <>
1.957 +_STLP_DECLSPEC locale::id& num_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.958 + {
1.959 + return num_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.960 + }
1.961 +# if !defined (STLP_NO_WCHAR_T)
1.962 +template <>
1.963 +_STLP_DECLSPEC locale::id& num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.964 + {
1.965 + return num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.966 + }
1.967 +# endif
1.968 +template <>
1.969 +_STLP_DECLSPEC locale::id& num_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.970 + {
1.971 + return num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.972 + }
1.973 +# if !defined (_STLP_NO_WCHAR_T)
1.974 +template <>
1.975 +_STLP_DECLSPEC locale::id& num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.976 + {
1.977 + return num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.978 + }
1.979 +# endif
1.980 +template <>
1.981 +_STLP_DECLSPEC locale::id&
1.982 +time_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.983 + {
1.984 + return time_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.985 + }
1.986 +template <>
1.987 +_STLP_DECLSPEC locale::id&
1.988 +time_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.989 + {
1.990 + return time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.991 + }
1.992 +# ifndef _STLP_NO_WCHAR_T
1.993 +template <>
1.994 +_STLP_DECLSPEC locale::id&
1.995 +time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.996 + {
1.997 + return time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.998 + }
1.999 +template <>
1.1000 +_STLP_DECLSPEC locale::id&
1.1001 +time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.1002 + {
1.1003 + return time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.1004 + }
1.1005 +# endif
1.1006 +
1.1007 +# endif // __SYMBIAN32__NO_STATIC_IMPORTS__
1.1008 +
1.1009 +
1.1010 +#else // original STLPort
1.1011 +
1.1012 +// size_t locale::id::_S_max = 39; // made before
1.1013 +
1.1014 +_STLP_STATIC_MEMBER_DECLSPEC locale::id collate<char>::id = { 1 };
1.1015 +_STLP_STATIC_MEMBER_DECLSPEC locale::id ctype<char>::id = { 2 };
1.1016 +
1.1017 +#ifndef _STLP_NO_MBSTATE_T
1.1018 +_STLP_STATIC_MEMBER_DECLSPEC locale::id codecvt<char, char, mbstate_t>::id = { 3 };
1.1019 +# ifndef _STLP_NO_WCHAR_T
1.1020 +_STLP_STATIC_MEMBER_DECLSPEC locale::id codecvt<wchar_t, char, mbstate_t>::id = { 22 };
1.1021 +# endif
1.1022 +#endif
1.1023 +
1.1024 +_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<char, true>::id = { 4 };
1.1025 +_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<char, false>::id = { 5 };
1.1026 +_STLP_STATIC_MEMBER_DECLSPEC locale::id numpunct<char>::id = { 6 } ;
1.1027 +_STLP_STATIC_MEMBER_DECLSPEC locale::id messages<char>::id = { 7 };
1.1028 +
1.1029 +#if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
1.1030 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id = { 8 };
1.1031 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id = { 10 };
1.1032 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id = { 12 };
1.1033 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id = { 14 };
1.1034 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id = { 16 };
1.1035 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id = { 18 };
1.1036 +/*
1.1037 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<char, const char*>::id = { 9 };
1.1038 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<char, char*>::id = { 11 };
1.1039 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<char, const char*>::id = { 13 };
1.1040 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<char, char*>::id = { 15 };
1.1041 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<char, const char*>::id = { 17 };
1.1042 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<char, char*>::id = { 19 };
1.1043 +*/
1.1044 +#endif
1.1045 +
1.1046 +#ifndef _STLP_NO_WCHAR_T
1.1047 +_STLP_STATIC_MEMBER_DECLSPEC locale::id collate<wchar_t>::id = { 20 };
1.1048 +_STLP_STATIC_MEMBER_DECLSPEC locale::id ctype<wchar_t>::id = { 21 };
1.1049 +
1.1050 +_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<wchar_t, true>::id = { 23 } ;
1.1051 +_STLP_STATIC_MEMBER_DECLSPEC locale::id moneypunct<wchar_t, false>::id = { 24 } ;
1.1052 +
1.1053 +_STLP_STATIC_MEMBER_DECLSPEC locale::id numpunct<wchar_t>::id = { 25 };
1.1054 +_STLP_STATIC_MEMBER_DECLSPEC locale::id messages<wchar_t>::id = { 26 };
1.1055 +
1.1056 +#if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
1.1057 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 27 };
1.1058 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 29 };
1.1059 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 31 };
1.1060 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id = { 33 };
1.1061 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 35 };
1.1062 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id = { 37 };
1.1063 +/*
1.1064 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id = { 28 };
1.1065 +_STLP_STATIC_MEMBER_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id = { 30 };
1.1066 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id = { 32 };
1.1067 +_STLP_STATIC_MEMBER_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id = { 34 };
1.1068 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id = { 36 };
1.1069 +_STLP_STATIC_MEMBER_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id = { 38 };
1.1070 +*/
1.1071 +# endif
1.1072 +#endif
1.1073 +# endif //!__SYMBIAN32__WSD__
1.1074 +
1.1075 +_STLP_DECLSPEC _Locale_impl* _STLP_CALL _get_Locale_impl(_Locale_impl *loc)
1.1076 +{
1.1077 + _STLP_ASSERT( loc != 0 );
1.1078 + loc->_M_incr();
1.1079 + return loc;
1.1080 +}
1.1081 +
1.1082 +void _STLP_CALL _release_Locale_impl(_Locale_impl *& loc)
1.1083 +{
1.1084 + _STLP_ASSERT( loc != 0 );
1.1085 + if (loc->_M_decr() == 0) {
1.1086 + if (*loc != *_Stl_classic_locale)
1.1087 + delete loc;
1.1088 + else
1.1089 + loc->~_Locale_impl();
1.1090 + loc = 0;
1.1091 + }
1.1092 +}
1.1093 +
1.1094 +_STLP_DECLSPEC _Locale_impl* _STLP_CALL _copy_Nameless_Locale_impl(_Locale_impl *loc)
1.1095 +{
1.1096 + _STLP_ASSERT( loc != 0 );
1.1097 + loc->_M_incr();
1.1098 + _Locale_impl *loc_new = new _Locale_impl(*loc);
1.1099 + loc->_M_decr();
1.1100 + loc_new->name = _Nameless;
1.1101 + return loc_new;
1.1102 +}
1.1103 +
1.1104 +#if defined(__SYMBIAN32__WSD__)
1.1105 +#undef id
1.1106 +#endif
1.1107 +
1.1108 +_STLP_END_NAMESPACE
1.1109 +
1.1110 +#if defined(__SYMBIAN32__WSD__)
1.1111 +void locale_impl_init()
1.1112 +{
1.1113 + //initialize _S_max
1.1114 + std::locale::id::get_locale_id_S_max() = 39;
1.1115 +
1.1116 + //initialize the mutex lock in locale.cpp
1.1117 + locale_index_lock_init();
1.1118 +
1.1119 + //initialize _S_count of Init
1.1120 + std::ios_base::Init::ios_base_Init_S_count_init();
1.1121 +
1.1122 + //initialize S_was_synced of ios_base
1.1123 + std::ios_base::ios_base_S_was_synced_init();
1.1124 +
1.1125 + //initialize the mutex in locale_catalog.cpp
1.1126 + stlp_priv::locale_catalog_category_hash_lock_init();
1.1127 +
1.1128 + //initialize category map in locale_catalog.cpp
1.1129 + stlp_priv::Category_Map_Init();
1.1130 +
1.1131 + //initialize empty string in monetary.cpp
1.1132 + monetary_empty_string_init();
1.1133 +}
1.1134 +# endif //__SYMBIAN32__WSD__
1.1135 +
1.1136 +
1.1137 +// locale use many static functions/pointers from this file:
1.1138 +// to avoid making ones extern, simple #include implementation of locale
1.1139 +
1.1140 +#include "locale.cpp"
1.1141 +