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