|
||||
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_VALUESTORE_HPP) 0023 #define XERCESC_INCLUDE_GUARD_VALUESTORE_HPP 0024 0025 /** 0026 * This class stores values associated to an identity constraint. 0027 * Each value stored corresponds to a field declared for the identity 0028 * constraint. 0029 */ 0030 0031 // --------------------------------------------------------------------------- 0032 // Includes 0033 // --------------------------------------------------------------------------- 0034 #include <xercesc/validators/schema/identity/FieldValueMap.hpp> 0035 #include <xercesc/util/RefHashTableOf.hpp> 0036 0037 XERCES_CPP_NAMESPACE_BEGIN 0038 0039 // --------------------------------------------------------------------------- 0040 // Forward Declaration 0041 // --------------------------------------------------------------------------- 0042 class FieldActivator; 0043 class IdentityConstraint; 0044 class XMLScanner; 0045 class ValueStoreCache; 0046 0047 struct ICValueHasher 0048 { 0049 ICValueHasher(MemoryManager* const manager) : fMemoryManager(manager) {} 0050 0051 XMLSize_t getHashVal(const void* key, XMLSize_t mod) const; 0052 bool equals(const void *const key1, const void *const key2) const; 0053 0054 // ----------------------------------------------------------------------- 0055 // Helper methods 0056 // ----------------------------------------------------------------------- 0057 /** 0058 * Returns whether a field associated <DatatypeValidator, String> value 0059 * is a duplicate of another associated value. 0060 * It is a duplicate only if either of these conditions are true: 0061 * - The Datatypes are the same or related by derivation and the values 0062 * are in the same valuespace. 0063 * - The datatypes are unrelated and the values are Stringwise identical. 0064 */ 0065 bool isDuplicateOf(DatatypeValidator* const dv1, const XMLCh* const val1, 0066 DatatypeValidator* const dv2, const XMLCh* const val2) const; 0067 0068 0069 MemoryManager* fMemoryManager; 0070 }; 0071 0072 class VALIDATORS_EXPORT ValueStore : public XMemory 0073 { 0074 public: 0075 // ----------------------------------------------------------------------- 0076 // Constructors/Destructor 0077 // ----------------------------------------------------------------------- 0078 ValueStore(IdentityConstraint* const ic, 0079 XMLScanner* const scanner, 0080 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 0081 ~ValueStore(); 0082 0083 // ----------------------------------------------------------------------- 0084 // Getter methods 0085 // ----------------------------------------------------------------------- 0086 IdentityConstraint* getIdentityConstraint() const; 0087 0088 // ----------------------------------------------------------------------- 0089 // Helper methods 0090 // ----------------------------------------------------------------------- 0091 void append(const ValueStore* const other); 0092 void startValueScope(); 0093 void endValueScope(); 0094 void addValue(FieldActivator* const fieldActivator, 0095 IC_Field* const field, 0096 DatatypeValidator* const dv, 0097 const XMLCh* const value); 0098 bool contains(const FieldValueMap* const other); 0099 void clear(); 0100 0101 // ----------------------------------------------------------------------- 0102 // Document handling methods 0103 // ----------------------------------------------------------------------- 0104 void endDocumentFragment(ValueStoreCache* const valueStoreCache); 0105 0106 // ----------------------------------------------------------------------- 0107 // Error reporting methods 0108 // ----------------------------------------------------------------------- 0109 void duplicateValue(); 0110 void reportNilError(IdentityConstraint* const ic); 0111 0112 private: 0113 // ----------------------------------------------------------------------- 0114 // Unimplemented constructors and operators 0115 // ----------------------------------------------------------------------- 0116 ValueStore(const ValueStore& other); 0117 ValueStore& operator= (const ValueStore& other); 0118 0119 // ----------------------------------------------------------------------- 0120 // Data 0121 // ----------------------------------------------------------------------- 0122 bool fDoReportError; 0123 XMLSize_t fValuesCount; 0124 IdentityConstraint* fIdentityConstraint; 0125 FieldValueMap fValues; 0126 RefHashTableOf<FieldValueMap, ICValueHasher>* fValueTuples; 0127 XMLScanner* fScanner; // for error reporting - REVISIT 0128 MemoryManager* fMemoryManager; 0129 }; 0130 0131 // --------------------------------------------------------------------------- 0132 // ValueStore: Getter methods 0133 // --------------------------------------------------------------------------- 0134 inline IdentityConstraint* 0135 ValueStore::getIdentityConstraint() const { 0136 return fIdentityConstraint; 0137 } 0138 0139 XERCES_CPP_NAMESPACE_END 0140 0141 #endif 0142 0143 /** 0144 * End of file ValueStore.hpp 0145 */ 0146
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |