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