source: obsolete/trunk/VUT/GtpVisibilityPreprocessor/support/xerces/include/xercesc/internal/XSObjectFactory.hpp @ 358

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

xerces added

Line 
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: XSObjectFactory.hpp,v $
19 * Revision 1.9  2004/09/08 13:56:14  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.8  2004/01/07 02:33:56  knoaman
23 * PSVI: inherit facets from base type
24 *
25 * Revision 1.7  2003/12/29 16:15:41  knoaman
26 * More PSVI updates
27 *
28 * Revision 1.6  2003/12/24 17:42:02  knoaman
29 * Misc. PSVI updates
30 *
31 * Revision 1.5  2003/12/17 20:50:35  knoaman
32 * PSVI: fix for annotation of attributes in attributeGroup/derived types
33 *
34 * Revision 1.4  2003/11/25 18:11:54  knoaman
35 * Make XSObjectFactory inherit from XMemory. Thanks to David Cargill.
36 *
37 * Revision 1.3  2003/11/24 15:45:36  knoaman
38 * PSVI: finish construction of XSSimpleTypeDefinition
39 *
40 * Revision 1.2  2003/11/23 16:21:40  knoaman
41 * PSVI: create local elements of complex types
42 *
43 * Revision 1.1  2003/11/21 17:11:24  knoaman
44 * Initial revision
45 *
46 */
47
48#if !defined(XSOBJECTFACTORY_HPP)
49#define XSOBJECTFACTORY_HPP
50
51#include <xercesc/framework/psvi/XSConstants.hpp>
52#include <xercesc/util/RefHashTableOf.hpp>
53
54XERCES_CPP_NAMESPACE_BEGIN
55
56class XSObject;
57class XSAttributeUse;
58class XSAttributeDeclaration;
59class XSModel;
60class XSElementDeclaration;
61class XSSimpleTypeDefinition;
62class XSComplexTypeDefinition;
63class XSModelGroupDefinition;
64class XSAttributeGroupDefinition;
65class XSWildcard;
66class XSParticle;
67class XSAnnotation;
68class XSNamespaceItem;
69class XSNotationDeclaration;
70class SchemaAttDef;
71class SchemaElementDecl;
72class DatatypeValidator;
73class ContentSpecNode;
74class ComplexTypeInfo;
75class XercesGroupInfo;
76class XercesAttGroupInfo;
77class XSIDCDefinition;
78class IdentityConstraint;
79class XMLNotationDecl;
80
81/**
82 * Factory class to create various XSObject(s)
83 * Used by XSModel
84 */
85class XMLPARSER_EXPORT XSObjectFactory : public XMemory
86{
87public:
88    // -----------------------------------------------------------------------
89    //  Constructors and Destructor
90    // -----------------------------------------------------------------------
91    XSObjectFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
92    ~XSObjectFactory();
93
94private:
95    // -----------------------------------------------------------------------
96    //  Unimplemented constructors and destructor
97    // -----------------------------------------------------------------------
98    XSObjectFactory(const XSObjectFactory&);
99    XSObjectFactory& operator=(const XSObjectFactory&);
100
101    // -----------------------------------------------------------------------
102    //  factory methods
103    // -----------------------------------------------------------------------
104    XSParticle* createModelGroupParticle
105    (
106        const ContentSpecNode* const node
107        , XSModel* const             xsModel
108    );
109
110    XSAttributeDeclaration* addOrFind
111    (
112        SchemaAttDef* const attDef
113        , XSModel* const xsModel
114        , XSComplexTypeDefinition* const enclosingTypeDef = 0
115    );
116
117    XSSimpleTypeDefinition* addOrFind
118    (
119        DatatypeValidator* const validator
120        , XSModel* const xsModel
121        , bool isAnySimpleType = false
122    );
123
124    XSElementDeclaration* addOrFind
125    (
126        SchemaElementDecl* const elemDecl
127        , XSModel* const xsModel
128        , XSComplexTypeDefinition* const enclosingTypeDef = 0
129    );
130
131    XSComplexTypeDefinition* addOrFind
132    (
133        ComplexTypeInfo* const typeInfo
134        , XSModel* const xsModel
135    );
136
137    XSIDCDefinition* addOrFind
138    (
139        IdentityConstraint* const ic
140        , XSModel* const xsModel
141    );
142
143    XSNotationDeclaration* addOrFind
144    (
145        XMLNotationDecl* const notDecl
146        , XSModel* const xsModel
147    );
148
149    XSAttributeUse* createXSAttributeUse
150    (
151        XSAttributeDeclaration* const xsAttDecl
152        , XSModel* const xsModel
153    );
154    XSWildcard* createXSWildcard
155    (
156        SchemaAttDef* const attDef
157        , XSModel* const xsModel
158    );
159
160    XSWildcard* createXSWildcard
161    (
162        const ContentSpecNode* const rootNode
163        , XSModel* const xsModel
164    );
165
166    XSModelGroupDefinition* createXSModelGroupDefinition
167    (
168        XercesGroupInfo* const groupInfo
169        , XSModel* const xsModel
170    );
171
172    XSAttributeGroupDefinition* createXSAttGroupDefinition
173    (
174        XercesAttGroupInfo* const attGroupInfo
175        , XSModel* const xsModel
176    );
177
178    // -----------------------------------------------------------------------
179    //  Helper methods
180    // -----------------------------------------------------------------------
181    // creates a particle corresponding to an element
182    XSParticle* createElementParticle
183    (
184        const ContentSpecNode* const rootNode
185        , XSModel* const             xsModel
186    );
187
188    // creates a particle corresponding to a wildcard
189    XSParticle* createWildcardParticle
190    (
191        const ContentSpecNode* const rootNode
192        , XSModel* const             xsModel
193    );
194
195    XSAnnotation* getAnnotationFromModel
196    (
197        XSModel* const xsModel
198        , const void* const key
199    );
200
201    void buildAllParticles
202    (
203        const ContentSpecNode* const rootNode
204        , XSParticleList* const particleList
205        , XSModel* const xsModel
206    );
207
208    void buildChoiceSequenceParticles
209    (
210        const ContentSpecNode* const rootNode
211        , XSParticleList* const particleList
212        , XSModel* const xsModel
213    );
214
215    void putObjectInMap
216    (
217        void* key
218        , XSObject* const object
219    );
220
221    XSObject* getObjectFromMap
222    (
223        void* key
224    );
225
226    void processFacets
227    (
228        DatatypeValidator* const dv
229        , XSModel* const xsModel
230        , XSSimpleTypeDefinition* const xsST
231    );
232
233    void processAttUse
234    (
235        SchemaAttDef* const attDef
236        , XSAttributeUse* const xsAttUse
237    );
238
239    bool isMultiValueFacetDefined(DatatypeValidator* const dv);
240
241    // make XSModel our friend
242    friend class XSModel;
243
244    // -----------------------------------------------------------------------
245    //  Private Data Members
246    //
247    //  fMemoryManager
248    //      The memory manager used to create various XSObject(s).
249    // -----------------------------------------------------------------------
250    MemoryManager*            fMemoryManager;
251    RefHashTableOf<XSObject>* fXercesToXSMap;
252    RefVectorOf<XSObject>*    fDeleteVector;
253};
254
255inline XSObject* XSObjectFactory::getObjectFromMap(void* key)
256{
257    return fXercesToXSMap->get(key);
258}
259
260
261XERCES_CPP_NAMESPACE_END
262
263#endif
Note: See TracBrowser for help on using the repository browser.