|
||||
File indexing completed on 2025-01-18 10:15:18
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_IDENTITYCONSTRAINT_HPP) 0023 #define XERCESC_INCLUDE_GUARD_IDENTITYCONSTRAINT_HPP 0024 0025 0026 /** 0027 * The class act as a base class for schema identity constraints. 0028 */ 0029 0030 // --------------------------------------------------------------------------- 0031 // Includes 0032 // --------------------------------------------------------------------------- 0033 #include <xercesc/util/RefVectorOf.hpp> 0034 #include <xercesc/validators/schema/identity/IC_Field.hpp> 0035 0036 #include <xercesc/internal/XSerializable.hpp> 0037 0038 XERCES_CPP_NAMESPACE_BEGIN 0039 0040 // --------------------------------------------------------------------------- 0041 // Forward Declarations 0042 // --------------------------------------------------------------------------- 0043 class IC_Selector; 0044 0045 class VALIDATORS_EXPORT IdentityConstraint : public XSerializable, public XMemory 0046 { 0047 public: 0048 // ----------------------------------------------------------------------- 0049 // Constants 0050 // ----------------------------------------------------------------------- 0051 enum ICType { 0052 ICType_UNIQUE = 0, 0053 ICType_KEY = 1, 0054 ICType_KEYREF = 2, 0055 ICType_UNKNOWN 0056 }; 0057 0058 // ----------------------------------------------------------------------- 0059 // Constructors/Destructor 0060 // ----------------------------------------------------------------------- 0061 virtual ~IdentityConstraint(); 0062 0063 // ----------------------------------------------------------------------- 0064 // operators 0065 // ----------------------------------------------------------------------- 0066 bool operator== (const IdentityConstraint& other) const; 0067 bool operator!= (const IdentityConstraint& other) const; 0068 0069 // ----------------------------------------------------------------------- 0070 // Getter methods 0071 // ----------------------------------------------------------------------- 0072 virtual short getType() const = 0; 0073 XMLSize_t getFieldCount() const; 0074 XMLCh* getIdentityConstraintName() const; 0075 XMLCh* getElementName() const; 0076 IC_Selector* getSelector() const; 0077 int getNamespaceURI() const; 0078 0079 // ----------------------------------------------------------------------- 0080 // Setter methods 0081 // ----------------------------------------------------------------------- 0082 void setSelector(IC_Selector* const selector); 0083 void setNamespaceURI(int uri); 0084 0085 // ----------------------------------------------------------------------- 0086 // Access methods 0087 // ----------------------------------------------------------------------- 0088 void addField(IC_Field* const field); 0089 const IC_Field* getFieldAt(const XMLSize_t index) const; 0090 IC_Field* getFieldAt(const XMLSize_t index); 0091 0092 /*** 0093 * Support for Serialization/De-serialization 0094 ***/ 0095 DECL_XSERIALIZABLE(IdentityConstraint) 0096 0097 static void storeIC(XSerializeEngine& serEng 0098 , IdentityConstraint* const ic); 0099 0100 static IdentityConstraint* loadIC(XSerializeEngine& serEng); 0101 0102 protected: 0103 // ----------------------------------------------------------------------- 0104 // Constructors/Destructor 0105 // ----------------------------------------------------------------------- 0106 IdentityConstraint(const XMLCh* const identityConstraintName, 0107 const XMLCh* const elementName, 0108 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 0109 0110 private: 0111 // ----------------------------------------------------------------------- 0112 // Unimplemented constructors and operators 0113 // ----------------------------------------------------------------------- 0114 IdentityConstraint(const IdentityConstraint& other); 0115 IdentityConstraint& operator= (const IdentityConstraint& other); 0116 0117 // ----------------------------------------------------------------------- 0118 // CleanUp methods 0119 // ----------------------------------------------------------------------- 0120 void cleanUp(); 0121 0122 // ----------------------------------------------------------------------- 0123 // Data members 0124 // 0125 // fIdentityConstraintName 0126 // The identity constraint name 0127 // 0128 // fElemName 0129 // The element name 0130 // 0131 // fSelector 0132 // The selector information 0133 // 0134 // fFields 0135 // The field(s) information 0136 // ----------------------------------------------------------------------- 0137 XMLCh* fIdentityConstraintName; 0138 XMLCh* fElemName; 0139 IC_Selector* fSelector; 0140 RefVectorOf<IC_Field>* fFields; 0141 MemoryManager* fMemoryManager; 0142 int fNamespaceURI; 0143 }; 0144 0145 0146 // --------------------------------------------------------------------------- 0147 // IdentityConstraint: Getter methods 0148 // --------------------------------------------------------------------------- 0149 inline XMLSize_t IdentityConstraint::getFieldCount() const { 0150 0151 if (fFields) { 0152 return fFields->size(); 0153 } 0154 0155 return 0; 0156 } 0157 0158 inline XMLCh* IdentityConstraint::getIdentityConstraintName() const { 0159 0160 return fIdentityConstraintName; 0161 } 0162 0163 inline XMLCh* IdentityConstraint::getElementName() const { 0164 0165 return fElemName; 0166 } 0167 0168 inline IC_Selector* IdentityConstraint::getSelector() const { 0169 0170 return fSelector; 0171 } 0172 0173 inline int IdentityConstraint::getNamespaceURI() const 0174 { 0175 return fNamespaceURI; 0176 } 0177 0178 // --------------------------------------------------------------------------- 0179 // IdentityConstraint: Setter methods 0180 // --------------------------------------------------------------------------- 0181 inline void IdentityConstraint::setNamespaceURI(int uri) 0182 { 0183 fNamespaceURI = uri; 0184 } 0185 0186 // --------------------------------------------------------------------------- 0187 // IdentityConstraint: Access methods 0188 // --------------------------------------------------------------------------- 0189 inline void IdentityConstraint::addField(IC_Field* const field) { 0190 0191 if (!fFields) { 0192 fFields = new (fMemoryManager) RefVectorOf<IC_Field>(4, true, fMemoryManager); 0193 } 0194 0195 fFields->addElement(field); 0196 } 0197 0198 inline const IC_Field* IdentityConstraint::getFieldAt(const XMLSize_t index) const { 0199 0200 if (fFields) { 0201 return (fFields->elementAt(index)); 0202 } 0203 0204 return 0; 0205 } 0206 0207 inline IC_Field* IdentityConstraint::getFieldAt(const XMLSize_t index) { 0208 0209 if (fFields) { 0210 return (fFields->elementAt(index)); 0211 } 0212 0213 return 0; 0214 } 0215 0216 XERCES_CPP_NAMESPACE_END 0217 0218 #endif 0219 0220 /** 0221 * End of file IdentityConstraint.hpp 0222 */ 0223
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |