epoc32/include/stdapis/stlportv5/stl/_numpunct.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_numpunct.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_numpunct.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,22 +1,22 @@
     1.4  /*
     1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 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 + * Copyright (c) 1999
    1.13   * Boris Fomitchev
    1.14   *
    1.15   * This material is provided "as is", with absolutely no warranty expressed
    1.16   * or implied. Any use is at your own risk.
    1.17   *
    1.18 - * Permission to use or copy this software for any purpose is hereby granted 
    1.19 + * Permission to use or copy this software for any purpose is hereby granted
    1.20   * without fee, provided the above notices are retained on all copies.
    1.21   * Permission to modify the code and to distribute modified code is granted,
    1.22   * provided the above notices are retained, and a notice that the code was
    1.23   * modified is included with the above copyright notice.
    1.24   *
    1.25 - */ 
    1.26 + */
    1.27  // WARNING: This is an internal header file, included by other C++
    1.28  // standard library headers.  You should not attempt to use this header
    1.29  // file directly.
    1.30 @@ -33,7 +33,7 @@
    1.31  #  include <stl/c_locale.h>
    1.32  # endif
    1.33  
    1.34 -#ifndef _STLP_STRING_H
    1.35 +#ifndef _STLP_INTERNAL_STRING_H
    1.36  # include <stl/_string.h>
    1.37  #endif
    1.38  
    1.39 @@ -42,113 +42,24 @@
    1.40  //----------------------------------------------------------------------
    1.41  // numpunct facets
    1.42  
    1.43 -#ifdef	__SYMBIAN32__
    1.44 -extern locale::id& Numpunct_charT_GetFacetLocaleId(const char* type);
    1.45 -
    1.46 -template <class _CharT> class numpunct: public locale::facet
    1.47 -{
    1.48 -	friend class _Locale;
    1.49 -public:
    1.50 - 	typedef char               		char_type;
    1.51 -  	typedef basic_string<_CharT>             string_type;
    1.52 -	explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {
    1.53 -	_M_truename.append(1, (_CharT)'t');
    1.54 -	_M_truename.append(1, (_CharT)'r');
    1.55 -	_M_truename.append(1, (_CharT)'u');
    1.56 -	_M_truename.append(1, (_CharT)'e');
    1.57 -
    1.58 -	_M_falsename.append(1, (_CharT)'f');
    1.59 -	_M_falsename.append(1, (_CharT)'a');
    1.60 -	_M_falsename.append(1, (_CharT)'l');
    1.61 -	_M_falsename.append(1, (_CharT)'s');
    1.62 -	_M_falsename.append(1, (_CharT)'e');
    1.63 -	}
    1.64 -	
    1.65 -  	_CharT decimal_point() const { return do_decimal_point(); }
    1.66 -  	_CharT thousands_sep() const { return do_thousands_sep(); }
    1.67 -  	string grouping() const { return do_grouping(); }
    1.68 -  	string_type truename() const { return do_truename(); }
    1.69 -  	string_type falsename() const { return do_falsename(); }
    1.70 -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
    1.71 -	static locale::id& GetFacetLocaleId(){return Numpunct_charT_GetFacetLocaleId(typeid(_CharT).name()); }
    1.72 -#else
    1.73 -  	 static locale::id id;
    1.74 -#endif
    1.75 -
    1.76 -# ifndef _STLP_NO_FRIEND_TEMPLATES
    1.77 -protected:
    1.78 -# endif
    1.79 -	~numpunct();
    1.80 -
    1.81 -protected:
    1.82 -  	 static string_type  _M_truename;
    1.83 -  	static string_type  _M_falsename;
    1.84 -  	static string  _M_grouping;
    1.85 -protected:
    1.86 -
    1.87 -  	virtual _CharT do_decimal_point() const;
    1.88 -  	virtual _CharT do_thousands_sep() const;
    1.89 -  	virtual string do_grouping() const; 
    1.90 -  	virtual string_type do_truename() const;
    1.91 -  	virtual string_type do_falsename()  const;
    1.92 -};
    1.93 -
    1.94 -template <class _CharT>
    1.95 -basic_string<_CharT> numpunct<_CharT>::_M_truename;
    1.96 -template <class _CharT>
    1.97 -basic_string<_CharT> numpunct<_CharT>::_M_falsename;
    1.98 -template <class _CharT>
    1.99 -string numpunct<_CharT>::_M_grouping ;
   1.100 -
   1.101 -_STLP_DECLSPEC _Locale_numeric* __acquire_numericE(const char* );
   1.102 -_STLP_DECLSPEC void __release_numericE(_Locale_numeric* );
   1.103 -_STLP_DECLSPEC const char* _Locale_trueE(_Locale_numeric*);
   1.104 -_STLP_DECLSPEC const char* _Locale_falseE(_Locale_numeric*);
   1.105 -_STLP_DECLSPEC char _Locale_decimal_pointE(_Locale_numeric*);
   1.106 -_STLP_DECLSPEC char _Locale_thousands_sepE(_Locale_numeric*);
   1.107 -_STLP_DECLSPEC const char*_Locale_groupingE(_Locale_numeric*);
   1.108 -
   1.109 -template <class _CharT>
   1.110 -class numpunct_byname : public numpunct<_CharT>{
   1.111 -public:
   1.112 -	typedef _CharT                char_type;
   1.113 -  	typedef basic_string<_CharT>              string_type;
   1.114 -
   1.115 -  	explicit  numpunct_byname(const char* name, size_t refs = 0);	
   1.116 -protected:
   1.117 -
   1.118 -	   ~numpunct_byname();
   1.119 -
   1.120 -	 virtual _CharT   do_decimal_point() const;
   1.121 -  	 virtual _CharT   do_thousands_sep() const;
   1.122 -	  virtual string do_grouping()      const;
   1.123 -
   1.124 -private:
   1.125 -  	_Locale_numeric* _M_numeric;
   1.126 -};
   1.127 -
   1.128 -#else
   1.129  template <class _CharT> class numpunct {};
   1.130  template <class _CharT> class numpunct_byname {};
   1.131 -#endif
   1.132  template <class _Ch, class _InIt> class num_get;
   1.133  
   1.134  _STLP_TEMPLATE_NULL
   1.135 -#ifdef __SYMBIAN32__
   1.136 -class numpunct <char> : public locale::facet
   1.137 -#else
   1.138  class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
   1.139 +{
   1.140 +  friend class _Locale_impl;
   1.141 +
   1.142 +#ifndef _STLP_NO_FRIEND_TEMPLATES
   1.143 +  template <class _Ch, class _InIt> friend class num_get;
   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 +  explicit numpunct(size_t __refs = 0)
   1.156 +    : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
   1.157  
   1.158    char decimal_point() const { return do_decimal_point(); }
   1.159    char thousands_sep() const { return do_thousands_sep(); }
   1.160 @@ -156,30 +67,26 @@
   1.161    string truename() const { return do_truename(); }
   1.162    string falsename() const { return do_falsename(); }
   1.163  
   1.164 -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.165 -	_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.166 +#if defined(__SYMBIAN32__WSD__) 
   1.167 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.168 +#elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)    
   1.169 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.170 +  static locale::id id;        
   1.171  #else
   1.172 -  	_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.173 +  // NOTE: Symbian doesn't support exporting static data.  
   1.174 +  // Users of this class should use GetFacetLocaleId() to access the data member id  
   1.175 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.176  #endif
   1.177  
   1.178 -# ifndef _STLP_NO_FRIEND_TEMPLATES
   1.179 +#ifndef _STLP_NO_FRIEND_TEMPLATES
   1.180  protected:
   1.181 -# endif
   1.182 -  ~numpunct(){};
   1.183 -
   1.184 -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.185 -public:
   1.186 -  _STLP_STATIC_MEMBER_DECLSPEC static string&  GetNumPunct_M_truename();
   1.187 -  _STLP_STATIC_MEMBER_DECLSPEC static string&  GetNumPunct_M_falsename();
   1.188 -  _STLP_STATIC_MEMBER_DECLSPEC static string&  GetNumPunct_M_grouping();
   1.189 -#else
   1.190 -protected:
   1.191 -  _STLP_STATIC_MEMBER_DECLSPEC static string  _M_truename;
   1.192 -  _STLP_STATIC_MEMBER_DECLSPEC static string  _M_falsename;
   1.193 -  _STLP_STATIC_MEMBER_DECLSPEC static string  _M_grouping;
   1.194  #endif
   1.195  
   1.196 -protected:
   1.197 +  _STLP_DECLSPEC ~numpunct();
   1.198 +
   1.199 +  string  _M_truename;
   1.200 +  string  _M_falsename;
   1.201 +  string  _M_grouping;
   1.202  
   1.203    _STLP_DECLSPEC virtual char do_decimal_point() const;
   1.204    _STLP_DECLSPEC virtual char do_thousands_sep() const;
   1.205 @@ -191,18 +98,15 @@
   1.206  # if ! defined (_STLP_NO_WCHAR_T)
   1.207  
   1.208  _STLP_TEMPLATE_NULL
   1.209 -#ifdef __SYMBIAN32__
   1.210 -class numpunct<wchar_t> : public locale::facet
   1.211 -#else
   1.212  class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
   1.213 -#endif
   1.214  {
   1.215 -  friend class _Locale;
   1.216 +  friend class _Locale_impl;
   1.217  public:
   1.218    typedef wchar_t               char_type;
   1.219    typedef wstring               string_type;
   1.220  
   1.221 -  explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
   1.222 +  explicit numpunct(size_t __refs = 0)
   1.223 +    : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
   1.224  
   1.225    wchar_t decimal_point() const { return do_decimal_point(); }
   1.226    wchar_t thousands_sep() const { return do_thousands_sep(); }
   1.227 @@ -210,29 +114,27 @@
   1.228    wstring truename() const { return do_truename(); }
   1.229    wstring falsename() const { return do_falsename(); }
   1.230  
   1.231 -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.232 -    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.233 +#if defined(__SYMBIAN32__WSD__) 
   1.234 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.235 +#elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)    
   1.236 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.237 +  static locale::id id;         
   1.238  #else
   1.239 - 	_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.240 +  // NOTE: Symbian doesn't support exporting static data.  
   1.241 +  // Users of this class should use GetFacetLocaleId() to access the data member id  
   1.242 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.243  #endif
   1.244 +  
   1.245 +protected:
   1.246 +  wstring _M_truename;
   1.247 +  wstring _M_falsename;
   1.248 +  string _M_grouping;
   1.249  
   1.250 -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.251 -public:
   1.252 -  _STLP_STATIC_MEMBER_DECLSPEC static wstring&  GetNumPunct_M_Wchar_truename();
   1.253 -  _STLP_STATIC_MEMBER_DECLSPEC static wstring&  GetNumPunct_M_Wchar_falsename();
   1.254 -  _STLP_STATIC_MEMBER_DECLSPEC static string&  GetNumPunct_M_Wchar_grouping();
   1.255 -#else
   1.256 -protected:
   1.257 -  _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_truename;
   1.258 -  _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_falsename;
   1.259 -  _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
   1.260 -#endif
   1.261 -protected:
   1.262 -  ~numpunct() {}
   1.263 +  _STLP_DECLSPEC ~numpunct();
   1.264  
   1.265    _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
   1.266    _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
   1.267 -  _STLP_DECLSPEC virtual string do_grouping() const;
   1.268 +  _STLP_DECLSPEC virtual string  do_grouping() const;
   1.269    _STLP_DECLSPEC virtual wstring do_truename() const;
   1.270    _STLP_DECLSPEC virtual wstring do_falsename()  const;
   1.271  };
   1.272 @@ -245,18 +147,24 @@
   1.273    typedef char                char_type;
   1.274    typedef string              string_type;
   1.275  
   1.276 -  explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
   1.277 +  _STLP_DECLSPEC explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
   1.278  
   1.279  protected:
   1.280 +	
   1.281 +  _STLP_DECLSPEC ~numpunct_byname();
   1.282  
   1.283 -_STLP_DECLSPEC   ~numpunct_byname();
   1.284 -
   1.285 -_STLP_DECLSPEC   virtual char   do_decimal_point() const;
   1.286 +  _STLP_DECLSPEC virtual char   do_decimal_point() const;
   1.287    _STLP_DECLSPEC virtual char   do_thousands_sep() const;
   1.288 -_STLP_DECLSPEC   virtual string do_grouping()      const;
   1.289 +  _STLP_DECLSPEC virtual string do_grouping()      const;
   1.290  
   1.291  private:
   1.292    _Locale_numeric* _M_numeric;
   1.293 +
   1.294 +  //explicitely defined as private to avoid warnings:
   1.295 +  typedef numpunct_byname<char> _Self;
   1.296 +  numpunct_byname(_Self const&);
   1.297 +  _Self& operator = (_Self const&);
   1.298 +  friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
   1.299  };
   1.300  
   1.301  # ifndef _STLP_NO_WCHAR_T
   1.302 @@ -266,25 +174,27 @@
   1.303    typedef wchar_t               char_type;
   1.304    typedef wstring               string_type;
   1.305  
   1.306 -  explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
   1.307 +  _STLP_DECLSPEC explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
   1.308  
   1.309  protected:
   1.310  
   1.311 -_STLP_DECLSPEC   ~numpunct_byname();
   1.312 +  _STLP_DECLSPEC ~numpunct_byname();
   1.313  
   1.314 -_STLP_DECLSPEC   virtual wchar_t   do_decimal_point() const;
   1.315 +  _STLP_DECLSPEC virtual wchar_t   do_decimal_point() const;
   1.316    _STLP_DECLSPEC virtual wchar_t   do_thousands_sep() const;
   1.317 -_STLP_DECLSPEC   virtual string do_grouping() const;
   1.318 +  _STLP_DECLSPEC virtual string    do_grouping() const;
   1.319  
   1.320  private:
   1.321    _Locale_numeric* _M_numeric;
   1.322 +
   1.323 +  //explicitely defined as private to avoid warnings:
   1.324 +  typedef numpunct_byname<wchar_t> _Self;
   1.325 +  numpunct_byname(_Self const&);
   1.326 +  _Self& operator = (_Self const&);
   1.327  };
   1.328  
   1.329  # endif /* WCHAR_T */
   1.330  
   1.331 -#ifdef	__SYMBIAN32__
   1.332 -#include<stl/_numpunct.c>
   1.333 -#endif
   1.334  _STLP_END_NAMESPACE
   1.335  
   1.336  #endif /* _STLP_NUMPUNCT_H */