epoc32/include/stdapis/stlportv5/stl/_numpunct.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     3  *
     4  * Copyright (c) 1999
     5  * Silicon Graphics Computer Systems, Inc.
     6  *
     7  * Copyright (c) 1999
     8  * Boris Fomitchev
     9  *
    10  * This material is provided "as is", with absolutely no warranty expressed
    11  * or implied. Any use is at your own risk.
    12  *
    13  * Permission to use or copy this software for any purpose is hereby granted
    14  * without fee, provided the above notices are retained on all copies.
    15  * Permission to modify the code and to distribute modified code is granted,
    16  * provided the above notices are retained, and a notice that the code was
    17  * modified is included with the above copyright notice.
    18  *
    19  */
    20 // WARNING: This is an internal header file, included by other C++
    21 // standard library headers.  You should not attempt to use this header
    22 // file directly.
    23 
    24 
    25 #ifndef _STLP_INTERNAL_NUMPUNCT_H
    26 #define _STLP_INTERNAL_NUMPUNCT_H
    27 
    28 #ifndef _STLP_IOS_BASE_H
    29 # include <stl/_ios_base.h>
    30 #endif
    31 
    32 # ifndef _STLP_C_LOCALE_H
    33 #  include <stl/c_locale.h>
    34 # endif
    35 
    36 #ifndef _STLP_INTERNAL_STRING_H
    37 # include <stl/_string.h>
    38 #endif
    39 
    40 _STLP_BEGIN_NAMESPACE
    41 
    42 //----------------------------------------------------------------------
    43 // numpunct facets
    44 
    45 template <class _CharT> class numpunct {};
    46 template <class _CharT> class numpunct_byname {};
    47 template <class _Ch, class _InIt> class num_get;
    48 
    49 _STLP_TEMPLATE_NULL
    50 class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
    51 {
    52   friend class _Locale_impl;
    53 
    54 #ifndef _STLP_NO_FRIEND_TEMPLATES
    55   template <class _Ch, class _InIt> friend class num_get;
    56 #endif
    57 public:
    58   typedef char               char_type;
    59   typedef string             string_type;
    60 
    61   explicit numpunct(size_t __refs = 0)
    62     : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
    63 
    64   char decimal_point() const { return do_decimal_point(); }
    65   char thousands_sep() const { return do_thousands_sep(); }
    66   string grouping() const { return do_grouping(); }
    67   string truename() const { return do_truename(); }
    68   string falsename() const { return do_falsename(); }
    69 
    70 #if defined(__SYMBIAN32__WSD__) 
    71   _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
    72 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)    
    73   _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
    74   static locale::id id;        
    75 #else
    76   // NOTE: Symbian doesn't support exporting static data.  
    77   // Users of this class should use GetFacetLocaleId() to access the data member id  
    78   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
    79 #endif
    80 
    81 #ifndef _STLP_NO_FRIEND_TEMPLATES
    82 protected:
    83 #endif
    84 
    85   _STLP_DECLSPEC ~numpunct();
    86 
    87   string  _M_truename;
    88   string  _M_falsename;
    89   string  _M_grouping;
    90 
    91   _STLP_DECLSPEC virtual char do_decimal_point() const;
    92   _STLP_DECLSPEC virtual char do_thousands_sep() const;
    93   _STLP_DECLSPEC virtual string do_grouping() const;
    94   _STLP_DECLSPEC virtual string do_truename() const;
    95   _STLP_DECLSPEC virtual string do_falsename()  const;
    96 };
    97 
    98 # if ! defined (_STLP_NO_WCHAR_T)
    99 
   100 _STLP_TEMPLATE_NULL
   101 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
   102 {
   103   friend class _Locale_impl;
   104 public:
   105   typedef wchar_t               char_type;
   106   typedef wstring               string_type;
   107 
   108   explicit numpunct(size_t __refs = 0)
   109     : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
   110 
   111   wchar_t decimal_point() const { return do_decimal_point(); }
   112   wchar_t thousands_sep() const { return do_thousands_sep(); }
   113   string grouping() const { return do_grouping(); }
   114   wstring truename() const { return do_truename(); }
   115   wstring falsename() const { return do_falsename(); }
   116 
   117 #if defined(__SYMBIAN32__WSD__) 
   118   _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   119 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)    
   120   _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   121   static locale::id id;         
   122 #else
   123   // NOTE: Symbian doesn't support exporting static data.  
   124   // Users of this class should use GetFacetLocaleId() to access the data member id  
   125   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   126 #endif
   127   
   128 protected:
   129   wstring _M_truename;
   130   wstring _M_falsename;
   131   string _M_grouping;
   132 
   133   _STLP_DECLSPEC ~numpunct();
   134 
   135   _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
   136   _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
   137   _STLP_DECLSPEC virtual string  do_grouping() const;
   138   _STLP_DECLSPEC virtual wstring do_truename() const;
   139   _STLP_DECLSPEC virtual wstring do_falsename()  const;
   140 };
   141 
   142 # endif /* WCHAR_T */
   143 
   144 _STLP_TEMPLATE_NULL
   145 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
   146 public:
   147   typedef char                char_type;
   148   typedef string              string_type;
   149 
   150   _STLP_DECLSPEC explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
   151 
   152 protected:
   153 	
   154   _STLP_DECLSPEC ~numpunct_byname();
   155 
   156   _STLP_DECLSPEC virtual char   do_decimal_point() const;
   157   _STLP_DECLSPEC virtual char   do_thousands_sep() const;
   158   _STLP_DECLSPEC virtual string do_grouping()      const;
   159 
   160 private:
   161   _Locale_numeric* _M_numeric;
   162 
   163   //explicitely defined as private to avoid warnings:
   164   typedef numpunct_byname<char> _Self;
   165   numpunct_byname(_Self const&);
   166   _Self& operator = (_Self const&);
   167   friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
   168 };
   169 
   170 # ifndef _STLP_NO_WCHAR_T
   171 _STLP_TEMPLATE_NULL
   172 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
   173 public:
   174   typedef wchar_t               char_type;
   175   typedef wstring               string_type;
   176 
   177   _STLP_DECLSPEC explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
   178 
   179 protected:
   180 
   181   _STLP_DECLSPEC ~numpunct_byname();
   182 
   183   _STLP_DECLSPEC virtual wchar_t   do_decimal_point() const;
   184   _STLP_DECLSPEC virtual wchar_t   do_thousands_sep() const;
   185   _STLP_DECLSPEC virtual string    do_grouping() const;
   186 
   187 private:
   188   _Locale_numeric* _M_numeric;
   189 
   190   //explicitely defined as private to avoid warnings:
   191   typedef numpunct_byname<wchar_t> _Self;
   192   numpunct_byname(_Self const&);
   193   _Self& operator = (_Self const&);
   194 };
   195 
   196 # endif /* WCHAR_T */
   197 
   198 _STLP_END_NAMESPACE
   199 
   200 #endif /* _STLP_NUMPUNCT_H */
   201 
   202 // Local Variables:
   203 // mode:C++
   204 // End:
   205