[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: XercesGroupInfo.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(XERCESGROUPINFO_HPP) |
---|
| 23 | #define XERCESGROUPINFO_HPP |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * The class act as a place holder to store group information. |
---|
| 28 | * |
---|
| 29 | * The class is intended for internal use. |
---|
| 30 | */ |
---|
| 31 | |
---|
| 32 | // --------------------------------------------------------------------------- |
---|
| 33 | // Includes |
---|
| 34 | // --------------------------------------------------------------------------- |
---|
| 35 | #include <xercesc/util/RefVectorOf.hpp> |
---|
| 36 | #include <xercesc/validators/schema/SchemaElementDecl.hpp> |
---|
| 37 | |
---|
| 38 | #include <xercesc/internal/XSerializable.hpp> |
---|
| 39 | |
---|
| 40 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 41 | |
---|
| 42 | // --------------------------------------------------------------------------- |
---|
| 43 | // Forward Declarations |
---|
| 44 | // --------------------------------------------------------------------------- |
---|
| 45 | class ContentSpecNode; |
---|
| 46 | class XSDLocator; |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | class VALIDATORS_EXPORT XercesGroupInfo : public XSerializable, public XMemory |
---|
| 50 | { |
---|
| 51 | public: |
---|
| 52 | // ----------------------------------------------------------------------- |
---|
| 53 | // Public Constructors/Destructor |
---|
| 54 | // ----------------------------------------------------------------------- |
---|
| 55 | XercesGroupInfo |
---|
| 56 | ( |
---|
| 57 | unsigned int groupNameId |
---|
| 58 | , unsigned int groupNamespaceId |
---|
| 59 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 60 | ); |
---|
| 61 | ~XercesGroupInfo(); |
---|
| 62 | |
---|
| 63 | // ----------------------------------------------------------------------- |
---|
| 64 | // Getter methods |
---|
| 65 | // ----------------------------------------------------------------------- |
---|
| 66 | bool getCheckElementConsistency() const; |
---|
| 67 | int getScope() const; |
---|
| 68 | unsigned int elementCount() const; |
---|
| 69 | ContentSpecNode* getContentSpec() const; |
---|
| 70 | SchemaElementDecl* elementAt(const unsigned int index); |
---|
| 71 | const SchemaElementDecl* elementAt(const unsigned int index) const; |
---|
| 72 | XSDLocator* getLocator() const; |
---|
| 73 | XercesGroupInfo* getBaseGroup() const; |
---|
| 74 | unsigned int getNameId() const; |
---|
| 75 | unsigned int getNamespaceId() const; |
---|
| 76 | |
---|
| 77 | // ----------------------------------------------------------------------- |
---|
| 78 | // Setter methods |
---|
| 79 | // ----------------------------------------------------------------------- |
---|
| 80 | void setScope(const int other); |
---|
| 81 | void setContentSpec(ContentSpecNode* const other); |
---|
| 82 | void addElement(SchemaElementDecl* const toAdd); |
---|
| 83 | void setLocator(XSDLocator* const aLocator); |
---|
| 84 | void setBaseGroup(XercesGroupInfo* const baseGroup); |
---|
| 85 | void setCheckElementConsistency(const bool aValue); |
---|
| 86 | |
---|
| 87 | /*** |
---|
| 88 | * Support for Serialization/De-serialization |
---|
| 89 | ***/ |
---|
| 90 | DECL_XSERIALIZABLE(XercesGroupInfo) |
---|
| 91 | XercesGroupInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 92 | |
---|
| 93 | private: |
---|
| 94 | // ----------------------------------------------------------------------- |
---|
| 95 | // Unimplemented contstructors and operators |
---|
| 96 | // ----------------------------------------------------------------------- |
---|
| 97 | XercesGroupInfo(const XercesGroupInfo& elemInfo); |
---|
| 98 | XercesGroupInfo& operator= (const XercesGroupInfo& other); |
---|
| 99 | |
---|
| 100 | // ----------------------------------------------------------------------- |
---|
| 101 | // Private data members |
---|
| 102 | // ----------------------------------------------------------------------- |
---|
| 103 | bool fCheckElementConsistency; |
---|
| 104 | int fScope; |
---|
| 105 | unsigned int fNameId; |
---|
| 106 | unsigned int fNamespaceId; |
---|
| 107 | ContentSpecNode* fContentSpec; |
---|
| 108 | RefVectorOf<SchemaElementDecl>* fElements; |
---|
| 109 | XercesGroupInfo* fBaseGroup; // redefine by restriction |
---|
| 110 | XSDLocator* fLocator; |
---|
| 111 | }; |
---|
| 112 | |
---|
| 113 | // --------------------------------------------------------------------------- |
---|
| 114 | // XercesGroupInfo: Getter methods |
---|
| 115 | // --------------------------------------------------------------------------- |
---|
| 116 | inline int XercesGroupInfo::getScope() const { |
---|
| 117 | |
---|
| 118 | return fScope; |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | inline unsigned int XercesGroupInfo::elementCount() const { |
---|
| 122 | |
---|
| 123 | return fElements->size(); |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | inline ContentSpecNode* XercesGroupInfo::getContentSpec() const { |
---|
| 127 | |
---|
| 128 | return fContentSpec; |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | inline SchemaElementDecl* |
---|
| 132 | XercesGroupInfo::elementAt(const unsigned int index) { |
---|
| 133 | |
---|
| 134 | return fElements->elementAt(index); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | inline const SchemaElementDecl* |
---|
| 138 | XercesGroupInfo::elementAt(const unsigned int index) const { |
---|
| 139 | |
---|
| 140 | return fElements->elementAt(index); |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | inline XSDLocator* XercesGroupInfo::getLocator() const { |
---|
| 144 | |
---|
| 145 | return fLocator; |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | inline XercesGroupInfo* XercesGroupInfo::getBaseGroup() const { |
---|
| 149 | |
---|
| 150 | return fBaseGroup; |
---|
| 151 | } |
---|
| 152 | |
---|
| 153 | inline bool XercesGroupInfo::getCheckElementConsistency() const { |
---|
| 154 | |
---|
| 155 | return fCheckElementConsistency; |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | inline unsigned int XercesGroupInfo::getNameId() const |
---|
| 159 | { |
---|
| 160 | return fNameId; |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | inline unsigned int XercesGroupInfo::getNamespaceId() const |
---|
| 164 | { |
---|
| 165 | return fNamespaceId; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | // --------------------------------------------------------------------------- |
---|
| 169 | // XercesGroupInfo: Setter methods |
---|
| 170 | // ---------------------------------------------------------------------------} |
---|
| 171 | inline void XercesGroupInfo::setScope(const int other) { |
---|
| 172 | |
---|
| 173 | fScope = other; |
---|
| 174 | } |
---|
| 175 | |
---|
| 176 | inline void XercesGroupInfo::setContentSpec(ContentSpecNode* const other) { |
---|
| 177 | |
---|
| 178 | fContentSpec = other; |
---|
| 179 | } |
---|
| 180 | |
---|
| 181 | inline void XercesGroupInfo::addElement(SchemaElementDecl* const elem) { |
---|
| 182 | |
---|
| 183 | if (!fElements->containsElement(elem)) |
---|
| 184 | fElements->addElement(elem); |
---|
| 185 | } |
---|
| 186 | |
---|
| 187 | inline void XercesGroupInfo::setBaseGroup(XercesGroupInfo* const baseGroup) { |
---|
| 188 | |
---|
| 189 | fBaseGroup = baseGroup; |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | inline void XercesGroupInfo::setCheckElementConsistency(const bool aValue) { |
---|
| 193 | |
---|
| 194 | fCheckElementConsistency = aValue; |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | XERCES_CPP_NAMESPACE_END |
---|
| 198 | |
---|
| 199 | #endif |
---|
| 200 | |
---|
| 201 | /** |
---|
| 202 | * End of file XercesGroupInfo.hpp |
---|
| 203 | */ |
---|
| 204 | |
---|