Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:01

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_BMPATTERN_HPP)
0023 #define XERCESC_INCLUDE_GUARD_BMPATTERN_HPP
0024 
0025 // ---------------------------------------------------------------------------
0026 //  Includes
0027 // ---------------------------------------------------------------------------
0028 #include <xercesc/util/XMemory.hpp>
0029 #include <xercesc/util/PlatformUtils.hpp>
0030 
0031 XERCES_CPP_NAMESPACE_BEGIN
0032 
0033 class XMLUTIL_EXPORT BMPattern : public XMemory
0034 {
0035 public:
0036     // -----------------------------------------------------------------------
0037     //  Public Constructors and Destructor
0038     // -----------------------------------------------------------------------
0039     /** @name Constructors */
0040     //@{
0041 
0042     /**
0043       * This is the constructor which takes the pattern information. A default
0044       * shift table size is used.
0045       *
0046       * @param  pattern     The pattern to match against.
0047       *
0048       * @param  ignoreCase  A flag to indicate whether to ignore case
0049       *                        matching or not.
0050       *
0051       * @param  manager     The configurable memory manager
0052       */
0053     BMPattern
0054     (
0055         const XMLCh* const pattern
0056         , bool ignoreCase
0057         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0058     );
0059 
0060     /**
0061       * This is the constructor which takes all of the information
0062       * required to construct a BM pattern object.
0063       *
0064       * @param  pattern     The pattern to match against.
0065       *
0066       * @param    tableSize    Indicates the size of the shift table.
0067       *
0068       * @param  ignoreCase  A flag to indicate whether to ignore case
0069       *                        matching or not.
0070       *
0071       * @param  manager     The configurable memory manager
0072       */
0073     BMPattern
0074     (
0075         const XMLCh* const pattern
0076         , int tableSize
0077         , bool ignoreCase
0078         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0079     );
0080 
0081     //@}
0082 
0083     /** @name Destructor. */
0084     //@{
0085 
0086     /**
0087       * Destructor of BMPattern
0088       */
0089     ~BMPattern();
0090 
0091     //@}
0092 
0093     // -----------------------------------------------------------------------
0094     // Matching functions
0095     // -----------------------------------------------------------------------
0096     /** @name Matching Functions */
0097     //@{
0098 
0099     /**
0100       *    This method will perform a match of the given content against a
0101       *    predefined pattern.
0102       */
0103     int matches(const XMLCh* const content, XMLSize_t start, XMLSize_t limit) const;
0104 
0105     //@}
0106 
0107 private :
0108     // -----------------------------------------------------------------------
0109     //  Unimplemented constructors and operators
0110     // -----------------------------------------------------------------------
0111     BMPattern();
0112     BMPattern(const BMPattern&);
0113     BMPattern& operator=(const BMPattern&);
0114 
0115         // -----------------------------------------------------------------------
0116     // This method will perform a case insensitive match
0117     // -----------------------------------------------------------------------
0118     bool matchesIgnoreCase(const XMLCh ch1, const XMLCh ch2);
0119 
0120     // -----------------------------------------------------------------------
0121     // Initialize/Clean up methods
0122     // -----------------------------------------------------------------------
0123     void initialize();
0124     void cleanUp();
0125 
0126     // -----------------------------------------------------------------------
0127     //  Private data members
0128     //
0129     //  fPattern
0130     //    fUppercasePattern
0131     //      This is the pattern to match against, and its upper case form.
0132     //        
0133     //  fIgnoreCase
0134     //      This is an indicator whether cases should be ignored during
0135     //        matching.
0136     //
0137     //  fShiftTable
0138     //    fShiftTableLen
0139     //      This is a table of offsets for shifting purposes used by the BM
0140     //        search algorithm, and its length.
0141     // -----------------------------------------------------------------------
0142     bool           fIgnoreCase;
0143     unsigned int   fShiftTableLen;
0144     XMLSize_t*     fShiftTable;
0145     XMLCh*         fPattern;
0146     XMLCh*         fUppercasePattern;
0147     MemoryManager* fMemoryManager; 
0148 };
0149 
0150 XERCES_CPP_NAMESPACE_END
0151 
0152 #endif
0153 
0154 /*
0155  * End of file BMPattern.hpp
0156  */
0157