source: icXML/icXML-devel/src/xercesc/internal/XSObjectFactory.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 6.4 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: XSObjectFactory.hpp 678409 2008-07-21 13:08:10Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XSOBJECTFACTORY_HPP)
23#define XERCESC_INCLUDE_GUARD_XSOBJECTFACTORY_HPP
24
25#include <xercesc/framework/psvi/XSConstants.hpp>
26#include <icxercesc/util/RefHashTableOf.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30class XSObject;
31class XSAttributeUse;
32class XSAttributeDeclaration;
33class XSModel;
34class XSElementDeclaration;
35class XSSimpleTypeDefinition;
36class XSComplexTypeDefinition;
37class XSModelGroupDefinition;
38class XSAttributeGroupDefinition;
39class XSWildcard;
40class XSParticle;
41class XSAnnotation;
42class XSNamespaceItem;
43class XSNotationDeclaration;
44class SchemaAttDef;
45class SchemaElementDecl;
46class DatatypeValidator;
47class ContentSpecNode;
48class ComplexTypeInfo;
49class XercesGroupInfo;
50class XercesAttGroupInfo;
51class XSIDCDefinition;
52class IdentityConstraint;
53class XMLNotationDecl;
54
55/**
56 * Factory class to create various XSObject(s)
57 * Used by XSModel
58 */
59class XMLPARSER_EXPORT XSObjectFactory : public XMemory
60{
61public:
62    // -----------------------------------------------------------------------
63    //  Constructors and Destructor
64    // -----------------------------------------------------------------------
65    XSObjectFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
66    ~XSObjectFactory();
67
68private:
69    // -----------------------------------------------------------------------
70    //  Unimplemented constructors and destructor
71    // -----------------------------------------------------------------------
72    XSObjectFactory(const XSObjectFactory&);
73    XSObjectFactory& operator=(const XSObjectFactory&);
74
75    // -----------------------------------------------------------------------
76    //  factory methods
77    // -----------------------------------------------------------------------
78    XSParticle* createModelGroupParticle
79    (
80        const ContentSpecNode* const node
81        , XSModel* const             xsModel
82    );
83
84    XSAttributeDeclaration* addOrFind
85    (
86        SchemaAttDef* const attDef
87        , XSModel* const xsModel
88        , XSComplexTypeDefinition* const enclosingTypeDef = 0
89    );
90
91    XSSimpleTypeDefinition* addOrFind
92    (
93        DatatypeValidator* const validator
94        , XSModel* const xsModel
95        , bool isAnySimpleType = false
96    );
97
98    XSElementDeclaration* addOrFind
99    (
100        SchemaElementDecl* const elemDecl
101        , XSModel* const xsModel
102        , XSComplexTypeDefinition* const enclosingTypeDef = 0
103    );
104
105    XSComplexTypeDefinition* addOrFind
106    (
107        ComplexTypeInfo* const typeInfo
108        , XSModel* const xsModel
109    );
110
111    XSIDCDefinition* addOrFind
112    (
113        IdentityConstraint* const ic
114        , XSModel* const xsModel
115    );
116
117    XSNotationDeclaration* addOrFind
118    (
119        XMLNotationDecl* const notDecl
120        , XSModel* const xsModel
121    );
122
123    XSAttributeUse* createXSAttributeUse
124    (
125        XSAttributeDeclaration* const xsAttDecl
126        , XSModel* const xsModel
127    );
128    XSWildcard* createXSWildcard
129    (
130        SchemaAttDef* const attDef
131        , XSModel* const xsModel
132    );
133
134    XSWildcard* createXSWildcard
135    (
136        const ContentSpecNode* const rootNode
137        , XSModel* const xsModel
138    );
139
140    XSModelGroupDefinition* createXSModelGroupDefinition
141    (
142        XercesGroupInfo* const groupInfo
143        , XSModel* const xsModel
144    );
145
146    XSAttributeGroupDefinition* createXSAttGroupDefinition
147    (
148        XercesAttGroupInfo* const attGroupInfo
149        , XSModel* const xsModel
150    );
151
152    // -----------------------------------------------------------------------
153    //  Helper methods
154    // -----------------------------------------------------------------------
155    // creates a particle corresponding to an element
156    XSParticle* createElementParticle
157    (
158        const ContentSpecNode* const rootNode
159        , XSModel* const             xsModel
160    );
161
162    // creates a particle corresponding to a wildcard
163    XSParticle* createWildcardParticle
164    (
165        const ContentSpecNode* const rootNode
166        , XSModel* const             xsModel
167    );
168
169    XSAnnotation* getAnnotationFromModel
170    (
171        XSModel* const xsModel
172        , const void* const key
173    );
174
175    void buildAllParticles
176    (
177        const ContentSpecNode* const rootNode
178        , XSParticleList* const particleList
179        , XSModel* const xsModel
180    );
181
182    void buildChoiceSequenceParticles
183    (
184        const ContentSpecNode* const rootNode
185        , XSParticleList* const particleList
186        , XSModel* const xsModel
187    );
188
189    void putObjectInMap
190    (
191        void* key
192        , XSObject* const object
193    );
194
195    XSObject* getObjectFromMap
196    (
197        void* key
198    );
199
200    void processFacets
201    (
202        DatatypeValidator* const dv
203        , XSModel* const xsModel
204        , XSSimpleTypeDefinition* const xsST
205    );
206
207    void processAttUse
208    (
209        SchemaAttDef* const attDef
210        , XSAttributeUse* const xsAttUse
211    );
212
213    bool isMultiValueFacetDefined(DatatypeValidator* const dv);
214
215    // make XSModel our friend
216    friend class XSModel;
217
218    // -----------------------------------------------------------------------
219    //  Private Data Members
220    //
221    //  fMemoryManager
222    //      The memory manager used to create various XSObject(s).
223    // -----------------------------------------------------------------------
224    MemoryManager*                       fMemoryManager;
225    RefHashTableOf<XSObject, PtrHasher>* fXercesToXSMap;
226    RefVectorOf<XSObject>*               fDeleteVector;
227};
228
229inline XSObject* XSObjectFactory::getObjectFromMap(void* key)
230{
231    return fXercesToXSMap->get(key);
232}
233
234
235XERCES_CPP_NAMESPACE_END
236
237#endif
Note: See TracBrowser for help on using the repository browser.