/home/ntakagi/work/STLport-5.1.5/src/locale_impl.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 #ifndef LOCALE_IMPL_H
00020 #define LOCALE_IMPL_H
00021 
00022 #include <clocale>             // C locale header file.
00023 #include <vector>
00024 #include <string>
00025 #include <locale>
00026 #include "c_locale.h"
00027 
00028 _STLP_BEGIN_NAMESPACE
00029 
00030 #if defined (_STLP_USE_TEMPLATE_EXPORT)
00031 //Export of _Locale_impl facets container:
00032 #  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
00033 //If we are using pointer specialization, vector<locale::facet*> will use
00034 //the already exported vector<void*> implementation.
00035 _STLP_EXPORT_TEMPLATE_CLASS allocator<locale::facet*>;
00036 
00037 _STLP_MOVE_TO_PRIV_NAMESPACE
00038 
00039 _STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
00040 _STLP_EXPORT_TEMPLATE_CLASS _Vector_base<locale::facet*, allocator<locale::facet*> >;
00041 
00042 _STLP_MOVE_TO_STD_NAMESPACE
00043 #  endif
00044 #  if defined (_STLP_DEBUG)
00045 _STLP_MOVE_TO_PRIV_NAMESPACE
00046 #    define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
00047 _STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
00048 _STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
00049 #    undef _STLP_NON_DBG_VECTOR
00050 _STLP_MOVE_TO_STD_NAMESPACE
00051 #  endif
00052 
00053 _STLP_EXPORT_TEMPLATE_CLASS vector<locale::facet*, allocator<locale::facet*> >;
00054 #endif
00055 
00056 //----------------------------------------------------------------------
00057 // Class _Locale_impl
00058 // This is the base class which implements access only and is supposed to
00059 // be used for classic locale only
00060 class _STLP_CLASS_DECLSPEC _Locale_impl : public _Refcount_Base {
00061   public:
00062     _Locale_impl(const char* s);
00063     _Locale_impl(const _Locale_impl&);
00064     _Locale_impl(size_t n, const char* s);
00065 
00066   private:
00067     ~_Locale_impl();
00068 
00069   public:
00070     size_t size() const { return facets_vec.size(); }
00071 
00072     basic_string<char, char_traits<char>, allocator<char> > name;
00073 
00074     static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_bad_cast();
00075 
00076   private:
00077     void operator=(const _Locale_impl&);
00078 
00079   public:
00080     class _STLP_CLASS_DECLSPEC Init {
00081       public:
00082         Init();
00083         ~Init();
00084       private:
00085         _Refcount_Base& _M_count() const;
00086     };
00087 
00088     static void _STLP_CALL _S_initialize();
00089     static void _STLP_CALL _S_uninitialize();
00090 
00091     static void make_classic_locale();
00092     static void free_classic_locale();
00093 
00094     friend class Init;
00095 
00096   public: // _Locale
00097     // void remove(size_t index);
00098     locale::facet* insert(locale::facet*, size_t index);
00099     void insert(_Locale_impl* from, const locale::id& n);
00100 
00101     // Helper functions for byname construction of locales.
00102     _Locale_name_hint* insert_ctype_facets(const char* name, _Locale_name_hint* hint);
00103     _Locale_name_hint* insert_numeric_facets(const char* name, _Locale_name_hint* hint);
00104     _Locale_name_hint* insert_time_facets(const char* name, _Locale_name_hint* hint);
00105     _Locale_name_hint* insert_collate_facets(const char* name, _Locale_name_hint* hint);
00106     _Locale_name_hint* insert_monetary_facets(const char* name, _Locale_name_hint* hint);
00107     _Locale_name_hint* insert_messages_facets(const char* name, _Locale_name_hint* hint);
00108 
00109     bool operator != (const locale& __loc) const { return __loc._M_impl != this; }
00110 
00111   private:
00112     vector<locale::facet*> facets_vec;
00113 
00114   private:
00115     friend _Locale_impl * _STLP_CALL _copy_Locale_impl( _Locale_impl * );
00116     friend _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl * );
00117     friend void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
00118 #if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
00119     friend class _STLP_NO_MEM_T_NAME(loc);
00120 #else
00121     friend class locale;
00122 #endif
00123 };
00124 
00125 void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
00126 _Locale_impl * _STLP_CALL _copy_Locale_impl( _Locale_impl *loc );
00127 
00128 _STLP_END_NAMESPACE
00129 
00130 #endif
00131 
00132 // Local Variables:
00133 // mode:C++
00134 // End:



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