Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:56

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_XSOBJECTFACTORY_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XSOBJECTFACTORY_HPP
0024 
0025 #include <xercesc/framework/psvi/XSConstants.hpp>
0026 #include <xercesc/util/RefHashTableOf.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 class XSObject;
0031 class XSAttributeUse;
0032 class XSAttributeDeclaration;
0033 class XSModel;
0034 class XSElementDeclaration;
0035 class XSSimpleTypeDefinition;
0036 class XSComplexTypeDefinition;
0037 class XSModelGroupDefinition;
0038 class XSAttributeGroupDefinition;
0039 class XSWildcard;
0040 class XSParticle;
0041 class XSAnnotation;
0042 class XSNamespaceItem;
0043 class XSNotationDeclaration;
0044 class SchemaAttDef;
0045 class SchemaElementDecl;
0046 class DatatypeValidator;
0047 class ContentSpecNode;
0048 class ComplexTypeInfo;
0049 class XercesGroupInfo;
0050 class XercesAttGroupInfo;
0051 class XSIDCDefinition;
0052 class IdentityConstraint;
0053 class XMLNotationDecl;
0054 
0055 /**
0056  * Factory class to create various XSObject(s)
0057  * Used by XSModel
0058  */
0059 class XMLPARSER_EXPORT XSObjectFactory : public XMemory
0060 {
0061 public:
0062     // -----------------------------------------------------------------------
0063     //  Constructors and Destructor
0064     // -----------------------------------------------------------------------
0065     XSObjectFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0066     ~XSObjectFactory();
0067 
0068 private:
0069     // -----------------------------------------------------------------------
0070     //  Unimplemented constructors and destructor
0071     // -----------------------------------------------------------------------
0072     XSObjectFactory(const XSObjectFactory&);
0073     XSObjectFactory& operator=(const XSObjectFactory&);
0074 
0075     // -----------------------------------------------------------------------
0076     //  factory methods
0077     // -----------------------------------------------------------------------
0078     XSParticle* createModelGroupParticle
0079     (
0080         const ContentSpecNode* const node
0081         , XSModel* const             xsModel
0082     );
0083 
0084     XSAttributeDeclaration* addOrFind
0085     (
0086         SchemaAttDef* const attDef
0087         , XSModel* const xsModel
0088         , XSComplexTypeDefinition* const enclosingTypeDef = 0
0089     );
0090 
0091     XSSimpleTypeDefinition* addOrFind
0092     (
0093         DatatypeValidator* const validator
0094         , XSModel* const xsModel
0095         , bool isAnySimpleType = false
0096     );
0097 
0098     XSElementDeclaration* addOrFind
0099     (
0100         SchemaElementDecl* const elemDecl
0101         , XSModel* const xsModel
0102         , XSComplexTypeDefinition* const enclosingTypeDef = 0
0103     );
0104 
0105     XSComplexTypeDefinition* addOrFind
0106     (
0107         ComplexTypeInfo* const typeInfo
0108         , XSModel* const xsModel
0109     );
0110 
0111     XSIDCDefinition* addOrFind
0112     (
0113         IdentityConstraint* const ic
0114         , XSModel* const xsModel
0115     );
0116 
0117     XSNotationDeclaration* addOrFind
0118     (
0119         XMLNotationDecl* const notDecl
0120         , XSModel* const xsModel
0121     );
0122 
0123     XSAttributeUse* createXSAttributeUse
0124     (
0125         XSAttributeDeclaration* const xsAttDecl
0126         , XSModel* const xsModel
0127     );
0128     XSWildcard* createXSWildcard
0129     (
0130         SchemaAttDef* const attDef
0131         , XSModel* const xsModel
0132     );
0133 
0134     XSWildcard* createXSWildcard
0135     (
0136         const ContentSpecNode* const rootNode
0137         , XSModel* const xsModel
0138     );
0139 
0140     XSModelGroupDefinition* createXSModelGroupDefinition
0141     (
0142         XercesGroupInfo* const groupInfo
0143         , XSModel* const xsModel
0144     );
0145 
0146     XSAttributeGroupDefinition* createXSAttGroupDefinition
0147     (
0148         XercesAttGroupInfo* const attGroupInfo
0149         , XSModel* const xsModel
0150     );
0151 
0152     // -----------------------------------------------------------------------
0153     //  Helper methods
0154     // -----------------------------------------------------------------------
0155     // creates a particle corresponding to an element
0156     XSParticle* createElementParticle
0157     (
0158         const ContentSpecNode* const rootNode
0159         , XSModel* const             xsModel
0160     );
0161 
0162     // creates a particle corresponding to a wildcard
0163     XSParticle* createWildcardParticle
0164     (
0165         const ContentSpecNode* const rootNode
0166         , XSModel* const             xsModel
0167     );
0168 
0169     XSAnnotation* getAnnotationFromModel
0170     (
0171         XSModel* const xsModel
0172         , const void* const key
0173     );
0174 
0175     void buildAllParticles
0176     (
0177         const ContentSpecNode* const rootNode
0178         , XSParticleList* const particleList
0179         , XSModel* const xsModel
0180     );
0181 
0182     void buildChoiceSequenceParticles
0183     (
0184         const ContentSpecNode* const rootNode
0185         , XSParticleList* const particleList
0186         , XSModel* const xsModel
0187     );
0188 
0189     void putObjectInMap
0190     (
0191         void* key
0192         , XSObject* const object
0193     );
0194 
0195     XSObject* getObjectFromMap
0196     (
0197         void* key
0198     );
0199 
0200     void processFacets
0201     (
0202         DatatypeValidator* const dv
0203         , XSModel* const xsModel
0204         , XSSimpleTypeDefinition* const xsST
0205     );
0206 
0207     void processAttUse
0208     (
0209         SchemaAttDef* const attDef
0210         , XSAttributeUse* const xsAttUse
0211     );
0212 
0213     bool isMultiValueFacetDefined(DatatypeValidator* const dv);
0214 
0215     // make XSModel our friend
0216     friend class XSModel;
0217 
0218     // -----------------------------------------------------------------------
0219     //  Private Data Members
0220     //
0221     //  fMemoryManager
0222     //      The memory manager used to create various XSObject(s).
0223     // -----------------------------------------------------------------------
0224     MemoryManager*                       fMemoryManager;
0225     RefHashTableOf<XSObject, PtrHasher>* fXercesToXSMap;
0226     RefVectorOf<XSObject>*               fDeleteVector;
0227 };
0228 
0229 inline XSObject* XSObjectFactory::getObjectFromMap(void* key)
0230 {
0231     return fXercesToXSMap->get(key);
0232 }
0233 
0234 
0235 XERCES_CPP_NAMESPACE_END
0236 
0237 #endif