Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

ICUBridgeCollationCompareFunctorImpl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #if !defined(ICUBRIDGE_COLLATIONCOMPAREFUNCTORIMPL_GUARD_1357924680)
18 #define ICUBRIDGE_COLLATIONCOMPAREFUNCTORIMPL_GUARD_1357924680
19 
20 
21 
23 
24 
25 
27 
28 
29 
31 
32 
33 
34 #include <unicode/coll.h>
35 
36 
37 
38 
39 XALAN_CPP_NAMESPACE_BEGIN
40 
41 
42 #if defined(XALAN_HAS_CPP_NAMESPACE)
43 typedef U_ICU_NAMESPACE::Collator CollatorType;
44 #else
45 typedef Collator CollatorType;
46 #endif
47 
49 {
51  MemoryManagerType& theManager,
52  const XalanDOMString& theLocale,
53  CollatorType* theCollator) :
54  m_locale(theLocale, theManager),
55  m_collator(theCollator)
56  {
57  }
58 
60  m_locale(theManager),
61  m_collator(0)
62  {
63  }
64 
66  MemoryManagerType& theManager) :
67  m_locale(other.m_locale,theManager),
68  m_collator(other.m_collator)
69  {
70  }
71  void
73  {
74  m_locale.swap(theOther.m_locale);
75 
76  CollatorType* const theTemp = m_collator;
77 
78  m_collator = theOther.m_collator;
79 
80  theOther.m_collator = theTemp;
81  }
82 
83 #if defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)
84  bool
85  operator<(const CollationCacheStruct& theRHS) const
86  {
87  return this < &theRHS;
88  }
89 
90  bool
91  operator==(const CollationCacheStruct& theRHS) const
92  {
93  return this == &theRHS;
94  }
95 #endif
96 
98 
100 
102  {
104  m_memoryManager(theManager)
105  {
106  }
107 
108  void
110  {
111  delete theStruct.m_collator;
112  }
113  private:
114  MemoryManagerType& m_memoryManager;
115  };
116 
118  {
119  CollatorFindFunctor(const XalanDOMChar* theLocale) :
120  m_locale(theLocale)
121  {
122  }
123 
124  bool
126  {
127  return XalanDOMString::equals(theStruct.m_locale ,m_locale);
128  }
129 
130  const XalanDOMChar* const m_locale;
131  };
132 };
133 
135 
137 {
138 public:
139 
146  bool fCacheCollators = false);
147 
149  create( MemoryManagerType& theManager,
150  bool fCacheCollators = false);
151 
152 
154 
157  {
158  return m_collatorCache.getMemoryManager();
159  }
160 
161  int
162  operator()(
163  const XalanDOMChar* theLHS,
164  const XalanDOMChar* theRHS,
166 
167  int
168  operator()(
169  const XalanDOMChar* theLHS,
170  const XalanDOMChar* theRHS,
171  const XalanDOMChar* theLocale,
173 
174  bool
175  isValid() const
176  {
177  return m_isValid;
178  }
179 
180 
182 
183  enum { eCacheMax = 10 };
184 
185 private:
186 
187  int
188  doDefaultCompare(
189  const XalanDOMChar* theLHS,
190  const XalanDOMChar* theRHS) const;
191 
192  int
193  doCompare(
194  const XalanDOMChar* theLHS,
195  const XalanDOMChar* theRHS,
196  const XalanDOMChar* theLocale,
197  XalanCollationServices::eCaseOrder theCaseOrder) const;
198 
199  int
200  doCompareCached(
201  const XalanDOMChar* theLHS,
202  const XalanDOMChar* theRHS,
203  const XalanDOMChar* theLocale,
204  XalanCollationServices::eCaseOrder theCaseOrder) const;
205 
206  int
207  doCompare(
208  const CollatorType& theCollator,
209  const XalanDOMChar* theLHS,
210  const XalanDOMChar* theRHS) const;
211 
212  int
213  doCompare(
214  CollatorType& theCollator,
215  const XalanDOMChar* theLHS,
216  const XalanDOMChar* theRHS,
217  XalanCollationServices::eCaseOrder theCaseOrder) const;
218 
219  CollatorType*
220  getCachedCollator(const XalanDOMChar* theLocale) const;
221 
222  void
223  cacheCollator(
224  CollatorType* theCollator,
225  const XalanDOMChar* theLocale) const;
226 
227 
228  // Data members...
229  bool m_isValid;
230 
231  CollatorType* m_defaultCollator;
232 
233  XalanDOMString m_defaultCollatorLocaleName;
234 
235  bool m_cacheCollators;
236 
237  mutable CollatorCacheListType m_collatorCache;
238 
240 };
241 
242 
243 
244 XALAN_CPP_NAMESPACE_END
245 
246 
247 
248 #endif // ICUBRIDGE_COLLATIONCOMPAREFUNCTORIMPL_GUARD_1357924680
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1111
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
void swap(CollationCacheStruct &theOther)
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:72
CollationCacheStruct(const CollationCacheStruct &other, MemoryManagerType &theManager)
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:65
void swap(XalanDOMString &theOther)
Definition: XalanDOMString.hpp:330
void operator()(CollationCacheStruct &theStruct) const
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:109
XalanDOMString m_locale
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:97
const XalanDOMChar *const m_locale
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:130
Definition: StylesheetExecutionContextDefault.hpp:698
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:136
CollationCacheStruct(MemoryManagerType &theManager)
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:59
Definition: XalanCollationServices.hpp:38
bool isValid() const
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:175
static bool equals(const XalanDOMChar *theLHS, size_type theLHSLength, const XalanDOMChar *theRHS, size_type theRHSLength)
MemoryManagerType & getMemoryManager() const
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:156
bool operator<(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1144
XALAN_CPP_NAMESPACE_BEGIN typedef Collator CollatorType
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:45
CollationCacheStruct(MemoryManagerType &theManager, const XalanDOMString &theLocale, CollatorType *theCollator)
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:50
CollatorType * m_collator
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:99
eCaseOrder
Definition: XalanCollationServices.hpp:38
CollatorDeleteFunctor(MemoryManagerType &theManager)
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:103
#define XALAN_USES_MEMORY_MANAGER(Type)
Definition: XalanMemoryManagement.hpp:468
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:101
Definition: XalanCollationServices.hpp:34
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:117
Definition: XalanDOMString.hpp:42
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:48
bool operator()(CollationCacheStruct &theStruct) const
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:125
CollatorFindFunctor(const XalanDOMChar *theLocale)
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:119
#define XALAN_ICUBRIDGE_EXPORT
Definition: ICUBridgeDefinitions.hpp:33
XalanList< CollationCacheStruct > CollatorCacheListType
Definition: ICUBridgeCollationCompareFunctorImpl.hpp:181

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo