epoc32/include/stdapis/stlportv5/stl/_messages_facets.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 
    21 // WARNING: This is an internal header file, included by other C++
    22 // standard library headers.  You should not attempt to use this header
    23 // file directly.
    24 
    25 
    26 #ifndef _STLP_INTERNAL_MESSAGES_H
    27 #define _STLP_INTERNAL_MESSAGES_H
    28 
    29 #ifndef _STLP_IOS_BASE_H
    30 #  include <stl/_ios_base.h>
    31 #endif
    32 
    33 #ifndef _STLP_C_LOCALE_H
    34 #  include <stl/c_locale.h>
    35 #endif
    36 
    37 #ifndef _STLP_INTERNAL_STRING_H
    38 #  include <stl/_string.h>
    39 #endif
    40 
    41 _STLP_BEGIN_NAMESPACE
    42 
    43 // messages facets
    44 
    45 class messages_base {
    46   public:
    47     typedef int catalog;
    48 };
    49 
    50 template <class _CharT> class messages {};
    51 
    52 _STLP_MOVE_TO_PRIV_NAMESPACE
    53 class _Messages;
    54 _STLP_MOVE_TO_STD_NAMESPACE
    55 
    56 _STLP_TEMPLATE_NULL
    57 class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
    58   friend class _Locale_impl;
    59 public:
    60   typedef messages_base::catalog catalog;
    61   typedef char                   char_type;
    62   typedef string    string_type;
    63 
    64   _STLP_DECLSPEC explicit messages(size_t __refs = 0);
    65 
    66   catalog open(const string& __fn, const locale& __loc) const
    67   { return do_open(__fn, __loc); }
    68   string_type get(catalog __c, int __set, int __msgid,
    69                   const string_type& __dfault) const
    70   { return do_get(__c, __set, __msgid, __dfault); }
    71   inline void close(catalog __c) const
    72   { do_close(__c); }
    73 
    74 #if defined(__SYMBIAN32__WSD__) 
    75   static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
    76 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)    
    77   static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
    78   static locale::id id;           
    79 #else
    80   // NOTE: Symbian doesn't support exporting static data.  
    81   // Users of this class should use GetFacetLocaleId() to access the data member id  
    82   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
    83 #endif
    84 
    85 private:
    86   _STLP_DECLSPEC messages(_STLP_PRIV _Messages*);
    87 
    88 protected:
    89   _STLP_DECLSPEC messages(size_t, _Locale_messages*);
    90   _STLP_DECLSPEC ~messages();
    91 
    92 
    93   _STLP_DECLSPEC virtual catalog     do_open(const string& __fn, const locale& __loc) const;
    94   _STLP_DECLSPEC virtual string_type do_get(catalog __c, int __set, int __msgid,
    95                              const string_type& __dfault) const;
    96   _STLP_DECLSPEC virtual void        do_close(catalog __c) const;
    97 
    98   void _M_initialize(const char* __name);
    99 
   100 private:
   101   _STLP_PRIV _Messages* _M_impl;
   102 };
   103 
   104 #if !defined (_STLP_NO_WCHAR_T)
   105 
   106 _STLP_TEMPLATE_NULL
   107 class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
   108   friend class _Locale_impl;
   109 public:
   110   typedef messages_base::catalog catalog;
   111   typedef wchar_t                char_type;
   112   typedef wstring  string_type;
   113 
   114   explicit messages(size_t __refs = 0);
   115 
   116   inline catalog open(const string& __fn, const locale& __loc) const
   117     { return do_open(__fn, __loc); }
   118   inline string_type get(catalog __c, int __set, int __msgid,
   119                          const string_type& __dfault) const
   120     { return do_get(__c, __set, __msgid, __dfault); }
   121   inline void close(catalog __c) const
   122     { do_close(__c); }
   123 
   124 #if defined(__SYMBIAN32__WSD__) 
   125   static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
   126 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)    
   127   static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId();
   128   static locale::id id;        
   129 #else
   130   // NOTE: Symbian doesn't support exporting static data.  
   131   // Users of this class should use GetFacetLocaleId() to access the data member id  
   132   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
   133 #endif
   134 
   135 private:
   136   _STLP_DECLSPEC messages(_STLP_PRIV _Messages*);
   137 
   138 protected:
   139   _STLP_DECLSPEC messages(size_t, _Locale_messages*);
   140   _STLP_DECLSPEC ~messages();
   141 
   142   _STLP_DECLSPEC virtual catalog     do_open(const string& __fn, const locale& __loc) const;
   143   _STLP_DECLSPEC virtual string_type do_get(catalog __c, int __set, int __msgid,
   144                              const string_type& __dfault) const;
   145   _STLP_DECLSPEC virtual void        do_close(catalog __c) const;
   146 
   147   void _M_initialize(const char* __name);
   148 
   149 private:
   150   _STLP_PRIV _Messages* _M_impl;
   151 };
   152 
   153 #endif
   154 
   155 template <class _CharT> class messages_byname {};
   156 
   157 _STLP_TEMPLATE_NULL
   158 class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
   159 public:
   160   typedef messages_base::catalog catalog;
   161   typedef string     string_type;
   162 
   163   _STLP_DECLSPEC explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
   164 
   165 protected:
   166   ~messages_byname();
   167 
   168 private:
   169   typedef messages_byname<char> _Self;
   170   //explicitely defined as private to avoid warnings:
   171   messages_byname(_Self const&);
   172   _Self& operator = (_Self const&);
   173 };
   174 
   175 #if !defined (_STLP_NO_WCHAR_T)
   176 _STLP_TEMPLATE_NULL
   177 class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
   178 public:
   179   typedef messages_base::catalog catalog;
   180   typedef wstring                string_type;
   181 
   182   _STLP_DECLSPEC explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
   183 
   184 protected:
   185   ~messages_byname();
   186 
   187 private:
   188   typedef messages_byname<wchar_t> _Self;
   189   //explicitely defined as private to avoid warnings:
   190   messages_byname(_Self const&);
   191   _Self& operator = (_Self const&);
   192 };
   193 #endif /* WCHAR_T */
   194 
   195 _STLP_END_NAMESPACE
   196 
   197 #endif /* _STLP_INTERNAL_MESSAGES_H */
   198 
   199 // Local Variables:
   200 // mode:C++
   201 // End:
   202