source: icXML/icXML-devel/src/xercesc/util/regx/BMPattern.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 4.9 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: BMPattern.hpp 932887 2010-04-11 13:04:59Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_BMPATTERN_HPP)
23#define XERCESC_INCLUDE_GUARD_BMPATTERN_HPP
24
25// ---------------------------------------------------------------------------
26//  Includes
27// ---------------------------------------------------------------------------
28#include <xercesc/util/XMemory.hpp>
29#include <icxercesc/util/PlatformUtils.hpp>
30
31XERCES_CPP_NAMESPACE_BEGIN
32
33class XMLUTIL_EXPORT BMPattern : public XMemory
34{
35public:
36    // -----------------------------------------------------------------------
37    //  Public Constructors and Destructor
38    // -----------------------------------------------------------------------
39    /** @name Constructors */
40    //@{
41
42    /**
43      * This is the constructor which takes the pattern information. A default
44      * shift table size is used.
45      *
46      * @param  pattern     The pattern to match against.
47      *
48      * @param  ignoreCase  A flag to indicate whether to ignore case
49      *                        matching or not.
50      *
51      * @param  manager     The configurable memory manager
52      */
53    BMPattern
54    (
55        const XMLCh* const pattern
56        , bool ignoreCase
57        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
58    );
59
60    /**
61      * This is the constructor which takes all of the information
62      * required to construct a BM pattern object.
63      *
64      * @param  pattern     The pattern to match against.
65      *
66      * @param    tableSize    Indicates the size of the shift table.
67      *
68      * @param  ignoreCase  A flag to indicate whether to ignore case
69      *                        matching or not.
70      *
71      * @param  manager     The configurable memory manager
72      */
73    BMPattern
74    (
75        const XMLCh* const pattern
76        , int tableSize
77        , bool ignoreCase
78        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
79    );
80
81    //@}
82
83    /** @name Destructor. */
84    //@{
85
86    /**
87      * Destructor of BMPattern
88      */
89    ~BMPattern();
90
91    //@}
92
93    // -----------------------------------------------------------------------
94    // Matching functions
95    // -----------------------------------------------------------------------
96    /** @name Matching Functions */
97    //@{
98
99    /**
100      *    This method will perform a match of the given content against a
101      *    predefined pattern.
102      */
103    int matches(const XMLCh* const content, XMLSize_t start, XMLSize_t limit) const;
104
105    //@}
106
107private :
108    // -----------------------------------------------------------------------
109    //  Unimplemented constructors and operators
110    // -----------------------------------------------------------------------
111    BMPattern();
112    BMPattern(const BMPattern&);
113    BMPattern& operator=(const BMPattern&);
114
115        // -----------------------------------------------------------------------
116    // This method will perform a case insensitive match
117    // -----------------------------------------------------------------------
118    bool matchesIgnoreCase(const XMLCh ch1, const XMLCh ch2);
119
120    // -----------------------------------------------------------------------
121    // Initialize/Clean up methods
122    // -----------------------------------------------------------------------
123    void initialize();
124    void cleanUp();
125
126    // -----------------------------------------------------------------------
127    //  Private data members
128    //
129    //  fPattern
130    //    fUppercasePattern
131    //      This is the pattern to match against, and its upper case form.
132    //       
133    //  fIgnoreCase
134    //      This is an indicator whether cases should be ignored during
135    //        matching.
136    //
137    //  fShiftTable
138    //    fShiftTableLen
139    //      This is a table of offsets for shifting purposes used by the BM
140    //        search algorithm, and its length.
141    // -----------------------------------------------------------------------
142    bool           fIgnoreCase;
143    unsigned int   fShiftTableLen;
144    XMLSize_t*     fShiftTable;
145    XMLCh*         fPattern;
146    XMLCh*         fUppercasePattern;
147    MemoryManager* fMemoryManager; 
148};
149
150XERCES_CPP_NAMESPACE_END
151
152#endif
153
154/*
155 * End of file BMPattern.hpp
156 */
157
Note: See TracBrowser for help on using the repository browser.