source: icXML/icXML-devel/src/icxercesc/validators/schema/SubstitutionGroupComparator.hpp @ 2734

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

More paths and missing files.

File size: 4.4 KB
Line 
1/*
2 * Unless required by applicable law or agreed to in writing, software
3 * distributed under the License is distributed on an "AS IS" BASIS,
4 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 * See the License for the specific language governing permissions and
6 * limitations under the License.
7 */
8
9/*
10 * $Id: SubstitutionGroupComparator.hpp 932887 2010-04-11 13:04:59Z borisk $
11 */
12
13#if !defined(XERCESC_INCLUDE_GUARD_SUBSTITUTIONGROUPCOMPARATOR_HPP)
14#define XERCESC_INCLUDE_GUARD_SUBSTITUTIONGROUPCOMPARATOR_HPP
15
16#include <xercesc/util/StringPool.hpp>
17#include <icxercesc/util/QName.hpp>
18#include <icxercesc/validators/common/GrammarResolver.hpp>
19#include <icxmlc/XMLConfig.hpp>
20
21#ifdef TEST_NAMESPACE_RESOLVER
22#include <icxmlc/XMLNamespaceResolver.hpp>
23#endif
24
25XERCES_CPP_NAMESPACE_BEGIN
26
27class SchemaGrammar;
28
29class VALIDATORS_EXPORT SubstitutionGroupComparator : public XMemory
30{
31public:
32
33        // -----------------------------------------------------------------------
34        //  Public Constructor
35        // -----------------------------------------------------------------------
36        /** @name Constructor. */
37        //@{
38
39        SubstitutionGroupComparator( GrammarResolver*           const pGrammarResolver
40                                                           , XMLStringPool*                     const pStringPool);
41
42
43        SubstitutionGroupComparator( GrammarResolver*           const pGrammarResolver
44                                                           , XMLNamespaceResolver*      const pUriResolver);
45
46        //@}
47
48        // -----------------------------------------------------------------------
49        //  Public Destructor
50        // -----------------------------------------------------------------------
51        /** @name Destructor. */
52        //@{
53
54        ~SubstitutionGroupComparator();
55
56        //@}
57
58        // -----------------------------------------------------------------------
59        // Validation methods
60        // -----------------------------------------------------------------------
61        /** @name Validation Function */
62        //@{
63
64        /**
65           * Checks that the "anElement" is within the substitution group.
66           *
67           * @param  anElement   QName of the element
68           *
69           * @param  exemplar     QName of the head element in the group
70           */
71        bool isEquivalentTo(const QName* const anElement
72                                          , const QName* const exemplar);
73
74        bool isEquivalentTo(const XMLElementDecl * const anElement
75                                          , const QName* const                   exemplar);
76
77         //@}
78
79        /*
80         * check whether one element or any element in its substitution group
81         * is allowed by a given wildcard uri
82         *
83         * @param pGrammar the grammar where the wildcard is declared
84         * @param element  the QName of a given element
85         * @param wuri     the uri of the wildcard
86         * @param wother   whether the uri is from ##other, so wuri is excluded
87         *
88         * @return whether the element is allowed by the wildcard
89         */
90        bool isAllowedByWildcard(SchemaGrammar* const pGrammar, QName* const element, unsigned int wuri, bool wother);
91
92private:
93        // -----------------------------------------------------------------------
94        //  Unimplemented constructors and operators
95        // -----------------------------------------------------------------------
96        SubstitutionGroupComparator();
97        SubstitutionGroupComparator(const SubstitutionGroupComparator&);
98        SubstitutionGroupComparator& operator=(const SubstitutionGroupComparator&);
99
100        // -----------------------------------------------------------------------
101        //  Private data members
102        //
103        //
104        // -----------------------------------------------------------------------
105        GrammarResolver *               fGrammarResolver;
106        XMLNamespaceResolver *  fUriResolver;
107};
108
109
110// ---------------------------------------------------------------------------
111//  SubstitutionGroupComparator: Getters
112// ---------------------------------------------------------------------------
113inline SubstitutionGroupComparator::SubstitutionGroupComparator
114(
115        GrammarResolver*        const pGrammarResolver
116        , XMLStringPool*                const
117)
118        : fGrammarResolver(pGrammarResolver)
119        , fUriResolver(0)
120{
121        DEPRECATED_FEATURE_IN_ICXML;
122}
123
124inline SubstitutionGroupComparator::SubstitutionGroupComparator
125(
126        GrammarResolver*                const pGrammarResolver
127        , XMLNamespaceResolver* const pUriResolver
128)
129        : fGrammarResolver(pGrammarResolver)
130        , fUriResolver(pUriResolver)
131{
132
133}
134
135inline SubstitutionGroupComparator::~SubstitutionGroupComparator()
136{
137
138}
139
140inline bool
141SubstitutionGroupComparator::isEquivalentTo
142(
143        const XMLElementDecl * const anElement
144        , const QName* const                     exemplar
145)
146{
147        return isEquivalentTo(anElement->getElementName(), exemplar);
148}
149
150XERCES_CPP_NAMESPACE_END
151
152#endif
153
154/**
155  * End of file SubstitutionGroupComparator.hpp
156  */
157
Note: See TracBrowser for help on using the repository browser.