Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygen_collate.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 // WARNING: This is an internal header file, included by other C++ 00019 // standard library headers. You should not attempt to use this header 00020 // file directly. 00021 00022 #ifndef _STLP_INTERNAL_COLLATE_H 00023 #define _STLP_INTERNAL_COLLATE_H 00024 00025 #ifndef _STLP_C_LOCALE_H 00026 # include <stl/c_locale.h> 00027 #endif 00028 00029 #ifndef _STLP_INTERNAL_LOCALE_H 00030 # include <stl/_locale.h> 00031 #endif 00032 00033 #ifndef _STLP_INTERNAL_STRING_H 00034 # include <stl/_string.h> 00035 #endif 00036 00037 _STLP_BEGIN_NAMESPACE 00038 00039 template <class _CharT> class collate {}; 00040 template <class _CharT> class collate_byname {}; 00041 00042 _STLP_TEMPLATE_NULL 00043 class _STLP_CLASS_DECLSPEC collate<char> : public locale::facet { 00044 public: 00045 typedef char char_type; 00046 typedef string string_type; 00047 00048 explicit collate(size_t __refs = 0) : locale::facet(__refs) {} 00049 00050 int compare(const char* __low1, const char* __high1, 00051 const char* __low2, const char* __high2) const { 00052 return do_compare( __low1, __high1, __low2, __high2); 00053 } 00054 00055 string_type transform(const char* __low, const char* __high) const { 00056 return do_transform(__low, __high); 00057 } 00058 00059 long hash(const char* __low, const char* __high) const 00060 { return do_hash(__low, __high); } 00061 00062 static _STLP_STATIC_DECLSPEC locale::id id; 00063 00064 protected: 00065 ~collate(); 00066 00067 virtual int do_compare(const char*, const char*, 00068 const char*, const char*) const; 00069 virtual string_type do_transform(const char*, const char*) const; 00070 virtual long do_hash(const char*, const char*) const; 00071 private: 00072 collate(const collate<char>&); 00073 collate<char>& operator =(const collate<char>&); 00074 }; 00075 00076 # ifndef _STLP_NO_WCHAR_T 00077 00078 _STLP_TEMPLATE_NULL 00079 class _STLP_CLASS_DECLSPEC collate<wchar_t> : public locale::facet { 00080 public: 00081 typedef wchar_t char_type; 00082 typedef wstring string_type; 00083 00084 explicit collate(size_t __refs = 0) : locale::facet(__refs) {} 00085 00086 int compare(const wchar_t* __low1, const wchar_t* __high1, 00087 const wchar_t* __low2, const wchar_t* __high2) const { 00088 return do_compare( __low1, __high1, __low2, __high2); 00089 } 00090 00091 string_type transform(const wchar_t* __low, const wchar_t* __high) const { 00092 return do_transform(__low, __high); 00093 } 00094 00095 long hash(const wchar_t* __low, const wchar_t* __high) const 00096 { return do_hash(__low, __high); } 00097 00098 static _STLP_STATIC_DECLSPEC locale::id id; 00099 00100 protected: 00101 ~collate(); 00102 00103 virtual int do_compare(const wchar_t*, const wchar_t*, 00104 const wchar_t*, const wchar_t*) const; 00105 virtual string_type do_transform(const wchar_t*, const wchar_t*) const; 00106 virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const; 00107 private: 00108 collate(const collate<wchar_t>&); 00109 collate<wchar_t>& operator = (const collate<wchar_t>&); 00110 }; 00111 00112 # endif /* NO_WCHAR_T */ 00113 00114 _STLP_TEMPLATE_NULL 00115 class _STLP_CLASS_DECLSPEC collate_byname<char>: public collate<char> { 00116 friend class _Locale_impl; 00117 public: 00118 explicit collate_byname(const char* __name, size_t __refs = 0); 00119 00120 protected: 00121 ~collate_byname(); 00122 00123 virtual int do_compare(const char*, const char*, 00124 const char*, const char*) const; 00125 virtual string_type do_transform(const char*, const char*) const; 00126 00127 private: 00128 collate_byname(_Locale_collate *__coll) 00129 : _M_collate(__coll) {} 00130 _Locale_collate* _M_collate; 00131 collate_byname(const collate_byname<char>&); 00132 collate_byname<char>& operator =(const collate_byname<char>&); 00133 }; 00134 00135 # ifndef _STLP_NO_WCHAR_T 00136 00137 _STLP_TEMPLATE_NULL 00138 class _STLP_CLASS_DECLSPEC collate_byname<wchar_t>: public collate<wchar_t> { 00139 friend class _Locale_impl; 00140 public: 00141 explicit collate_byname(const char * __name, size_t __refs = 0); 00142 00143 protected: 00144 ~collate_byname(); 00145 00146 virtual int do_compare(const wchar_t*, const wchar_t*, 00147 const wchar_t*, const wchar_t*) const; 00148 virtual string_type do_transform(const wchar_t*, const wchar_t*) const; 00149 00150 private: 00151 collate_byname(_Locale_collate *__coll) 00152 : _M_collate(__coll) {} 00153 _Locale_collate* _M_collate; 00154 collate_byname(const collate_byname<wchar_t>&); 00155 collate_byname<wchar_t>& operator =(const collate_byname<wchar_t>&); 00156 }; 00157 00158 # endif /* NO_WCHAR_T */ 00159 00160 template <class _CharT, class _Traits, class _Alloc> 00161 bool 00162 __locale_do_operator_call (const locale& __loc, 00163 const basic_string<_CharT, _Traits, _Alloc>& __x, 00164 const basic_string<_CharT, _Traits, _Alloc>& __y) { 00165 collate<_CharT> const& __coll = use_facet<collate<_CharT> >(__loc); 00166 return __coll.compare(__x.data(), __x.data() + __x.size(), 00167 __y.data(), __y.data() + __y.size()) < 0; 00168 } 00169 00170 _STLP_END_NAMESPACE 00171 00172 #endif /* _STLP_INTERNAL_COLLATE_H */ 00173 00174 // Local Variables: 00175 // mode:C++ 00176 // End: Generated on Fri May 25 2012 04:27:19 for ReactOS by
1.7.6.1
|