1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_numpunct.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,295 @@
1.4 +/*
1.5 + * © Portions copyright (c) 2006-2007 Nokia Corporation. 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 +// WARNING: This is an internal header file, included by other C++
1.24 +// standard library headers. You should not attempt to use this header
1.25 +// file directly.
1.26 +
1.27 +
1.28 +#ifndef _STLP_INTERNAL_NUMPUNCT_H
1.29 +#define _STLP_INTERNAL_NUMPUNCT_H
1.30 +
1.31 +#ifndef _STLP_IOS_BASE_H
1.32 +# include <stl/_ios_base.h>
1.33 +#endif
1.34 +
1.35 +# ifndef _STLP_C_LOCALE_H
1.36 +# include <stl/c_locale.h>
1.37 +# endif
1.38 +
1.39 +#ifndef _STLP_STRING_H
1.40 +# include <stl/_string.h>
1.41 +#endif
1.42 +
1.43 +_STLP_BEGIN_NAMESPACE
1.44 +
1.45 +//----------------------------------------------------------------------
1.46 +// numpunct facets
1.47 +
1.48 +#ifdef __SYMBIAN32__
1.49 +extern locale::id& Numpunct_charT_GetFacetLocaleId(const char* type);
1.50 +
1.51 +template <class _CharT> class numpunct: public locale::facet
1.52 +{
1.53 + friend class _Locale;
1.54 +public:
1.55 + typedef char char_type;
1.56 + typedef basic_string<_CharT> string_type;
1.57 + explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {
1.58 + _M_truename.append(1, (_CharT)'t');
1.59 + _M_truename.append(1, (_CharT)'r');
1.60 + _M_truename.append(1, (_CharT)'u');
1.61 + _M_truename.append(1, (_CharT)'e');
1.62 +
1.63 + _M_falsename.append(1, (_CharT)'f');
1.64 + _M_falsename.append(1, (_CharT)'a');
1.65 + _M_falsename.append(1, (_CharT)'l');
1.66 + _M_falsename.append(1, (_CharT)'s');
1.67 + _M_falsename.append(1, (_CharT)'e');
1.68 + }
1.69 +
1.70 + _CharT decimal_point() const { return do_decimal_point(); }
1.71 + _CharT thousands_sep() const { return do_thousands_sep(); }
1.72 + string grouping() const { return do_grouping(); }
1.73 + string_type truename() const { return do_truename(); }
1.74 + string_type falsename() const { return do_falsename(); }
1.75 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.76 + static locale::id& GetFacetLocaleId(){return Numpunct_charT_GetFacetLocaleId(typeid(_CharT).name()); }
1.77 +#else
1.78 + static locale::id id;
1.79 +#endif
1.80 +
1.81 +# ifndef _STLP_NO_FRIEND_TEMPLATES
1.82 +protected:
1.83 +# endif
1.84 + ~numpunct();
1.85 +
1.86 +protected:
1.87 + static string_type _M_truename;
1.88 + static string_type _M_falsename;
1.89 + static string _M_grouping;
1.90 +protected:
1.91 +
1.92 + virtual _CharT do_decimal_point() const;
1.93 + virtual _CharT do_thousands_sep() const;
1.94 + virtual string do_grouping() const;
1.95 + virtual string_type do_truename() const;
1.96 + virtual string_type do_falsename() const;
1.97 +};
1.98 +
1.99 +template <class _CharT>
1.100 +basic_string<_CharT> numpunct<_CharT>::_M_truename;
1.101 +template <class _CharT>
1.102 +basic_string<_CharT> numpunct<_CharT>::_M_falsename;
1.103 +template <class _CharT>
1.104 +string numpunct<_CharT>::_M_grouping ;
1.105 +
1.106 +_STLP_DECLSPEC _Locale_numeric* __acquire_numericE(const char* );
1.107 +_STLP_DECLSPEC void __release_numericE(_Locale_numeric* );
1.108 +_STLP_DECLSPEC const char* _Locale_trueE(_Locale_numeric*);
1.109 +_STLP_DECLSPEC const char* _Locale_falseE(_Locale_numeric*);
1.110 +_STLP_DECLSPEC char _Locale_decimal_pointE(_Locale_numeric*);
1.111 +_STLP_DECLSPEC char _Locale_thousands_sepE(_Locale_numeric*);
1.112 +_STLP_DECLSPEC const char*_Locale_groupingE(_Locale_numeric*);
1.113 +
1.114 +template <class _CharT>
1.115 +class numpunct_byname : public numpunct<_CharT>{
1.116 +public:
1.117 + typedef _CharT char_type;
1.118 + typedef basic_string<_CharT> string_type;
1.119 +
1.120 + explicit numpunct_byname(const char* name, size_t refs = 0);
1.121 +protected:
1.122 +
1.123 + ~numpunct_byname();
1.124 +
1.125 + virtual _CharT do_decimal_point() const;
1.126 + virtual _CharT do_thousands_sep() const;
1.127 + virtual string do_grouping() const;
1.128 +
1.129 +private:
1.130 + _Locale_numeric* _M_numeric;
1.131 +};
1.132 +
1.133 +#else
1.134 +template <class _CharT> class numpunct {};
1.135 +template <class _CharT> class numpunct_byname {};
1.136 +#endif
1.137 +template <class _Ch, class _InIt> class num_get;
1.138 +
1.139 +_STLP_TEMPLATE_NULL
1.140 +#ifdef __SYMBIAN32__
1.141 +class numpunct <char> : public locale::facet
1.142 +#else
1.143 +class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
1.144 +#endif
1.145 +{
1.146 + friend class _Locale;
1.147 +# ifndef _STLP_NO_FRIEND_TEMPLATES
1.148 + template <class _Ch, class _InIt> friend class num_get;
1.149 +# endif
1.150 +public:
1.151 + typedef char char_type;
1.152 + typedef string string_type;
1.153 +
1.154 + explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
1.155 +
1.156 + char decimal_point() const { return do_decimal_point(); }
1.157 + char thousands_sep() const { return do_thousands_sep(); }
1.158 + string grouping() const { return do_grouping(); }
1.159 + string truename() const { return do_truename(); }
1.160 + string falsename() const { return do_falsename(); }
1.161 +
1.162 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.163 + _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
1.164 +#else
1.165 + _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
1.166 +#endif
1.167 +
1.168 +# ifndef _STLP_NO_FRIEND_TEMPLATES
1.169 +protected:
1.170 +# endif
1.171 + ~numpunct(){};
1.172 +
1.173 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.174 +public:
1.175 + _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_truename();
1.176 + _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_falsename();
1.177 + _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_grouping();
1.178 +#else
1.179 +protected:
1.180 + _STLP_STATIC_MEMBER_DECLSPEC static string _M_truename;
1.181 + _STLP_STATIC_MEMBER_DECLSPEC static string _M_falsename;
1.182 + _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
1.183 +#endif
1.184 +
1.185 +protected:
1.186 +
1.187 + _STLP_DECLSPEC virtual char do_decimal_point() const;
1.188 + _STLP_DECLSPEC virtual char do_thousands_sep() const;
1.189 + _STLP_DECLSPEC virtual string do_grouping() const;
1.190 + _STLP_DECLSPEC virtual string do_truename() const;
1.191 + _STLP_DECLSPEC virtual string do_falsename() const;
1.192 +};
1.193 +
1.194 +# if ! defined (_STLP_NO_WCHAR_T)
1.195 +
1.196 +_STLP_TEMPLATE_NULL
1.197 +#ifdef __SYMBIAN32__
1.198 +class numpunct<wchar_t> : public locale::facet
1.199 +#else
1.200 +class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
1.201 +#endif
1.202 +{
1.203 + friend class _Locale;
1.204 +public:
1.205 + typedef wchar_t char_type;
1.206 + typedef wstring string_type;
1.207 +
1.208 + explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
1.209 +
1.210 + wchar_t decimal_point() const { return do_decimal_point(); }
1.211 + wchar_t thousands_sep() const { return do_thousands_sep(); }
1.212 + string grouping() const { return do_grouping(); }
1.213 + wstring truename() const { return do_truename(); }
1.214 + wstring falsename() const { return do_falsename(); }
1.215 +
1.216 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.217 + _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
1.218 +#else
1.219 + _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
1.220 +#endif
1.221 +
1.222 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.223 +public:
1.224 + _STLP_STATIC_MEMBER_DECLSPEC static wstring& GetNumPunct_M_Wchar_truename();
1.225 + _STLP_STATIC_MEMBER_DECLSPEC static wstring& GetNumPunct_M_Wchar_falsename();
1.226 + _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_Wchar_grouping();
1.227 +#else
1.228 +protected:
1.229 + _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_truename;
1.230 + _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_falsename;
1.231 + _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
1.232 +#endif
1.233 +protected:
1.234 + ~numpunct() {}
1.235 +
1.236 + _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
1.237 + _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
1.238 + _STLP_DECLSPEC virtual string do_grouping() const;
1.239 + _STLP_DECLSPEC virtual wstring do_truename() const;
1.240 + _STLP_DECLSPEC virtual wstring do_falsename() const;
1.241 +};
1.242 +
1.243 +# endif /* WCHAR_T */
1.244 +
1.245 +_STLP_TEMPLATE_NULL
1.246 +class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
1.247 +public:
1.248 + typedef char char_type;
1.249 + typedef string string_type;
1.250 +
1.251 + explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
1.252 +
1.253 +protected:
1.254 +
1.255 +_STLP_DECLSPEC ~numpunct_byname();
1.256 +
1.257 +_STLP_DECLSPEC virtual char do_decimal_point() const;
1.258 + _STLP_DECLSPEC virtual char do_thousands_sep() const;
1.259 +_STLP_DECLSPEC virtual string do_grouping() const;
1.260 +
1.261 +private:
1.262 + _Locale_numeric* _M_numeric;
1.263 +};
1.264 +
1.265 +# ifndef _STLP_NO_WCHAR_T
1.266 +_STLP_TEMPLATE_NULL
1.267 +class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
1.268 +public:
1.269 + typedef wchar_t char_type;
1.270 + typedef wstring string_type;
1.271 +
1.272 + explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
1.273 +
1.274 +protected:
1.275 +
1.276 +_STLP_DECLSPEC ~numpunct_byname();
1.277 +
1.278 +_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
1.279 + _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
1.280 +_STLP_DECLSPEC virtual string do_grouping() const;
1.281 +
1.282 +private:
1.283 + _Locale_numeric* _M_numeric;
1.284 +};
1.285 +
1.286 +# endif /* WCHAR_T */
1.287 +
1.288 +#ifdef __SYMBIAN32__
1.289 +#include<stl/_numpunct.c>
1.290 +#endif
1.291 +_STLP_END_NAMESPACE
1.292 +
1.293 +#endif /* _STLP_NUMPUNCT_H */
1.294 +
1.295 +// Local Variables:
1.296 +// mode:C++
1.297 +// End:
1.298 +