source: NonGTP/Xerces/xerces/include/xercesc/validators/schema/identity/ValueStore.hpp @ 358

Revision 358, 5.4 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2001-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: ValueStore.hpp,v 1.7 2004/09/08 13:56:59 peiyongz Exp $
19 */
20
21#if !defined(VALUESTORE_HPP)
22#define VALUESTORE_HPP
23
24/**
25  * This class stores values associated to an identity constraint.
26  * Each value stored corresponds to a field declared for the identity
27  * constraint.
28  */
29
30// ---------------------------------------------------------------------------
31//  Includes
32// ---------------------------------------------------------------------------
33#include <xercesc/validators/schema/identity/FieldValueMap.hpp>
34#include <xercesc/util/RefVectorOf.hpp>
35
36XERCES_CPP_NAMESPACE_BEGIN
37
38// ---------------------------------------------------------------------------
39//  Forward Declaration
40// ---------------------------------------------------------------------------
41class IdentityConstraint;
42class XMLScanner;
43class ValueStoreCache;
44
45
46class VALIDATORS_EXPORT ValueStore : public XMemory
47{
48public:
49    // -----------------------------------------------------------------------
50    //  Constructors/Destructor
51    // -----------------------------------------------------------------------
52    ValueStore(IdentityConstraint* const ic,
53               XMLScanner* const scanner,
54               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
55        ~ValueStore();
56
57    // -----------------------------------------------------------------------
58    //  Getter methods
59    // -----------------------------------------------------------------------
60    IdentityConstraint* getIdentityConstraint() const;
61
62    // -----------------------------------------------------------------------
63    //  Helper methods
64    // -----------------------------------------------------------------------
65    void append(const ValueStore* const other);
66    void startValueScope();
67    void endValueScope();
68    void addValue(FieldActivator* const fieldActivator,
69                  IC_Field* const field,
70                  DatatypeValidator* const dv,
71                  const XMLCh* const value);
72    bool contains(const FieldValueMap* const other);
73
74    /**
75      * @deprecated
76      */
77    void addValue(IC_Field* const field, DatatypeValidator* const dv,
78                  const XMLCh* const value);
79
80
81    // -----------------------------------------------------------------------
82    //  Document handling methods
83    // -----------------------------------------------------------------------
84    void endDcocumentFragment(ValueStoreCache* const valueStoreCache);
85
86    // -----------------------------------------------------------------------
87    //  Error reporting methods
88    // -----------------------------------------------------------------------
89    void duplicateValue();
90    void reportNilError(IdentityConstraint* const ic);
91
92private:
93    // -----------------------------------------------------------------------
94    //  Unimplemented contstructors and operators
95    // -----------------------------------------------------------------------
96    ValueStore(const ValueStore& other);
97    ValueStore& operator= (const ValueStore& other);
98
99    // -----------------------------------------------------------------------
100    //  Helper methods
101    // -----------------------------------------------------------------------
102    /**
103      * Returns whether a field associated <DatatypeValidator, String> value
104      * is a duplicate of another associated value.
105      * It is a duplicate only if either of these conditions are true:
106      * - The Datatypes are the same or related by derivation and the values
107      *   are in the same valuespace.
108      * - The datatypes are unrelated and the values are Stringwise identical.
109      */
110    bool isDuplicateOf(DatatypeValidator* const dv1, const XMLCh* const val1,
111                       DatatypeValidator* const dv2, const XMLCh* const val2);
112
113
114    // -----------------------------------------------------------------------
115    //  Data
116    // -----------------------------------------------------------------------
117    bool                        fDoReportError;
118    int                         fValuesCount;
119    IdentityConstraint*         fIdentityConstraint;
120    FieldValueMap               fValues;
121    RefVectorOf<FieldValueMap>* fValueTuples;
122    ValueStore*                 fKeyValueStore;
123    XMLScanner*                 fScanner; // for error reporting - REVISIT
124    MemoryManager*              fMemoryManager;
125};
126
127// ---------------------------------------------------------------------------
128//  ValueStore: Getter methods
129// ---------------------------------------------------------------------------
130inline IdentityConstraint*
131ValueStore::getIdentityConstraint() const {
132    return fIdentityConstraint;
133}
134
135XERCES_CPP_NAMESPACE_END
136
137#endif
138
139/**
140  * End of file ValueStore.hpp
141  */
142
Note: See TracBrowser for help on using the repository browser.