Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 1999 |
michael@0 | 3 | * Silicon Graphics Computer Systems, Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Copyright (c) 1999 |
michael@0 | 6 | * Boris Fomitchev |
michael@0 | 7 | * |
michael@0 | 8 | * This material is provided "as is", with absolutely no warranty expressed |
michael@0 | 9 | * or implied. Any use is at your own risk. |
michael@0 | 10 | * |
michael@0 | 11 | * Permission to use or copy this software for any purpose is hereby granted |
michael@0 | 12 | * without fee, provided the above notices are retained on all copies. |
michael@0 | 13 | * Permission to modify the code and to distribute modified code is granted, |
michael@0 | 14 | * provided the above notices are retained, and a notice that the code was |
michael@0 | 15 | * modified is included with the above copyright notice. |
michael@0 | 16 | * |
michael@0 | 17 | */ |
michael@0 | 18 | |
michael@0 | 19 | #ifndef LOCALE_IMPL_H |
michael@0 | 20 | #define LOCALE_IMPL_H |
michael@0 | 21 | |
michael@0 | 22 | #include <clocale> // C locale header file. |
michael@0 | 23 | #include <vector> |
michael@0 | 24 | #include <string> |
michael@0 | 25 | #include <locale> |
michael@0 | 26 | #include "c_locale.h" |
michael@0 | 27 | |
michael@0 | 28 | _STLP_BEGIN_NAMESPACE |
michael@0 | 29 | |
michael@0 | 30 | #if defined (_STLP_USE_TEMPLATE_EXPORT) |
michael@0 | 31 | //Export of _Locale_impl facets container: |
michael@0 | 32 | # if !defined (_STLP_USE_PTR_SPECIALIZATIONS) |
michael@0 | 33 | //If we are using pointer specialization, vector<locale::facet*> will use |
michael@0 | 34 | //the already exported vector<void*> implementation. |
michael@0 | 35 | _STLP_EXPORT_TEMPLATE_CLASS allocator<locale::facet*>; |
michael@0 | 36 | |
michael@0 | 37 | _STLP_MOVE_TO_PRIV_NAMESPACE |
michael@0 | 38 | |
michael@0 | 39 | _STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >; |
michael@0 | 40 | _STLP_EXPORT_TEMPLATE_CLASS _Vector_base<locale::facet*, allocator<locale::facet*> >; |
michael@0 | 41 | |
michael@0 | 42 | _STLP_MOVE_TO_STD_NAMESPACE |
michael@0 | 43 | # endif |
michael@0 | 44 | # if defined (_STLP_DEBUG) |
michael@0 | 45 | _STLP_MOVE_TO_PRIV_NAMESPACE |
michael@0 | 46 | # define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector) |
michael@0 | 47 | _STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >; |
michael@0 | 48 | _STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >; |
michael@0 | 49 | # undef _STLP_NON_DBG_VECTOR |
michael@0 | 50 | _STLP_MOVE_TO_STD_NAMESPACE |
michael@0 | 51 | # endif |
michael@0 | 52 | |
michael@0 | 53 | _STLP_EXPORT_TEMPLATE_CLASS vector<locale::facet*, allocator<locale::facet*> >; |
michael@0 | 54 | #endif |
michael@0 | 55 | |
michael@0 | 56 | //---------------------------------------------------------------------- |
michael@0 | 57 | // Class _Locale_impl |
michael@0 | 58 | // This is the base class which implements access only and is supposed to |
michael@0 | 59 | // be used for classic locale only |
michael@0 | 60 | class _STLP_CLASS_DECLSPEC _Locale_impl : public _Refcount_Base { |
michael@0 | 61 | public: |
michael@0 | 62 | _Locale_impl(const char* s); |
michael@0 | 63 | _Locale_impl(const _Locale_impl&); |
michael@0 | 64 | _Locale_impl(size_t n, const char* s); |
michael@0 | 65 | |
michael@0 | 66 | private: |
michael@0 | 67 | ~_Locale_impl(); |
michael@0 | 68 | |
michael@0 | 69 | public: |
michael@0 | 70 | size_t size() const { return facets_vec.size(); } |
michael@0 | 71 | |
michael@0 | 72 | basic_string<char, char_traits<char>, allocator<char> > name; |
michael@0 | 73 | |
michael@0 | 74 | static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_bad_cast(); |
michael@0 | 75 | |
michael@0 | 76 | private: |
michael@0 | 77 | void operator=(const _Locale_impl&); |
michael@0 | 78 | |
michael@0 | 79 | public: |
michael@0 | 80 | class _STLP_CLASS_DECLSPEC Init { |
michael@0 | 81 | public: |
michael@0 | 82 | Init(); |
michael@0 | 83 | ~Init(); |
michael@0 | 84 | private: |
michael@0 | 85 | _Refcount_Base& _M_count() const; |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | static void _STLP_CALL _S_initialize(); |
michael@0 | 89 | static void _STLP_CALL _S_uninitialize(); |
michael@0 | 90 | |
michael@0 | 91 | static void make_classic_locale(); |
michael@0 | 92 | static void free_classic_locale(); |
michael@0 | 93 | |
michael@0 | 94 | friend class Init; |
michael@0 | 95 | |
michael@0 | 96 | public: |
michael@0 | 97 | // void remove(size_t index); |
michael@0 | 98 | locale::facet* insert(locale::facet*, const locale::id& n); |
michael@0 | 99 | void insert(_Locale_impl* from, const locale::id& n); |
michael@0 | 100 | |
michael@0 | 101 | // Helper functions for byname construction of locales. |
michael@0 | 102 | _Locale_name_hint* insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint); |
michael@0 | 103 | _Locale_name_hint* insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint); |
michael@0 | 104 | _Locale_name_hint* insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint); |
michael@0 | 105 | _Locale_name_hint* insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint); |
michael@0 | 106 | _Locale_name_hint* insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint); |
michael@0 | 107 | _Locale_name_hint* insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint); |
michael@0 | 108 | |
michael@0 | 109 | bool operator != (const locale& __loc) const { return __loc._M_impl != this; } |
michael@0 | 110 | |
michael@0 | 111 | private: |
michael@0 | 112 | vector<locale::facet*> facets_vec; |
michael@0 | 113 | |
michael@0 | 114 | private: |
michael@0 | 115 | friend _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl * ); |
michael@0 | 116 | friend void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc ); |
michael@0 | 117 | #if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ |
michael@0 | 118 | defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) |
michael@0 | 119 | friend class _STLP_NO_MEM_T_NAME(loc); |
michael@0 | 120 | #else |
michael@0 | 121 | friend class locale; |
michael@0 | 122 | #endif |
michael@0 | 123 | }; |
michael@0 | 124 | |
michael@0 | 125 | void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc ); |
michael@0 | 126 | |
michael@0 | 127 | _STLP_END_NAMESPACE |
michael@0 | 128 | |
michael@0 | 129 | #endif |
michael@0 | 130 | |
michael@0 | 131 | // Local Variables: |
michael@0 | 132 | // mode:C++ |
michael@0 | 133 | // End: |