epoc32/include/stdapis/stlport/stl/_messages_facets.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 _messages_facets.h
     1 /*
       
     2  * © Portions copyright (c) 2006-2007 Nokia Corporation.  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_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 class _Messages;
       
    53 
       
    54 _STLP_TEMPLATE_NULL
       
    55 #ifdef __SYMBIAN32__
       
    56 class messages<char> : public locale::facet, public messages_base
       
    57 #else
       
    58 class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base
       
    59 #endif
       
    60 {
       
    61   friend class _Locale;
       
    62 public:
       
    63   typedef messages_base::catalog catalog;
       
    64   typedef char                   char_type;
       
    65   typedef string    string_type;
       
    66 
       
    67  _STLP_DECLSPEC explicit messages(size_t __refs = 0);
       
    68 
       
    69  catalog open(const string& __fn, const locale& __loc) const
       
    70     { return do_open(__fn, __loc); }
       
    71   string_type get(catalog __c, int __set, int __msgid,
       
    72 		  const string_type& __dfault) const
       
    73     { return do_get(__c, __set, __msgid, __dfault); }
       
    74   inline void close(catalog __c) const
       
    75     { do_close(__c); }
       
    76 
       
    77 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
       
    78     _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
       
    79 #else
       
    80 	_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
       
    81 #endif
       
    82 
       
    83   _STLP_DECLSPEC  messages(_Messages*);
       
    84 
       
    85 protected:
       
    86  _STLP_DECLSPEC  messages(size_t, _Locale_messages*);
       
    87 _STLP_DECLSPEC   ~messages();
       
    88 
       
    89 _STLP_DECLSPEC   virtual catalog     do_open(const string& __fn, const locale& __loc) const;
       
    90 _STLP_DECLSPEC   virtual string_type do_get(catalog __c, int __set, int __msgid,
       
    91                              const string_type& __dfault) const;
       
    92 _STLP_DECLSPEC   virtual void        do_close(catalog __c) const;
       
    93 
       
    94   void _M_initialize(const char* __name);
       
    95 
       
    96 private:
       
    97   _Messages* _M_impl;
       
    98 };
       
    99 
       
   100 # if !defined (_STLP_NO_WCHAR_T)
       
   101 
       
   102 _STLP_TEMPLATE_NULL
       
   103 #ifdef __SYMBIAN32__
       
   104 class messages<wchar_t> : public locale::facet, public messages_base
       
   105 #else
       
   106 class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base
       
   107 #endif
       
   108 {
       
   109   friend class _Locale;
       
   110 public:
       
   111   typedef messages_base::catalog catalog;
       
   112   typedef wchar_t                char_type;
       
   113   typedef wstring  string_type;
       
   114 
       
   115 _STLP_DECLSPEC   explicit messages(size_t __refs = 0);
       
   116   
       
   117   inline catalog open(const string& __fn, const locale& __loc) const
       
   118     { return do_open(__fn, __loc); }
       
   119   inline string_type get(catalog __c, int __set, int __msgid,
       
   120                          const string_type& __dfault) const
       
   121     { return do_get(__c, __set, __msgid, __dfault); }
       
   122   inline void close(catalog __c) const
       
   123     { do_close(__c); }
       
   124 
       
   125 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
       
   126     _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
       
   127 #else
       
   128   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
       
   129 #endif
       
   130 
       
   131   _STLP_DECLSPEC  messages(_Messages*);
       
   132 
       
   133 protected:
       
   134 
       
   135 _STLP_DECLSPEC   messages(size_t, _Locale_messages*);
       
   136 _STLP_DECLSPEC   ~messages();
       
   137 
       
   138 _STLP_DECLSPEC   virtual catalog     do_open(const string& __fn, const locale& __loc) const;
       
   139 _STLP_DECLSPEC   virtual string_type do_get(catalog __c, int __set, int __msgid,
       
   140                              const string_type& __dfault) const;
       
   141 _STLP_DECLSPEC   virtual void        do_close(catalog __c) const;
       
   142 
       
   143   void _M_initialize(const char* __name);
       
   144 
       
   145 private:
       
   146   _Messages* _M_impl;
       
   147 };
       
   148 
       
   149 # endif /* WCHAR_T */
       
   150 
       
   151 template <class _CharT> class messages_byname {};
       
   152 
       
   153 _STLP_TEMPLATE_NULL
       
   154 class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
       
   155 public:
       
   156   typedef messages_base::catalog catalog;
       
   157   typedef string     string_type;
       
   158 
       
   159  _STLP_DECLSPEC  explicit messages_byname(const char* __name, size_t __refs = 0);
       
   160 
       
   161 protected:
       
   162 _STLP_DECLSPEC   ~messages_byname();
       
   163 };
       
   164 
       
   165 # ifndef _STLP_NO_WCHAR_T
       
   166 _STLP_TEMPLATE_NULL
       
   167 class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
       
   168 public:
       
   169   typedef messages_base::catalog catalog;
       
   170   typedef wstring                string_type;
       
   171 
       
   172 _STLP_DECLSPEC   explicit messages_byname(const char* __name, size_t __refs = 0);
       
   173 
       
   174 protected:
       
   175 _STLP_DECLSPEC   ~messages_byname();
       
   176 };
       
   177 # endif /* WCHAR_T */
       
   178 
       
   179 _STLP_END_NAMESPACE
       
   180 
       
   181 #endif /* _STLP_INTERNAL_MESSAGES_H */
       
   182 
       
   183 // Local Variables:
       
   184 // mode:C++
       
   185 // End:
       
   186