## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.5

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# ICUBridgeCollationCompareFunctorImpl.hpp

Go to the documentation of this file.

    00001 /*
    00002  * The Apache Software License, Version 1.1
    00003  *
    00004  *
    00005  * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    00006  * reserved.
    00007  *
    00008  * Redistribution and use in source and binary forms, with or without
    00009  * modification, are permitted provided that the following conditions
    00010  * are met:
    00011  *
    00012  * 1. Redistributions of source code must retain the above copyright
    00013  *    notice, this list of conditions and the following disclaimer.
    00014  *
    00015  * 2. Redistributions in binary form must reproduce the above copyright
    00016  *    notice, this list of conditions and the following disclaimer in
    00017  *    the documentation and/or other materials provided with the
    00018  *    distribution.
    00019  *
    00020  * 3. The end-user documentation included with the redistribution,
    00021  *    if any, must include the following acknowledgment:
    00022  *       "This product includes software developed by the
    00023  *        Apache Software Foundation (http://www.apache.org/)."
    00024  *    Alternately, this acknowledgment may appear in the software itself,
    00025  *    if and wherever such third-party acknowledgments normally appear.
    00026  *
    00027  * 4. The names "Xalan" and "Apache Software Foundation" must
    00028  *    not be used to endorse or promote products derived from this
    00029  *    software without prior written permission. For written
    00030  *    permission, please contact apache@apache.org.
    00031  *
    00032  * 5. Products derived from this software may not be called "Apache",
    00033  *    nor may "Apache" appear in their name, without prior written
    00034  *    permission of the Apache Software Foundation.
    00035  *
    00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00047  * SUCH DAMAGE.
    00048  * ====================================================================
    00049  *
    00050  * This software consists of voluntary contributions made by many
    00051  * individuals on behalf of the Apache Software Foundation and was
    00052  * originally based on software copyright (c) 1999, International
    00053  * Business Machines, Inc., http://www.ibm.com.  For more
    00054  * information on the Apache Software Foundation, please see
    00055  * <http://www.apache.org/>.
    00056  */
    00057
    00058 #if !defined(ICUBRIDGE_COLLATIONCOMPAREFUNCTORIMPL_GUARD_1357924680)
    00059 #define ICUBRIDGE_COLLATIONCOMPAREFUNCTORIMPL_GUARD_1357924680
    00060
    00061
    00062
    00063 #include <ICUBridge/ICUBridgeDefinitions.hpp>
    00064
    00065
    00066
    00067 #include <list>
    00068
    00069
    00070
    00071 #include <XSLT/StylesheetExecutionContextDefault.hpp>
    00072
    00073
    00074
    00075 #include <unicode/coll.h>
    00076
    00077
    00078
    00079
    00080 XALAN_CPP_NAMESPACE_BEGIN
    00081
    00082
    00083
    00084 class XALAN_ICUBRIDGE_EXPORT ICUBridgeCollationCompareFunctorImpl : public StylesheetExecutionContextDefault::CollationCompareFunctor
    00085 {
    00086 public:
    00087
    00088     typedef StylesheetExecutionContextDefault::eCaseOrder   eCaseOrder;
    00089
    00090
    00096     ICUBridgeCollationCompareFunctorImpl(bool   fCacheCollators = false);
    00097
    00098     ~ICUBridgeCollationCompareFunctorImpl();
    00099
    00100     int
    00101     operator()(
    00102             const XalanDOMChar*     theLHS,
    00103             const XalanDOMChar*     theRHS,
    00104             eCaseOrder              theCaseOrder = StylesheetExecutionContextDefault::eDefault) const;
    00105
    00106     int
    00107     operator()(
    00108             const XalanDOMChar*     theLHS,
    00109             const XalanDOMChar*     theRHS,
    00110             const XalanDOMChar*     theLocale,
    00111             eCaseOrder              theCaseOrder = StylesheetExecutionContextDefault::eDefault) const;
    00112
    00113     bool
    00114     isValid() const
    00115     {
    00116         return m_isValid;
    00117     }
    00118
    00119 #if defined(XALAN_HAS_CPP_NAMESPACE)
    00120     typedef U_ICU_NAMESPACE::Collator   CollatorType;
    00121 #else
    00122     typedef Collator                    CollatorType;
    00123 #endif
    00124
    00125     struct CollationCacheStruct
    00126     {
    00127         CollationCacheStruct(
    00128                 const XalanDOMString&   theLocale,
    00129                 CollatorType*           theCollator) :
    00130             m_locale(theLocale),
    00131             m_collator(theCollator)
    00132         {
    00133         }
    00134
    00135         CollationCacheStruct() :
    00136             m_locale(),
    00137             m_collator(0)
    00138         {
    00139         }
    00140
    00141         void
    00142         swap(CollationCacheStruct&  theOther)
    00143         {
    00144             m_locale.swap(theOther.m_locale);
    00145
    00146             CollatorType* const     theTemp = m_collator;
    00147
    00148             m_collator = theOther.m_collator;
    00149
    00150             theOther.m_collator = theTemp;
    00151         }
    00152
    00153 #if defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)
    00154         bool
    00155         operator<(const CollationCacheStruct&  theRHS) const
    00156         {
    00157             return this < &theRHS;
    00158         }
    00159
    00160         bool
    00161         operator==(const CollationCacheStruct&  theRHS) const
    00162         {
    00163             return this == &theRHS;
    00164         }
    00165 #endif
    00166
    00167         XalanDOMString  m_locale;
    00168
    00169         CollatorType*   m_collator;
    00170
    00171         struct CollatorDeleteFunctor
    00172         {
    00173             void
    00174             operator()(CollationCacheStruct&    theStruct) const
    00175             {
    00176                 delete theStruct.m_collator;
    00177             }
    00178         };
    00179
    00180         struct CollatorFindFunctor
    00181         {
    00182             CollatorFindFunctor(const XalanDOMChar* theLocale) :
    00183                 m_locale(theLocale)
    00184             {
    00185             }
    00186
    00187             bool
    00188             operator()(CollationCacheStruct&    theStruct) const
    00189             {
    00190                 return XalanDOMString::equals(theStruct.m_locale ,m_locale);
    00191             }
    00192
    00193             const XalanDOMChar* const   m_locale;
    00194         };
    00195     };
    00196
    00197 #if defined(XALAN_NO_STD_NAMESPACE)
    00198     typedef list<CollationCacheStruct>          CollatorCacheListType;
    00199 #else
    00200     typedef std::list<CollationCacheStruct>     CollatorCacheListType;
    00201 #endif
    00202
    00203     enum { eCacheMax = 10 };
    00204
    00205 private:
    00206
    00207     int
    00208     doDefaultCompare(
    00209             const XalanDOMChar*     theLHS,
    00210             const XalanDOMChar*     theRHS) const;
    00211
    00212     int
    00213     doCompare(
    00214             const XalanDOMChar*     theLHS,
    00215             const XalanDOMChar*     theRHS,
    00216             const XalanDOMChar*     theLocale,
    00217             eCaseOrder              theCaseOrder) const;
    00218
    00219     int
    00220     doCompareCached(
    00221             const XalanDOMChar*     theLHS,
    00222             const XalanDOMChar*     theRHS,
    00223             const XalanDOMChar*     theLocale,
    00224             eCaseOrder              theCaseOrder) const;
    00225
    00226     int
    00227     doCompare(
    00228             const CollatorType&     theCollator,
    00229             const XalanDOMChar*     theLHS,
    00230             const XalanDOMChar*     theRHS) const;
    00231
    00232     int
    00233     doCompare(
    00234             CollatorType&           theCollator,
    00235             const XalanDOMChar*     theLHS,
    00236             const XalanDOMChar*     theRHS,
    00237             eCaseOrder              theCaseOrder) const;
    00238
    00239     CollatorType*
    00240     getCachedCollator(const XalanDOMChar*   theLocale) const;
    00241
    00242     void
    00243     cacheCollator(
    00244             CollatorType*           theCollator,
    00245             const XalanDOMChar*     theLocale) const;
    00246
    00247
    00248     // Data members...
    00249     bool                            m_isValid;
    00250
    00251     CollatorType*                   m_defaultCollator;
    00252
    00253     XalanDOMString                  m_defaultCollatorLocaleName;
    00254
    00255     bool                            m_cacheCollators;
    00256
    00257     mutable CollatorCacheListType   m_collatorCache;
    00258
    00259     static const StylesheetExecutionContextDefault::DefaultCollationCompareFunctor  s_defaultFunctor;
    00260 };
    00261
    00262
    00263
    00264 XALAN_CPP_NAMESPACE_END
    00265
    00266
    00267
    00268 #endif  // ICUBRIDGE_COLLATIONCOMPAREFUNCTORIMPL_GUARD_1357924680

Interpreting class diagrams

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

Xalan-C++ XSLT Processor Version 1.5 Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.