[358] | 1 | /*
|
---|
| 2 | * Copyright 2001,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 | /*
|
---|
| 18 | * $Id: SubstitutionGroupComparator.hpp,v 1.5 2004/09/08 13:56:57 peiyongz Exp $
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | #if !defined(SUBSTITUTIONGROUPCOMPARATOR_HPP)
|
---|
| 22 | #define SUBSTITUTIONGROUPCOMPARATOR_HPP
|
---|
| 23 |
|
---|
| 24 | #include <xercesc/util/StringPool.hpp>
|
---|
| 25 | #include <xercesc/util/QName.hpp>
|
---|
| 26 | #include <xercesc/validators/common/GrammarResolver.hpp>
|
---|
| 27 |
|
---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 29 |
|
---|
| 30 | class SchemaGrammar;
|
---|
| 31 |
|
---|
| 32 | class VALIDATORS_EXPORT SubstitutionGroupComparator : public XMemory
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
| 35 |
|
---|
| 36 | // -----------------------------------------------------------------------
|
---|
| 37 | // Public Constructor
|
---|
| 38 | // -----------------------------------------------------------------------
|
---|
| 39 | /** @name Constructor. */
|
---|
| 40 | //@{
|
---|
| 41 |
|
---|
| 42 | SubstitutionGroupComparator(GrammarResolver* const pGrammarResolver
|
---|
| 43 | , XMLStringPool* const pStringPool);
|
---|
| 44 |
|
---|
| 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 subsitution group.
|
---|
| 66 | *
|
---|
| 67 | * @param anElement QName of the element
|
---|
| 68 | *
|
---|
| 69 | * @param exeplar QName of the head element in the group
|
---|
| 70 | */
|
---|
| 71 | bool isEquivalentTo(QName* const anElement
|
---|
| 72 | , QName* const exemplar);
|
---|
| 73 | //@}
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | * check whether one element or any element in its substitution group
|
---|
| 77 | * is allowed by a given wildcard uri
|
---|
| 78 | *
|
---|
| 79 | * @param pGrammar the grammar where the wildcard is declared
|
---|
| 80 | * @param element the QName of a given element
|
---|
| 81 | * @param wuri the uri of the wildcard
|
---|
| 82 | * @param wother whether the uri is from ##other, so wuri is excluded
|
---|
| 83 | *
|
---|
| 84 | * @return whether the element is allowed by the wildcard
|
---|
| 85 | */
|
---|
| 86 | bool isAllowedByWildcard(SchemaGrammar* const pGrammar, QName* const element, unsigned int wuri, bool wother);
|
---|
| 87 |
|
---|
| 88 | private:
|
---|
| 89 | // -----------------------------------------------------------------------
|
---|
| 90 | // Unimplemented constructors and operators
|
---|
| 91 | // -----------------------------------------------------------------------
|
---|
| 92 | SubstitutionGroupComparator();
|
---|
| 93 | SubstitutionGroupComparator(const SubstitutionGroupComparator&);
|
---|
| 94 | SubstitutionGroupComparator& operator=(const SubstitutionGroupComparator&);
|
---|
| 95 |
|
---|
| 96 | // -----------------------------------------------------------------------
|
---|
| 97 | // Private data members
|
---|
| 98 | //
|
---|
| 99 | //
|
---|
| 100 | // -----------------------------------------------------------------------
|
---|
| 101 | GrammarResolver *fGrammarResolver;
|
---|
| 102 | XMLStringPool *fStringPool;
|
---|
| 103 | };
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | // ---------------------------------------------------------------------------
|
---|
| 107 | // SubstitutionGroupComparator: Getters
|
---|
| 108 | // ---------------------------------------------------------------------------
|
---|
| 109 | inline SubstitutionGroupComparator::SubstitutionGroupComparator(GrammarResolver* const pGrammarResolver
|
---|
| 110 | , XMLStringPool* const pStringPool)
|
---|
| 111 | :fGrammarResolver(pGrammarResolver)
|
---|
| 112 | ,fStringPool(pStringPool)
|
---|
| 113 | {}
|
---|
| 114 |
|
---|
| 115 | inline SubstitutionGroupComparator::~SubstitutionGroupComparator()
|
---|
| 116 | {}
|
---|
| 117 |
|
---|
| 118 | XERCES_CPP_NAMESPACE_END
|
---|
| 119 |
|
---|
| 120 | #endif
|
---|
| 121 |
|
---|
| 122 | /**
|
---|
| 123 | * End of file SubstitutionGroupComparator.hpp
|
---|
| 124 | */
|
---|
| 125 |
|
---|