[111] | 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: XSAttributeUse.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(XSATTRIBUTEUSE_HPP) |
---|
| 23 | #define XSATTRIBUTEUSE_HPP |
---|
| 24 | |
---|
| 25 | #include <xercesc/framework/psvi/XSObject.hpp> |
---|
| 26 | |
---|
| 27 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * This class describes all properties of a Schema Attribute |
---|
| 31 | * Use component. |
---|
| 32 | * This is *always* owned by the validator /parser object from which |
---|
| 33 | * it is obtained. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | // forward declarations |
---|
| 37 | class XSAttributeDeclaration; |
---|
| 38 | |
---|
| 39 | class XMLPARSER_EXPORT XSAttributeUse : public XSObject |
---|
| 40 | { |
---|
| 41 | public: |
---|
| 42 | |
---|
| 43 | // Constructors and Destructor |
---|
| 44 | // ----------------------------------------------------------------------- |
---|
| 45 | /** @name Constructors */ |
---|
| 46 | //@{ |
---|
| 47 | |
---|
| 48 | /** |
---|
| 49 | * The default constructor |
---|
| 50 | * @param xsAttDecl |
---|
| 51 | * @param xsModel |
---|
| 52 | * @param manager The configurable memory manager |
---|
| 53 | */ |
---|
| 54 | XSAttributeUse |
---|
| 55 | ( |
---|
| 56 | XSAttributeDeclaration* const xsAttDecl, |
---|
| 57 | XSModel* const xsModel, |
---|
| 58 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 59 | ); |
---|
| 60 | |
---|
| 61 | //@}; |
---|
| 62 | |
---|
| 63 | /** @name Destructor */ |
---|
| 64 | //@{ |
---|
| 65 | ~XSAttributeUse(); |
---|
| 66 | //@} |
---|
| 67 | |
---|
| 68 | //--------------------- |
---|
| 69 | /** @name XSAttributeUse methods */ |
---|
| 70 | |
---|
| 71 | //@{ |
---|
| 72 | |
---|
| 73 | /** |
---|
| 74 | * [required]: determines whether this use of an attribute declaration |
---|
| 75 | * requires an appropriate attribute information item to be present, or |
---|
| 76 | * merely allows it. |
---|
| 77 | */ |
---|
| 78 | bool getRequired() const; |
---|
| 79 | |
---|
| 80 | /** |
---|
| 81 | * [attribute declaration]: provides the attribute declaration itself, |
---|
| 82 | * which will in turn determine the simple type definition used. |
---|
| 83 | */ |
---|
| 84 | XSAttributeDeclaration *getAttrDeclaration() const; |
---|
| 85 | |
---|
| 86 | /** |
---|
| 87 | * Value Constraint: one of default, fixed. |
---|
| 88 | */ |
---|
| 89 | XSConstants::VALUE_CONSTRAINT getConstraintType() const; |
---|
| 90 | |
---|
| 91 | /** |
---|
| 92 | * Value Constraint: The actual value. |
---|
| 93 | */ |
---|
| 94 | const XMLCh *getConstraintValue(); |
---|
| 95 | |
---|
| 96 | //@} |
---|
| 97 | |
---|
| 98 | //---------------------------------- |
---|
| 99 | /** methods needed by implementation */ |
---|
| 100 | |
---|
| 101 | //@{ |
---|
| 102 | |
---|
| 103 | //@} |
---|
| 104 | |
---|
| 105 | private: |
---|
| 106 | |
---|
| 107 | // set data |
---|
| 108 | void set |
---|
| 109 | ( |
---|
| 110 | const bool isRequired |
---|
| 111 | , XSConstants::VALUE_CONSTRAINT constraintType |
---|
| 112 | , const XMLCh* const constraintValue |
---|
| 113 | ); |
---|
| 114 | |
---|
| 115 | friend class XSObjectFactory; |
---|
| 116 | |
---|
| 117 | // ----------------------------------------------------------------------- |
---|
| 118 | // Unimplemented constructors and operators |
---|
| 119 | // ----------------------------------------------------------------------- |
---|
| 120 | XSAttributeUse(const XSAttributeUse&); |
---|
| 121 | XSAttributeUse & operator=(const XSAttributeUse &); |
---|
| 122 | |
---|
| 123 | protected: |
---|
| 124 | |
---|
| 125 | // ----------------------------------------------------------------------- |
---|
| 126 | // data members |
---|
| 127 | // ----------------------------------------------------------------------- |
---|
| 128 | bool fRequired; |
---|
| 129 | XSConstants::VALUE_CONSTRAINT fConstraintType; |
---|
| 130 | const XMLCh* fConstraintValue; |
---|
| 131 | XSAttributeDeclaration* fXSAttributeDeclaration; |
---|
| 132 | }; |
---|
| 133 | |
---|
| 134 | inline XSAttributeDeclaration *XSAttributeUse::getAttrDeclaration() const |
---|
| 135 | { |
---|
| 136 | return fXSAttributeDeclaration; |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | inline bool XSAttributeUse::getRequired() const |
---|
| 140 | { |
---|
| 141 | return fRequired; |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | inline XSConstants::VALUE_CONSTRAINT XSAttributeUse::getConstraintType() const |
---|
| 145 | { |
---|
| 146 | return fConstraintType; |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | inline const XMLCh *XSAttributeUse::getConstraintValue() |
---|
| 150 | { |
---|
| 151 | return fConstraintValue; |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | XERCES_CPP_NAMESPACE_END |
---|
| 155 | |
---|
| 156 | #endif |
---|