/home/ntakagi/work/STLport-5.1.5/stlport/stl/_messages_facets.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 
00019 // WARNING: This is an internal header file, included by other C++
00020 // standard library headers.  You should not attempt to use this header
00021 // file directly.
00022 
00023 
00024 #ifndef _STLP_INTERNAL_MESSAGES_H
00025 #define _STLP_INTERNAL_MESSAGES_H
00026 
00027 #ifndef _STLP_IOS_BASE_H
00028 #  include <stl/_ios_base.h>
00029 #endif
00030 
00031 #ifndef _STLP_C_LOCALE_H
00032 #  include <stl/c_locale.h>
00033 #endif
00034 
00035 #ifndef _STLP_INTERNAL_STRING_H
00036 #  include <stl/_string.h>
00037 #endif
00038 
00039 _STLP_BEGIN_NAMESPACE
00040 
00041 // messages facets
00042 
00043 class messages_base {
00044   public:
00045     typedef int catalog;
00046 };
00047 
00048 template <class _CharT> class messages {};
00049 
00050 _STLP_MOVE_TO_PRIV_NAMESPACE
00051 class _Messages;
00052 _STLP_MOVE_TO_STD_NAMESPACE
00053 
00054 _STLP_TEMPLATE_NULL
00055 class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
00056   friend class _Locale_impl;
00057 public:
00058   typedef messages_base::catalog catalog;
00059   typedef char                   char_type;
00060   typedef string    string_type;
00061 
00062   explicit messages(size_t __refs = 0);
00063 
00064   catalog open(const string& __fn, const locale& __loc) const
00065   { return do_open(__fn, __loc); }
00066   string_type get(catalog __c, int __set, int __msgid,
00067                   const string_type& __dfault) const
00068   { return do_get(__c, __set, __msgid, __dfault); }
00069   inline void close(catalog __c) const
00070   { do_close(__c); }
00071 
00072   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
00073 
00074 private:
00075   messages(_STLP_PRIV _Messages*);
00076 
00077 protected:
00078   messages(size_t, _Locale_messages*);
00079   ~messages();
00080 
00081   virtual catalog     do_open(const string& __fn, const locale& __loc) const;
00082   virtual string_type do_get(catalog __c, int __set, int __msgid,
00083                              const string_type& __dfault) const;
00084   virtual void        do_close(catalog __c) const;
00085 
00086   void _M_initialize(const char* __name);
00087 
00088 private:
00089   _STLP_PRIV _Messages* _M_impl;
00090 };
00091 
00092 #if !defined (_STLP_NO_WCHAR_T)
00093 
00094 _STLP_TEMPLATE_NULL
00095 class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
00096   friend class _Locale_impl;
00097 public:
00098   typedef messages_base::catalog catalog;
00099   typedef wchar_t                char_type;
00100   typedef wstring  string_type;
00101 
00102   explicit messages(size_t __refs = 0);
00103 
00104   inline catalog open(const string& __fn, const locale& __loc) const
00105     { return do_open(__fn, __loc); }
00106   inline string_type get(catalog __c, int __set, int __msgid,
00107                          const string_type& __dfault) const
00108     { return do_get(__c, __set, __msgid, __dfault); }
00109   inline void close(catalog __c) const
00110     { do_close(__c); }
00111 
00112   static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
00113 
00114 private:
00115   messages(_STLP_PRIV _Messages*);
00116 
00117 protected:
00118   messages(size_t, _Locale_messages*);
00119   ~messages();
00120 
00121   virtual catalog     do_open(const string& __fn, const locale& __loc) const;
00122   virtual string_type do_get(catalog __c, int __set, int __msgid,
00123                              const string_type& __dfault) const;
00124   virtual void        do_close(catalog __c) const;
00125 
00126   void _M_initialize(const char* __name);
00127 
00128 private:
00129   _STLP_PRIV _Messages* _M_impl;
00130 };
00131 
00132 #endif
00133 
00134 template <class _CharT> class messages_byname {};
00135 
00136 _STLP_TEMPLATE_NULL
00137 class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
00138 public:
00139   typedef messages_base::catalog catalog;
00140   typedef string     string_type;
00141 
00142   explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
00143 
00144 protected:
00145   ~messages_byname();
00146 
00147 private:
00148   typedef messages_byname<char> _Self;
00149   //explicitely defined as private to avoid warnings:
00150   messages_byname(_Self const&);
00151   _Self& operator = (_Self const&);
00152 };
00153 
00154 #if !defined (_STLP_NO_WCHAR_T)
00155 _STLP_TEMPLATE_NULL
00156 class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
00157 public:
00158   typedef messages_base::catalog catalog;
00159   typedef wstring                string_type;
00160 
00161   explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
00162 
00163 protected:
00164   ~messages_byname();
00165 
00166 private:
00167   typedef messages_byname<wchar_t> _Self;
00168   //explicitely defined as private to avoid warnings:
00169   messages_byname(_Self const&);
00170   _Self& operator = (_Self const&);
00171 };
00172 #endif /* WCHAR_T */
00173 
00174 _STLP_END_NAMESPACE
00175 
00176 #endif /* _STLP_INTERNAL_MESSAGES_H */
00177 
00178 // Local Variables:
00179 // mode:C++
00180 // End:
00181 



Generated on Mon Mar 10 15:32:31 2008 by  doxygen 1.5.1