1 | /*
|
---|
2 | * Copyright 2003,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 | * $Log: XSIDCDefinition.hpp,v $
|
---|
19 | * Revision 1.7 2004/09/08 13:56:08 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.6 2003/12/01 23:23:26 neilg
|
---|
23 | * fix for bug 25118; thanks to Jeroen Witmond
|
---|
24 | *
|
---|
25 | * Revision 1.5 2003/11/21 17:29:53 knoaman
|
---|
26 | * PSVI update
|
---|
27 | *
|
---|
28 | * Revision 1.4 2003/11/14 22:47:53 neilg
|
---|
29 | * fix bogus log message from previous commit...
|
---|
30 | *
|
---|
31 | * Revision 1.3 2003/11/14 22:33:30 neilg
|
---|
32 | * Second phase of schema component model implementation.
|
---|
33 | * Implement XSModel, XSNamespaceItem, and the plumbing necessary
|
---|
34 | * to connect them to the other components.
|
---|
35 | * Thanks to David Cargill.
|
---|
36 | *
|
---|
37 | * Revision 1.2 2003/11/06 15:30:04 neilg
|
---|
38 | * first part of PSVI/schema component model implementation, thanks to David Cargill. This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
|
---|
39 | *
|
---|
40 | * Revision 1.1 2003/09/16 14:33:36 neilg
|
---|
41 | * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
|
---|
42 | *
|
---|
43 | */
|
---|
44 |
|
---|
45 | #if !defined(XSIDCDEFINITION_HPP)
|
---|
46 | #define XSIDCDEFINITION_HPP
|
---|
47 |
|
---|
48 | #include <xercesc/framework/psvi/XSObject.hpp>
|
---|
49 |
|
---|
50 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * This class describes all properties of a Schema Identity Constraint
|
---|
54 | * Definition component.
|
---|
55 | * This is *always* owned by the validator /parser object from which
|
---|
56 | * it is obtained.
|
---|
57 | */
|
---|
58 |
|
---|
59 | // forward declarations
|
---|
60 | class XSAnnotation;
|
---|
61 | class IdentityConstraint;
|
---|
62 |
|
---|
63 | class XMLPARSER_EXPORT XSIDCDefinition : public XSObject
|
---|
64 | {
|
---|
65 | public:
|
---|
66 |
|
---|
67 | // Identity Constraints
|
---|
68 | enum IC_CATEGORY {
|
---|
69 | /**
|
---|
70 | *
|
---|
71 | */
|
---|
72 | IC_KEY = 1,
|
---|
73 | /**
|
---|
74 | *
|
---|
75 | */
|
---|
76 | IC_KEYREF = 2,
|
---|
77 | /**
|
---|
78 | *
|
---|
79 | */
|
---|
80 | IC_UNIQUE = 3
|
---|
81 | };
|
---|
82 |
|
---|
83 | // Constructors and Destructor
|
---|
84 | // -----------------------------------------------------------------------
|
---|
85 | /** @name Constructors */
|
---|
86 | //@{
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * The default constructor
|
---|
90 | *
|
---|
91 | * @param identityConstraint
|
---|
92 | * @param keyIC
|
---|
93 | * @param headAnnot
|
---|
94 | * @param stringList
|
---|
95 | * @param xsModel
|
---|
96 | * @param manager The configurable memory manager
|
---|
97 | */
|
---|
98 | XSIDCDefinition
|
---|
99 | (
|
---|
100 | IdentityConstraint* const identityConstraint
|
---|
101 | , XSIDCDefinition* const keyIC
|
---|
102 | , XSAnnotation* const headAnnot
|
---|
103 | , StringList* const stringList
|
---|
104 | , XSModel* const xsModel
|
---|
105 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
106 | );
|
---|
107 |
|
---|
108 | //@};
|
---|
109 |
|
---|
110 | /** @name Destructor */
|
---|
111 | //@{
|
---|
112 | ~XSIDCDefinition();
|
---|
113 | //@}
|
---|
114 |
|
---|
115 | //---------------------
|
---|
116 | /** @name overridden XSXSObject methods */
|
---|
117 |
|
---|
118 | //@{
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * The name of type <code>NCName</code> of this declaration as defined in
|
---|
122 | * XML Namespaces.
|
---|
123 | */
|
---|
124 | const XMLCh* getName();
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * The [target namespace] of this object, or <code>null</code> if it is
|
---|
128 | * unspecified.
|
---|
129 | */
|
---|
130 | const XMLCh* getNamespace();
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * A namespace schema information item corresponding to the target
|
---|
134 | * namespace of the component, if it's globally declared; or null
|
---|
135 | * otherwise.
|
---|
136 | */
|
---|
137 | XSNamespaceItem *getNamespaceItem();
|
---|
138 |
|
---|
139 | //@}
|
---|
140 |
|
---|
141 | //---------------------
|
---|
142 | /** @name XSIDCDefinition methods */
|
---|
143 |
|
---|
144 | //@{
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * [identity-constraint category]: one of IC_KEY, IC_KEYREF or IC_UNIQUE.
|
---|
148 | */
|
---|
149 | IC_CATEGORY getCategory() const;
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * [selector]: a restricted XPath expression.
|
---|
153 | */
|
---|
154 | const XMLCh *getSelectorStr();
|
---|
155 |
|
---|
156 | /**
|
---|
157 | * [fields]: a non-empty list of restricted XPath ([XPath]) expressions.
|
---|
158 | */
|
---|
159 | StringList *getFieldStrs();
|
---|
160 |
|
---|
161 | /**
|
---|
162 | * [referenced key]: required if [identity-constraint category] is IC_KEYREF,
|
---|
163 | * forbidden otherwise (when an identity-constraint definition with [
|
---|
164 | * identity-constraint category] equal to IC_KEY or IC_UNIQUE).
|
---|
165 | */
|
---|
166 | XSIDCDefinition *getRefKey() const;
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * A set of [annotations].
|
---|
170 | */
|
---|
171 | XSAnnotationList *getAnnotations();
|
---|
172 |
|
---|
173 | //@}
|
---|
174 |
|
---|
175 | //----------------------------------
|
---|
176 | /** methods needed by implementation */
|
---|
177 |
|
---|
178 | //@{
|
---|
179 |
|
---|
180 | //@}
|
---|
181 | private:
|
---|
182 |
|
---|
183 | // -----------------------------------------------------------------------
|
---|
184 | // Unimplemented constructors and operators
|
---|
185 | // -----------------------------------------------------------------------
|
---|
186 | XSIDCDefinition(const XSIDCDefinition&);
|
---|
187 | XSIDCDefinition & operator=(const XSIDCDefinition &);
|
---|
188 |
|
---|
189 | protected:
|
---|
190 |
|
---|
191 | // -----------------------------------------------------------------------
|
---|
192 | // data members
|
---|
193 | // -----------------------------------------------------------------------
|
---|
194 | IdentityConstraint* fIdentityConstraint;
|
---|
195 | XSIDCDefinition* fKey;
|
---|
196 | StringList* fStringList;
|
---|
197 | XSAnnotationList* fXSAnnotationList;
|
---|
198 | };
|
---|
199 |
|
---|
200 |
|
---|
201 | inline StringList* XSIDCDefinition::getFieldStrs()
|
---|
202 | {
|
---|
203 | return fStringList;
|
---|
204 | }
|
---|
205 |
|
---|
206 | inline XSIDCDefinition* XSIDCDefinition::getRefKey() const
|
---|
207 | {
|
---|
208 | return fKey;
|
---|
209 | }
|
---|
210 |
|
---|
211 | XERCES_CPP_NAMESPACE_END
|
---|
212 |
|
---|
213 | #endif
|
---|