1.1 --- a/epoc32/include/stdapis/stlport/stl/_locale.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_locale.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,259 @@
1.4 -_locale.h
1.5 +/*
1.6 + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.7 + *
1.8 + * Copyright (c) 1999
1.9 + * Silicon Graphics Computer Systems, Inc.
1.10 + *
1.11 + * Copyright (c) 1999
1.12 + * Boris Fomitchev
1.13 + *
1.14 + * This material is provided "as is", with absolutely no warranty expressed
1.15 + * or implied. Any use is at your own risk.
1.16 + *
1.17 + * Permission to use or copy this software for any purpose is hereby granted
1.18 + * without fee, provided the above notices are retained on all copies.
1.19 + * Permission to modify the code and to distribute modified code is granted,
1.20 + * provided the above notices are retained, and a notice that the code was
1.21 + * modified is included with the above copyright notice.
1.22 + *
1.23 + */
1.24 +// WARNING: This is an internal header file, included by other C++
1.25 +// standard library headers. You should not attempt to use this header
1.26 +// file directly.
1.27 +
1.28 +
1.29 +#ifndef _STLP_INTERNAL_LOCALE_H
1.30 +#define _STLP_INTERNAL_LOCALE_H
1.31 +
1.32 +#ifndef _STLP_CSTDLIB
1.33 +# include <cstdlib>
1.34 +#endif
1.35 +
1.36 +#ifndef _STLP_CWCHAR_H
1.37 +# include <stl/_cwchar.h>
1.38 +#endif
1.39 +
1.40 +#ifndef _STLP_INTERNAL_THREADS_H
1.41 +# include <stl/_threads.h>
1.42 +#endif
1.43 +
1.44 +#ifndef _STLP_STRING_FWD_H
1.45 +# include <stl/_string_fwd.h>
1.46 +#endif
1.47 +
1.48 +_STLP_BEGIN_NAMESPACE
1.49 +
1.50 +class _STLP_CLASS_DECLSPEC _Locale_impl; // Forward declaration of opaque type.
1.51 +class _STLP_CLASS_DECLSPEC _Locale; // Forward declaration of opaque type.
1.52 +class _STLP_CLASS_DECLSPEC locale;
1.53 +class _STLP_CLASS_DECLSPEC ios_base;
1.54 +
1.55 +
1.56 +template <class _CharT, class _Traits, class _Alloc>
1.57 +bool
1.58 +__locale_do_operator_call (const locale* __that,
1.59 + const basic_string<_CharT, _Traits, _Alloc >& __x,
1.60 + const basic_string<_CharT, _Traits, _Alloc >& __y);
1.61 +
1.62 +# define _BaseFacet locale::facet
1.63 +
1.64 +class _STLP_CLASS_DECLSPEC locale {
1.65 +public:
1.66 + // types:
1.67 +
1.68 + class
1.69 +#if defined (__SYMBIAN32__) || defined(__GCCE__)
1.70 + _STLP_CLASS_DECLSPEC
1.71 +#else
1.72 + _STLP_DECLSPEC
1.73 +#endif
1.74 + facet : private _Refcount_Base {
1.75 + protected:
1.76 + explicit facet(size_t __no_del = 0) : _Refcount_Base(1), _M_delete(__no_del == 0) {}
1.77 +
1.78 + _STLP_DECLSPEC virtual ~facet();
1.79 + friend class locale;
1.80 + friend class _Locale_impl;
1.81 + friend class _Locale;
1.82 +
1.83 + private: // Invalidate assignment and copying.
1.84 + facet(const facet& __f) : _Refcount_Base(1), _M_delete(__f._M_delete == 0) {};
1.85 + void operator=(const facet&);
1.86 +
1.87 + private: // Data members.
1.88 + const bool _M_delete;
1.89 + };
1.90 +
1.91 +#if defined(__MVS__) || defined(__OS400__)
1.92 + struct
1.93 +#else
1.94 + class
1.95 +#endif
1.96 + _STLP_DECLSPEC id {
1.97 + friend class locale;
1.98 + friend class _Locale_impl;
1.99 + public:
1.100 + size_t _M_index;
1.101 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.102 + static _STLP_STATIC_MEMBER_DECLSPEC size_t& get_locale_id_S_max();
1.103 +# else
1.104 + static size_t _S_max;
1.105 +# endif
1.106 + };
1.107 +
1.108 + typedef int category;
1.109 +# if defined (_STLP_STATIC_CONST_INIT_BUG)
1.110 + enum _Category {
1.111 +# else
1.112 + static const category
1.113 +# endif
1.114 + none = 0x000,
1.115 + collate = 0x010,
1.116 + ctype = 0x020,
1.117 + monetary = 0x040,
1.118 + numeric = 0x100,
1.119 + time = 0x200,
1.120 + messages = 0x400,
1.121 + all = collate | ctype | monetary | numeric | time | messages
1.122 +# if defined (_STLP_STATIC_CONST_INIT_BUG)
1.123 + }
1.124 +# endif
1.125 + ;
1.126 +
1.127 + // construct/copy/destroy:
1.128 + _STLP_DECLSPEC locale();
1.129 + _STLP_DECLSPEC locale(const locale&) _STLP_NOTHROW;
1.130 + explicit locale(const char *);
1.131 + locale(const locale&, const char*, category);
1.132 +
1.133 + // those are for internal use
1.134 + locale(_Locale_impl*);
1.135 + locale(_Locale_impl*, bool);
1.136 +
1.137 +public:
1.138 +
1.139 +# if defined ( _STLP_MEMBER_TEMPLATES ) /* && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) */
1.140 + template <class _Facet>
1.141 + locale(const locale& __loc, _Facet* __f) : _M_impl(0)
1.142 + {
1.143 + // _M_impl = this->_S_copy_impl(__loc._M_impl, __f != 0);
1.144 + new(this) locale(__loc._M_impl, __f != 0);
1.145 + if (__f != 0)
1.146 + this->_M_insert((facet*)__f, _Facet::GetFacetLocaleId());
1.147 + }
1.148 +# endif
1.149 +
1.150 + locale(const locale&, const locale&, category);
1.151 + _STLP_DECLSPEC ~locale() _STLP_NOTHROW;
1.152 + _STLP_DECLSPEC const locale& operator=(const locale&) _STLP_NOTHROW;
1.153 +
1.154 +# if !(defined (_STLP_NO_MEMBER_TEMPLATES) || defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS))
1.155 + template <class _Facet> locale combine(const locale& __loc) const{
1.156 + locale __result(__loc._M_impl, true);
1.157 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.158 + if (facet* __f = __loc._M_get_facet(_Facet::GetFacetLocaleId())) {
1.159 + __result._M_insert((facet*)__f, _Facet::GetFacetLocaleId());
1.160 +#else
1.161 + if (facet* __f = __loc._M_get_facet(_Facet::id)) {
1.162 + __result._M_insert((facet*)__f, _Facet::id);
1.163 +#endif
1.164 + __f->_M_incr();
1.165 + }
1.166 + else
1.167 + _M_throw_runtime_error();
1.168 + return __result;
1.169 + }
1.170 +# endif
1.171 + // locale operations:
1.172 + _STLP_DECLSPEC string name() const;
1.173 +
1.174 + _STLP_DECLSPEC bool operator==(const locale&) const;
1.175 + _STLP_DECLSPEC bool operator!=(const locale&) const;
1.176 +
1.177 +# if ! defined ( _STLP_MEMBER_TEMPLATES ) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301)
1.178 + bool operator()(const string& __x, const string& __y) const;
1.179 +# ifndef _STLP_NO_WCHAR_T
1.180 + bool operator()(const wstring& __x, const wstring& __y) const;
1.181 +# endif
1.182 +# else
1.183 + template <class _CharT, class _Traits, class _Alloc>
1.184 + bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
1.185 + const basic_string<_CharT, _Traits, _Alloc>& __y) const {
1.186 + return __locale_do_operator_call(this, __x, __y);
1.187 + }
1.188 +# endif
1.189 +
1.190 + // global locale objects:
1.191 + _STLP_DECLSPEC static locale _STLP_CALL global(const locale&);
1.192 + _STLP_DECLSPEC static const locale& _STLP_CALL classic();
1.193 +
1.194 +public: // Helper functions for locale globals.
1.195 + _STLP_DECLSPEC facet* _M_get_facet(const id&) const;
1.196 + // same, but throws
1.197 + _STLP_DECLSPEC facet* _M_use_facet(const id&) const;
1.198 + _STLP_DECLSPEC static void _STLP_CALL _M_throw_runtime_error(const char* = 0);
1.199 + static void _STLP_CALL _S_initialize();
1.200 + static void _STLP_CALL _S_uninitialize();
1.201 +
1.202 +private: // More helper functions.
1.203 + // static _Locale_impl* _STLP_CALL _S_copy_impl(_Locale_impl*, bool);
1.204 + _STLP_DECLSPEC void _M_insert(facet* __f, id& __id);
1.205 +
1.206 + // friends:
1.207 + friend class _Locale_impl;
1.208 + friend class _Locale;
1.209 + friend class ios_base;
1.210 +
1.211 +private: // Data members
1.212 + _Locale_impl* _M_impl;
1.213 +};
1.214 +
1.215 +//----------------------------------------------------------------------
1.216 +// locale globals
1.217 +
1.218 +# ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
1.219 +template <class _Facet>
1.220 +inline const _Facet&
1.221 +_Use_facet<_Facet>::operator *() const
1.222 +# else
1.223 +template <class _Facet> inline const _Facet& use_facet(const locale& __loc)
1.224 +# endif
1.225 +{
1.226 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.227 + return *__STATIC_CAST(const _Facet*,__loc._M_use_facet(_Facet::GetFacetLocaleId()));
1.228 +#else
1.229 + return *__STATIC_CAST(const _Facet*,__loc._M_use_facet(_Facet::id));
1.230 +#endif
1.231 +}
1.232 +
1.233 +
1.234 +# ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
1.235 +template <class _Facet>
1.236 +struct has_facet {
1.237 + const locale& __loc;
1.238 + has_facet(const locale& __p_loc) : __loc(__p_loc) {}
1.239 + operator bool() const _STLP_NOTHROW
1.240 +# else
1.241 +template <class _Facet> inline bool has_facet(const locale& __loc) _STLP_NOTHROW
1.242 +# endif
1.243 +{
1.244 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.245 + return (__loc._M_get_facet(_Facet::GetFacetLocaleId()) != 0);
1.246 +#else
1.247 + return (__loc._M_get_facet(_Facet::id) != 0);
1.248 +#endif
1.249 +}
1.250 +
1.251 +# ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
1.252 + // close class definition
1.253 +};
1.254 +# endif
1.255 +
1.256 +_STLP_END_NAMESPACE
1.257 +
1.258 +#endif /* _STLP_INTERNAL_LOCALE_H */
1.259 +
1.260 +// Local Variables:
1.261 +// mode:C++
1.262 +// End:
1.263 +