knoaman 2003/11/21 09:29:54 Modified: c/src/xercesc/framework/psvi XSModelGroupDefinition.hpp XSModelGroupDefinition.cpp XSModelGroup.hpp XSModelGroup.cpp XSIDCDefinition.hpp XSIDCDefinition.cpp XSFacet.hpp XSFacet.cpp XSElementDeclaration.hpp XSElementDeclaration.cpp Log: PSVI update Revision Changes Path 1.4 +24 -4 xml-xerces/c/src/xercesc/framework/psvi/XSModelGroupDefinition.hpp Index: XSModelGroupDefinition.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSModelGroupDefinition.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XSModelGroupDefinition.hpp 14 Nov 2003 22:47:53 -0000 1.3 +++ XSModelGroupDefinition.hpp 21 Nov 2003 17:29:53 -0000 1.4 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.3 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -87,6 +90,8 @@ // forward declarations class XSAnnotation; class XSModelGroup; +class XSParticle; +class XercesGroupInfo; class XMLPARSER_EXPORT XSModelGroupDefinition : public XSObject { @@ -102,8 +107,14 @@ * * @param manager The configurable memory manager */ - XSModelGroupDefinition(XSModel* xsModel, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XSModelGroupDefinition + ( + XercesGroupInfo* const groupInfo + , XSParticle* const groupParticle + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); //@}; @@ -150,7 +161,7 @@ /** * Optional. An [annotation]. */ - XSAnnotation *getAnnotation(); + XSAnnotation *getAnnotation() const; //@} @@ -172,8 +183,17 @@ // ----------------------------------------------------------------------- // data members // ----------------------------------------------------------------------- + XercesGroupInfo* fGroupInfo; + XSParticle* fModelGroupParticle; + XSAnnotation* fAnnotation; }; -inline XSModelGroupDefinition::~XSModelGroupDefinition() {} + +inline XSAnnotation* XSModelGroupDefinition::getAnnotation() const +{ + return fAnnotation; +} + + XERCES_CPP_NAMESPACE_END 1.5 +38 -24 xml-xerces/c/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp Index: XSModelGroupDefinition.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XSModelGroupDefinition.cpp 14 Nov 2003 22:47:53 -0000 1.4 +++ XSModelGroupDefinition.cpp 21 Nov 2003 17:29:53 -0000 1.5 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.4 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -74,52 +77,63 @@ */ #include <xercesc/framework/psvi/XSModelGroupDefinition.hpp> +#include <xercesc/framework/psvi/XSParticle.hpp> +#include <xercesc/framework/psvi/XSModel.hpp> +#include <xercesc/validators/schema/XercesGroupInfo.hpp> + XERCES_CPP_NAMESPACE_BEGIN -XSModelGroupDefinition::XSModelGroupDefinition(XSModel* xsModel, - MemoryManager * const manager): - XSObject(XSConstants::MODEL_GROUP_DEFINITION, xsModel, manager ) +// --------------------------------------------------------------------------- +// XSModelGroupDefinition: Constructors and Destructors +// --------------------------------------------------------------------------- +XSModelGroupDefinition::XSModelGroupDefinition(XercesGroupInfo* const groupInfo, + XSParticle* const groupParticle, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::MODEL_GROUP_DEFINITION, xsModel, manager) + , fGroupInfo(groupInfo) + , fModelGroupParticle(groupParticle) + , fAnnotation(annot) { } -// Overridden XSObject methods +XSModelGroupDefinition::~XSModelGroupDefinition() +{ + if (fModelGroupParticle) // Not owned by XSModel + delete fModelGroupParticle; +} + +// --------------------------------------------------------------------------- +// XSModelGroupDefinition: XSModel virtual methods +// --------------------------------------------------------------------------- const XMLCh *XSModelGroupDefinition::getName() { - // REVISIT - return 0; + return fXSModel->getURIStringPool()->getValueForId(fGroupInfo->getNameId()); } const XMLCh *XSModelGroupDefinition::getNamespace() { - // REVISIT - return 0; + return fXSModel->getURIStringPool()->getValueForId(fGroupInfo->getNamespaceId()); } XSNamespaceItem *XSModelGroupDefinition::getNamespaceItem() { - return getNamespaceItemFromHash(getNamespace()); + return fXSModel->getNamespaceItem(getNamespace()); } -// XSModelGroupDefinition methods - -/** - * A model group. - */ -XSModelGroup *XSModelGroupDefinition::getModelGroup() +// --------------------------------------------------------------------------- +// XSModelGroupDefinition: access methods +// --------------------------------------------------------------------------- +XSModelGroup* XSModelGroupDefinition::getModelGroup() { - // REVISIT - return 0; -} + if (fModelGroupParticle) + return fModelGroupParticle->getModelGroupTerm(); -/** - * An of [annotations]. - */ -XSAnnotation *XSModelGroupDefinition::getAnnotation() -{ - // REVISIT return 0; } + XERCES_CPP_NAMESPACE_END 1.4 +31 -5 xml-xerces/c/src/xercesc/framework/psvi/XSModelGroup.hpp Index: XSModelGroup.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSModelGroup.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XSModelGroup.hpp 14 Nov 2003 22:47:53 -0000 1.3 +++ XSModelGroup.hpp 21 Nov 2003 17:29:53 -0000 1.4 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.3 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -120,8 +123,14 @@ * * @param manager The configurable memory manager */ - XSModelGroup(XSModel* xsModel, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XSModelGroup + ( + COMPOSITOR_TYPE compositorType + , XSParticleList* const particleList + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); //@}; @@ -144,12 +153,12 @@ /** * A list of [particles]. */ - XSParticleList *getParticles(); + XSParticleList *getParticles() const; /** * Optional. An [annotation]. */ - XSAnnotation *getAnnotation(); + XSAnnotation *getAnnotation() const; //@} @@ -172,8 +181,25 @@ // ----------------------------------------------------------------------- // data members // ----------------------------------------------------------------------- + COMPOSITOR_TYPE fCompositorType; + XSParticleList* fParticleList; + XSAnnotation* fAnnotation; }; -inline XSModelGroup::~XSModelGroup() {} + +inline XSModelGroup::COMPOSITOR_TYPE XSModelGroup::getCompositor() const +{ + return fCompositorType; +} + +inline XSParticleList* XSModelGroup::getParticles() const +{ + return fParticleList; +} + +inline XSAnnotation* XSModelGroup::getAnnotation() const +{ + return fAnnotation; +} XERCES_CPP_NAMESPACE_END 1.4 +19 -32 xml-xerces/c/src/xercesc/framework/psvi/XSModelGroup.cpp Index: XSModelGroup.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSModelGroup.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XSModelGroup.cpp 14 Nov 2003 22:47:53 -0000 1.3 +++ XSModelGroup.cpp 21 Nov 2003 17:29:53 -0000 1.4 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.3 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -71,45 +74,29 @@ */ #include <xercesc/framework/psvi/XSModelGroup.hpp> +#include <xercesc/framework/psvi/XSParticle.hpp> XERCES_CPP_NAMESPACE_BEGIN -XSModelGroup::XSModelGroup(XSModel* xsModel, - MemoryManager * const manager): - XSObject(XSConstants::MODEL_GROUP, xsModel, manager ) -{ -} - -// XSModelGroup methods - - -/** - * [compositor]: one of all, choice or sequence. The valid constants - * values are: - * <code>COMPOSITOR_SEQUENCE, COMPOSITOR_CHOICE, COMPOSITOR_ALL</code>. - */ -XSModelGroup::COMPOSITOR_TYPE XSModelGroup::getCompositor() const -{ - // REVISIT - return COMPOSITOR_SEQUENCE; -} - -/** - * A list of [particles]. - */ -XSParticleList *XSModelGroup::getParticles() +// --------------------------------------------------------------------------- +// XSModelGroup: Constructors and Destructor +// --------------------------------------------------------------------------- +XSModelGroup::XSModelGroup(COMPOSITOR_TYPE compositorType, + XSParticleList* const particleList, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager * const manager) + : XSObject(XSConstants::MODEL_GROUP, xsModel, manager) + , fCompositorType(compositorType) + , fParticleList(particleList) + , fAnnotation(annot) { - // REVISIT - return 0; } -/** - * Optional. An [annotation]. - */ -XSAnnotation *XSModelGroup::getAnnotation() +XSModelGroup::~XSModelGroup() { - // REVISIT - return 0; + if (fParticleList) + delete fParticleList; } XERCES_CPP_NAMESPACE_END 1.5 +26 -20 xml-xerces/c/src/xercesc/framework/psvi/XSIDCDefinition.hpp Index: XSIDCDefinition.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSIDCDefinition.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XSIDCDefinition.hpp 14 Nov 2003 22:47:53 -0000 1.4 +++ XSIDCDefinition.hpp 21 Nov 2003 17:29:53 -0000 1.5 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.4 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -89,9 +92,7 @@ // forward declarations class XSAnnotation; - class IdentityConstraint; -class XMLStringPool; class XMLPARSER_EXPORT XSIDCDefinition : public XSObject { @@ -123,9 +124,15 @@ * * @param manager The configurable memory manager */ - XSIDCDefinition(IdentityConstraint* identityConstraint, - XSModel* xsModel, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XSIDCDefinition + ( + IdentityConstraint* const identityConstraint + , XSIDCDefinition* const keyIC + , XSAnnotation* const headAnnot + , StringList* const stringList + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); //@}; @@ -185,7 +192,7 @@ * forbidden otherwise (when an identity-constraint definition with [ * identity-constraint category] equal to IC_KEY or IC_UNIQUE). */ - XSIDCDefinition *getRefKey(); + XSIDCDefinition *getRefKey() const; /** * A set of [annotations]. @@ -213,22 +220,21 @@ // ----------------------------------------------------------------------- // data members // ----------------------------------------------------------------------- - IdentityConstraint* fIdentityConstraint; - XSIDCDefinition* fKey; - StringList* fStringList; - XSAnnotationList* fXSAnnotationList; + IdentityConstraint* fIdentityConstraint; + XSIDCDefinition* fKey; + StringList* fStringList; + XSAnnotationList* fXSAnnotationList; }; -inline XSIDCDefinition::~XSIDCDefinition() { - if (fStringList) - { - delete fStringList; - } - // don't delete fKey - deleted by XSModel - if (fXSAnnotationList) - { - delete fXSAnnotationList; - } + +inline StringList* XSIDCDefinition::getFieldStrs() +{ + return fStringList; +} + +inline XSIDCDefinition* XSIDCDefinition::getRefKey() const +{ + return fKey; } XERCES_CPP_NAMESPACE_END 1.6 +44 -69 xml-xerces/c/src/xercesc/framework/psvi/XSIDCDefinition.cpp Index: XSIDCDefinition.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSIDCDefinition.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- XSIDCDefinition.cpp 14 Nov 2003 22:47:53 -0000 1.5 +++ XSIDCDefinition.cpp 21 Nov 2003 17:29:53 -0000 1.6 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.5 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -80,46 +83,55 @@ #include <xercesc/validators/schema/identity/IC_KeyRef.hpp> #include <xercesc/validators/schema/identity/IC_Selector.hpp> #include <xercesc/validators/schema/identity/XercesXPath.hpp> -#include <xercesc/util/StringPool.hpp> #include <xercesc/framework/psvi/XSModel.hpp> #include <xercesc/framework/psvi/XSAnnotation.hpp> +#include <xercesc/util/StringPool.hpp> XERCES_CPP_NAMESPACE_BEGIN -XSIDCDefinition::XSIDCDefinition(IdentityConstraint* identityConstraint, - XSModel* xsModel, - MemoryManager * const manager): - fIdentityConstraint(identityConstraint), - fStringList(0), - fKey(0), - fXSAnnotationList(0), - XSObject(XSConstants::IDENTITY_CONSTRAINT, xsModel, manager ) - +// --------------------------------------------------------------------------- +// XSIDCDefinition: Constructors and Destructor +// --------------------------------------------------------------------------- +XSIDCDefinition::XSIDCDefinition(IdentityConstraint* const identityConstraint, + XSIDCDefinition* const keyIC, + XSAnnotation* const headAnnot, + StringList* const stringList, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::IDENTITY_CONSTRAINT, xsModel, manager) + , fIdentityConstraint(identityConstraint) + , fKey(keyIC) + , fStringList(stringList) + , fXSAnnotationList(0) { - unsigned int fieldCount = fIdentityConstraint->getFieldCount(); - - if (fieldCount) + if (headAnnot) { - fStringList = new (manager) RefArrayVectorOf <XMLCh>(fieldCount, true, manager); - - for(unsigned int i=0; i<fieldCount; i++) { - XMLCh* expr = XMLString::replicate(fIdentityConstraint->getFieldAt(i)->getXPath()->getExpression(), manager); - fStringList->addElement(expr); - } - } + // REVISIT Size + fXSAnnotationList = new (manager) RefVectorOf<XSAnnotation>(3, false, manager); - if (fIdentityConstraint->getType() == IdentityConstraint::KEYREF) - { - fKey = (XSIDCDefinition*) getObjectFromMap((void*)((IC_KeyRef*) fIdentityConstraint)->getKey()); - if (!fKey) + XSAnnotation* annot = headAnnot; + do { - fKey = new (manager) XSIDCDefinition(((IC_KeyRef*) fIdentityConstraint)->getKey(), fXSModel, manager); - putObjectInMap((void*) ((IC_KeyRef*) fIdentityConstraint)->getKey(), fKey); - } + fXSAnnotationList->addElement(annot); + annot = annot->getNext(); + } while (annot); } + } -// Overridden XSObject methods +XSIDCDefinition::~XSIDCDefinition() +{ + if (fStringList) + delete fStringList; + + // don't delete fKey - deleted by XSModel + if (fXSAnnotationList) + delete fXSAnnotationList; +} + +// --------------------------------------------------------------------------- +// XSIDCDefinition: XSObject virtual methods +// --------------------------------------------------------------------------- const XMLCh *XSIDCDefinition::getName() { return fIdentityConstraint->getIdentityConstraintName(); @@ -132,14 +144,12 @@ XSNamespaceItem *XSIDCDefinition::getNamespaceItem() { - return getNamespaceItemFromHash(getNamespace()); + return fXSModel->getNamespaceItem(getNamespace()); } -// XSIDCDefinition methods - -/** - * [identity-constraint category]: one of IC_KEY, IC_KEYREF or IC_UNIQUE. - */ +// --------------------------------------------------------------------------- +// XSIDCDefinition: access methods +// --------------------------------------------------------------------------- XSIDCDefinition::IC_CATEGORY XSIDCDefinition::getCategory() const { switch(fIdentityConstraint->getType()) { @@ -157,49 +167,14 @@ } } -/** - * [selector]: a restricted XPath expression. - */ const XMLCh *XSIDCDefinition::getSelectorStr() { return fIdentityConstraint->getSelector()->getXPath()->getExpression(); } -/** - * [fields]: a non-empty list of restricted XPath ([XPath]) expressions. - */ -StringList *XSIDCDefinition::getFieldStrs() -{ - return fStringList; -} -/** - * [referenced key]: required if [identity-constraint category] is IC_KEYREF, - * forbidden otherwise (when an identity-constraint definition with [ - * identity-constraint category] equal to IC_KEY or IC_UNIQUE). - */ -XSIDCDefinition *XSIDCDefinition::getRefKey() -{ - return fKey; -} - -/** - * A set of [annotations]. - */ XSAnnotationList *XSIDCDefinition::getAnnotations() { - if (fXSAnnotationList) - { - return fXSAnnotationList; - } - // REVISIT Size - fXSAnnotationList = new (fMemoryManager) RefVectorOf <XSAnnotation> (3, false, fMemoryManager); - XSAnnotation* annot = getAnnotationFromModel(fIdentityConstraint); - while (annot) - { - fXSAnnotationList->addElement(annot); - annot = annot->getNext(); - } return fXSAnnotationList; } 1.5 +39 -14 xml-xerces/c/src/xercesc/framework/psvi/XSFacet.hpp Index: XSFacet.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSFacet.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XSFacet.hpp 14 Nov 2003 22:47:53 -0000 1.4 +++ XSFacet.hpp 21 Nov 2003 17:29:53 -0000 1.5 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.4 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -76,7 +79,6 @@ #if !defined(XSFACET_HPP) #define XSFACET_HPP -#include <xercesc/framework/psvi/XSObject.hpp> #include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -92,8 +94,6 @@ // forward declarations class XSAnnotation; - - class XMLPARSER_EXPORT XSFacet : public XSObject { public: @@ -108,11 +108,15 @@ * * @param manager The configurable memory manager */ - XSFacet(XSSimpleTypeDefinition::FACET facetKind, - const XMLCh* lexicalValue, - bool isFixed, - XSModel* xsModel, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XSFacet + ( + XSSimpleTypeDefinition::FACET facetKind + , const XMLCh* const lexicalValue + , bool isFixed + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); //@}; @@ -134,7 +138,7 @@ /** * @return Returns a value of a constraining facet. */ - const XMLCh *getLexicalFacetValue(); + const XMLCh *getLexicalFacetValue() const; /** * Check whether a facet value is fixed. @@ -144,7 +148,7 @@ /** * @return an annotation */ - XSAnnotation *getAnnotation(); + XSAnnotation *getAnnotation() const; //@} @@ -167,11 +171,32 @@ // ----------------------------------------------------------------------- // data members // ----------------------------------------------------------------------- - XSSimpleTypeDefinition::FACET fFacetKind; - const XMLCh* fLexicalValue; - bool fIsFixed; + XSSimpleTypeDefinition::FACET fFacetKind; + bool fIsFixed; + const XMLCh* fLexicalValue; + XSAnnotation* fAnnotation; }; -inline XSFacet::~XSFacet() {} + +inline XSSimpleTypeDefinition::FACET XSFacet::getFacetKind() const +{ + return fFacetKind; +} + +inline const XMLCh* XSFacet::getLexicalFacetValue() const +{ + return fLexicalValue; +} + +inline bool XSFacet::isFixed() const +{ + return fIsFixed; +} + +inline XSAnnotation* XSFacet::getAnnotation() const +{ + return fAnnotation; +} + XERCES_CPP_NAMESPACE_END 1.5 +18 -42 xml-xerces/c/src/xercesc/framework/psvi/XSFacet.cpp Index: XSFacet.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSFacet.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XSFacet.cpp 14 Nov 2003 22:47:53 -0000 1.4 +++ XSFacet.cpp 21 Nov 2003 17:29:53 -0000 1.5 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.4 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -77,52 +80,25 @@ XERCES_CPP_NAMESPACE_BEGIN -XSFacet::XSFacet(XSSimpleTypeDefinition::FACET facetKind, - const XMLCh* lexicalValue, - bool isFixed, - XSModel* xsModel, - MemoryManager * const manager): - fFacetKind(facetKind), - fLexicalValue(lexicalValue), - fIsFixed(isFixed), - XSObject(XSConstants::FACET, xsModel, manager ) +// --------------------------------------------------------------------------- +// XSFacet: Constructors and Destructor +// --------------------------------------------------------------------------- +XSFacet::XSFacet(XSSimpleTypeDefinition::FACET facetKind, + const XMLCh* const lexicalValue, + bool isFixed, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::FACET, xsModel, manager) + , fFacetKind(facetKind) + , fIsFixed(isFixed) + , fLexicalValue(lexicalValue) + , fAnnotation(annot) { } -// XSFacet methods - - -/** - * @return An indication as to the facet's type; see <code>XSSimpleTypeDefinition::FACET</code> - */ -XSSimpleTypeDefinition::FACET XSFacet::getFacetKind() const -{ - return fFacetKind; -} - -/** - * @return Returns a value of a constraining facet. - */ -const XMLCh *XSFacet::getLexicalFacetValue() -{ - return fLexicalValue; -} - -/** - * Check whether a facet value is fixed. - */ -bool XSFacet::isFixed() const -{ - return fIsFixed; -} - -/** - * @return an annotation - */ -XSAnnotation *XSFacet::getAnnotation() +XSFacet::~XSFacet() { - // REVISIT - return 0; } XERCES_CPP_NAMESPACE_END 1.5 +68 -22 xml-xerces/c/src/xercesc/framework/psvi/XSElementDeclaration.hpp Index: XSElementDeclaration.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSElementDeclaration.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XSElementDeclaration.hpp 14 Nov 2003 22:47:53 -0000 1.4 +++ XSElementDeclaration.hpp 21 Nov 2003 17:29:53 -0000 1.5 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.4 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -93,9 +96,7 @@ class XSComplexTypeDefinition; class XSIDCDefinition; class XSTypeDefinition; - class SchemaElementDecl; -class XMLStringPool; class XMLPARSER_EXPORT XSElementDeclaration : public XSObject { @@ -111,9 +112,16 @@ * * @param manager The configurable memory manager */ - XSElementDeclaration(SchemaElementDecl* schemaElementDecl, - XSModel* xsModel, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XSElementDeclaration + ( + SchemaElementDecl* const schemaElementDecl + , XSTypeDefinition* const typeDefinition + , XSElementDeclaration* const substitutionGroupAffiliation + , XSAnnotation* const annot + , XSNamedMap<XSIDCDefinition>* const identityConstraints + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); //@}; @@ -164,25 +172,25 @@ * [type definition]: either a simple type definition or a complex type * definition. */ - XSTypeDefinition *getTypeDefinition(); + XSTypeDefinition *getTypeDefinition() const; /** * Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>, * or <code>SCOPE_ABSENT</code>. If the scope is local, then the * <code>enclosingCTDefinition</code> is present. */ - XSConstants::SCOPE getScope(); + XSConstants::SCOPE getScope() const; /** * The complex type definition for locally scoped declarations (see * <code>scope</code>). */ - XSComplexTypeDefinition *getEnclosingCTDefinition(); + XSComplexTypeDefinition *getEnclosingCTDefinition() const; /** * [Value constraint]: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>. */ - XSConstants::VALUE_CONSTRAINT getConstraintType(); + XSConstants::VALUE_CONSTRAINT getConstraintType() const; /** * [Value constraint]: the actual value with respect to the [type @@ -198,7 +206,7 @@ * element content despite a <code>content type</code> which would * otherwise require content. */ - bool getNillable(); + bool getNillable() const; /** * identity-constraint definitions: a set of constraint definitions. @@ -209,7 +217,7 @@ * [substitution group affiliation]: optional. A top-level element * definition. */ - XSElementDeclaration *getSubstitutionGroupAffiliation(); + XSElementDeclaration *getSubstitutionGroupAffiliation() const; /** * Convenience method. Check if <code>exclusion</code> is a substitution @@ -228,7 +236,7 @@ * <code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>} or * <code>DERIVATION_NONE</code>. */ - short getSubstitutionGroupExclusions(); + short getSubstitutionGroupExclusions() const; /** * Convenience method. Check if <code>disallowed</code> is a disallowed @@ -249,17 +257,17 @@ * } corresponding to substitutions disallowed by this * <code>XSElementDeclaration</code> or <code>DERIVATION_NONE</code>. */ - short getDisallowedSubstitutions(); + short getDisallowedSubstitutions() const; /** * {abstract} A boolean. */ - bool getAbstract(); + bool getAbstract() const; /** * Optional. Annotation. */ - XSAnnotation *getAnnotation(); + XSAnnotation *getAnnotation() const; //@} @@ -271,6 +279,7 @@ * Set the id to be returned on getId(). */ void setId(unsigned int id); + //@} private: @@ -285,14 +294,51 @@ // ----------------------------------------------------------------------- // data members // ----------------------------------------------------------------------- - SchemaElementDecl* fSchemaElementDecl; - XSTypeDefinition* fTypeDefinition; - XSElementDeclaration* fSubstitutionGroupAffiliation; - XSNamedMap <XSIDCDefinition>* fIdentityConstraints; - short fDisallowedSubstitutions; - short fSubstitutionGroupExclusions; - unsigned int fId; + short fDisallowedSubstitutions; + short fSubstitutionGroupExclusions; + unsigned int fId; + SchemaElementDecl* fSchemaElementDecl; + XSTypeDefinition* fTypeDefinition; + XSElementDeclaration* fSubstitutionGroupAffiliation; + XSAnnotation* fAnnotation; + XSNamedMap<XSIDCDefinition>* fIdentityConstraints; }; + +inline XSTypeDefinition* XSElementDeclaration::getTypeDefinition() const +{ + return fTypeDefinition; +} + +inline XSNamedMap<XSIDCDefinition>* XSElementDeclaration::getIdentityConstraints() +{ + return fIdentityConstraints; +} + +inline XSElementDeclaration* XSElementDeclaration::getSubstitutionGroupAffiliation() const +{ + return fSubstitutionGroupAffiliation; +} + +inline short XSElementDeclaration::getSubstitutionGroupExclusions() const +{ + return fSubstitutionGroupExclusions; +} + +inline short XSElementDeclaration::getDisallowedSubstitutions() const +{ + return fDisallowedSubstitutions; +} + +inline XSAnnotation *XSElementDeclaration::getAnnotation() const +{ + return fAnnotation; +} + +inline void XSElementDeclaration::setId(unsigned int id) +{ + fId = id; +} + XERCES_CPP_NAMESPACE_END 1.6 +63 -215 xml-xerces/c/src/xercesc/framework/psvi/XSElementDeclaration.cpp Index: XSElementDeclaration.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSElementDeclaration.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- XSElementDeclaration.cpp 14 Nov 2003 22:47:53 -0000 1.5 +++ XSElementDeclaration.cpp 21 Nov 2003 17:29:53 -0000 1.6 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/11/21 17:29:53 knoaman + * PSVI update + * * Revision 1.5 2003/11/14 22:47:53 neilg * fix bogus log message from previous commit... * @@ -77,102 +80,59 @@ */ #include <xercesc/framework/psvi/XSElementDeclaration.hpp> -#include <xercesc/validators/schema/SchemaElementDecl.hpp> #include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp> #include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp> #include <xercesc/framework/psvi/XSIDCDefinition.hpp> -#include <xercesc/util/StringPool.hpp> #include <xercesc/framework/psvi/XSModel.hpp> -#include <xercesc/framework/psvi/XSAnnotation.hpp> +#include <xercesc/validators/schema/SchemaElementDecl.hpp> +#include <xercesc/util/StringPool.hpp> XERCES_CPP_NAMESPACE_BEGIN -XSElementDeclaration::XSElementDeclaration(SchemaElementDecl* schemaElementDecl, - XSModel* xsModel, - MemoryManager * const manager): - fSchemaElementDecl(schemaElementDecl), - fSubstitutionGroupAffiliation(0), - fDisallowedSubstitutions(0), - fSubstitutionGroupExclusions(0), - fTypeDefinition(0), - fIdentityConstraints(0), - XSObject(XSConstants::ELEMENT_DECLARATION, xsModel, manager ) -{ - int blockorfinalset; - if (blockorfinalset = fSchemaElementDecl->getBlockSet()) +// --------------------------------------------------------------------------- +// XSElementDeclaration: Constructors and Destructor +// --------------------------------------------------------------------------- +XSElementDeclaration::XSElementDeclaration +( + SchemaElementDecl* const schemaElementDecl + , XSTypeDefinition* const typeDefinition + , XSElementDeclaration* const substitutionGroupAffiliation + , XSAnnotation* const annot + , XSNamedMap<XSIDCDefinition>* const identityConstraints + , XSModel* const xsModel + , MemoryManager* const manager +) + : XSObject(XSConstants::ELEMENT_DECLARATION, xsModel, manager) + , fDisallowedSubstitutions(0) + , fSubstitutionGroupExclusions(0) + , fId(0) + , fSchemaElementDecl(schemaElementDecl) + , fTypeDefinition(typeDefinition) + , fSubstitutionGroupAffiliation(substitutionGroupAffiliation) + , fIdentityConstraints(identityConstraints) +{ + // set block and final information + // NOTE: rest of setup will be taken care of in construct() + int blockFinalSet = fSchemaElementDecl->getBlockSet(); + if (blockFinalSet) { - if (blockorfinalset & SchemaSymbols::XSD_EXTENSION) - { + if (blockFinalSet & SchemaSymbols::XSD_EXTENSION) fDisallowedSubstitutions |= XSConstants::DERIVATION_EXTENSION; - } - if (blockorfinalset & SchemaSymbols::XSD_RESTRICTION) - { + + if (blockFinalSet & SchemaSymbols::XSD_RESTRICTION) fDisallowedSubstitutions |= XSConstants::DERIVATION_RESTRICTION; - } - if (blockorfinalset & SchemaSymbols::XSD_SUBSTITUTION) - { + + if (blockFinalSet & SchemaSymbols::XSD_SUBSTITUTION) fDisallowedSubstitutions |= XSConstants::DERIVATION_SUBSTITUTION; - } } - if (blockorfinalset = fSchemaElementDecl->getFinalSet()) + if (blockFinalSet = fSchemaElementDecl->getFinalSet()) { - if (blockorfinalset & SchemaSymbols::XSD_EXTENSION) - { + if (blockFinalSet & SchemaSymbols::XSD_EXTENSION) fSubstitutionGroupExclusions |= XSConstants::DERIVATION_EXTENSION; - } - if (blockorfinalset & SchemaSymbols::XSD_RESTRICTION) - { - fSubstitutionGroupExclusions |= XSConstants::DERIVATION_RESTRICTION; - } - } - - if (fSchemaElementDecl->getSubstitutionGroupElem()) - { - fSubstitutionGroupAffiliation = (XSElementDeclaration*) getObjectFromMap((void*)fSchemaElementDecl->getSubstitutionGroupElem()); - if (!fSubstitutionGroupAffiliation) - { - fSubstitutionGroupAffiliation = new (manager) XSElementDeclaration(fSchemaElementDecl->getSubstitutionGroupElem(), fXSModel, manager); - putObjectInMap((void*)fSchemaElementDecl->getSubstitutionGroupElem(),fSubstitutionGroupAffiliation); - } - } - - if (fSchemaElementDecl->getDatatypeValidator()) - { - // simple type - fTypeDefinition = (XSTypeDefinition*) getObjectFromMap((void *)fSchemaElementDecl->getDatatypeValidator()); - if (!fTypeDefinition) - { - fTypeDefinition = (XSTypeDefinition*) new (manager) XSSimpleTypeDefinition(fSchemaElementDecl->getDatatypeValidator(), fXSModel, manager); - putObjectInMap((void *)fSchemaElementDecl->getDatatypeValidator(), fTypeDefinition); - } - } - else if (fSchemaElementDecl->getComplexTypeInfo()) - { - // complex type - fTypeDefinition = (XSTypeDefinition*) getObjectFromMap((void *)fSchemaElementDecl->getComplexTypeInfo()); - if (!fTypeDefinition) - { - fTypeDefinition = (XSTypeDefinition*) new (manager) XSComplexTypeDefinition(fSchemaElementDecl->getComplexTypeInfo(), fXSModel, manager); - putObjectInMap((void *)fSchemaElementDecl->getComplexTypeInfo(), fTypeDefinition); - } - } - unsigned int count = fSchemaElementDecl->getIdentityConstraintCount(); - if (count) - { - //REVISIT: size of hash table.... - fIdentityConstraints = new (manager) XSNamedMap <XSIDCDefinition> (count, 29, fXSModel->getURIStringPool(), false, manager); - for (unsigned int i = 0; i < count; i++) - { - XSIDCDefinition* definition = (XSIDCDefinition*) getObjectFromMap((void*)fSchemaElementDecl->getIdentityConstraintAt(i)); - if (!definition) - { - definition = new (manager) XSIDCDefinition(fSchemaElementDecl->getIdentityConstraintAt(i), fXSModel, manager); - putObjectInMap((void*) fSchemaElementDecl->getIdentityConstraintAt(i), definition); - } - fIdentityConstraints->addElement(definition, definition->getName(), definition->getNamespace()); - } + if (blockFinalSet & SchemaSymbols::XSD_RESTRICTION) + fSubstitutionGroupExclusions |= XSConstants::DERIVATION_RESTRICTION; } } @@ -181,12 +141,12 @@ // don't delete fTypeDefinition - deleted by XSModel // don't delete fSubstitutionGroupAffiliation - deleted by XSModel if (fIdentityConstraints) - { delete fIdentityConstraints; - } } -// Overridden XSObject methods +// --------------------------------------------------------------------------- +// XSElementDeclaration: XSObject virtual methods +// --------------------------------------------------------------------------- const XMLCh *XSElementDeclaration::getName() { return fSchemaElementDecl->getElementName()->getLocalPart(); @@ -199,27 +159,19 @@ XSNamespaceItem *XSElementDeclaration::getNamespaceItem() { - return getNamespaceItemFromHash(getNamespace()); + return fXSModel->getNamespaceItem(getNamespace()); } -// XSElementDeclaration methods - - -/** - * [type definition]: either a simple type definition or a complex type - * definition. - */ -XSTypeDefinition *XSElementDeclaration::getTypeDefinition() +unsigned int XSElementDeclaration::getId() const { - return fTypeDefinition; + return fId; } -/** - * Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>, - * or <code>SCOPE_ABSENT</code>. If the scope is local, then the - * <code>enclosingCTDefinition</code> is present. - */ -XSConstants::SCOPE XSElementDeclaration::getScope() + +// --------------------------------------------------------------------------- +// XSElementDeclaration: access methods +// --------------------------------------------------------------------------- +XSConstants::SCOPE XSElementDeclaration::getScope() const { if (fSchemaElementDecl->getEnclosingScope() == Grammar::TOP_LEVEL_SCOPE) return XSConstants::SCOPE_GLOBAL; @@ -227,166 +179,62 @@ return XSConstants::SCOPE_LOCAL; } -/** - * The complex type definition for locally scoped declarations (see - * <code>scope</code>). - */ -XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() +XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() const { // REVISIT return 0; } -/** - * [Value constraint]: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>. - */ -XSConstants::VALUE_CONSTRAINT XSElementDeclaration::getConstraintType() +XSConstants::VALUE_CONSTRAINT XSElementDeclaration::getConstraintType() const { if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_FIXED) - { return XSConstants::VC_FIXED; - } + // REVISIT: need to verify this... don't appear to set a DEFAULT flag so thought // this might work... if (fSchemaElementDecl->getDefaultValue()) - { return XSConstants::VC_DEFAULT; - } + return XSConstants::VC_NONE; } -/** - * [Value constraint]: the actual value with respect to the [type - * definition]. - */ const XMLCh *XSElementDeclaration::getConstraintValue() { return fSchemaElementDecl->getDefaultValue(); } -/** - * If nillable is true, then an element may also be valid if it carries - * the namespace qualified attribute with local name <code>nil</code> - * from namespace <code>http://www.w3.org/2001/XMLSchema-instance</code> - * and value <code>true</code> (xsi:nil) even if it has no text or - * element content despite a <code>content type</code> which would - * otherwise require content. - */ -bool XSElementDeclaration::getNillable() +bool XSElementDeclaration::getNillable() const { - if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_NILLABLE) { + if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_NILLABLE) return true; - } - return false; -} - -/** - * identity-constraint definitions: a set of constraint definitions. - */ -XSNamedMap <XSIDCDefinition> *XSElementDeclaration::getIdentityConstraints() -{ - return fIdentityConstraints; -} -/** - * [substitution group affiliation]: optional. A top-level element - * definition. - */ -XSElementDeclaration *XSElementDeclaration::getSubstitutionGroupAffiliation() -{ - return fSubstitutionGroupAffiliation; + return false; } -/** - * Convenience method. Check if <code>exclusion</code> is a substitution - * group exclusion for this element declaration. - * @param exclusion - * <code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code> or - * <code>DERIVATION_NONE</code>. Represents final set for the element. - * @return True if <code>exclusion</code> is a part of the substitution - * group exclusion subset. - */ bool XSElementDeclaration::isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion) { if (fSubstitutionGroupExclusions & exclusion) - { return true; - } + return false; } -/** - * [substitution group exclusions]: the returned value is a bit - * combination of the subset of { - * <code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>} or - * <code>DERIVATION_NONE</code>. - */ -short XSElementDeclaration::getSubstitutionGroupExclusions() -{ - return fSubstitutionGroupExclusions; -} -/** - * Convenience method. Check if <code>disallowed</code> is a disallowed - * substitution for this element declaration. - * @param disallowed { - * <code>DERIVATION_SUBSTITUTION, DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code> - * } or <code>DERIVATION_NONE</code>. Represents a block set for the - * element. - * @return True if <code>disallowed</code> is a part of the substitution - * group exclusion subset. - */ bool XSElementDeclaration::isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed) { if (fDisallowedSubstitutions & disallowed) - { return true; - } - return false; -} - -/** - * [disallowed substitutions]: the returned value is a bit combination of - * the subset of { - * <code>DERIVATION_SUBSTITUTION, DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code> - * } corresponding to substitutions disallowed by this - * <code>XSElementDeclaration</code> or <code>DERIVATION_NONE</code>. - */ -short XSElementDeclaration::getDisallowedSubstitutions() -{ - return fDisallowedSubstitutions; -} -/** - * {abstract} A boolean. - */ -bool XSElementDeclaration::getAbstract() -{ - if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_ABSTRACT) { - return true; - } return false; } -/** - * Optional. Annotation. - */ -XSAnnotation *XSElementDeclaration::getAnnotation() -{ - return getAnnotationFromModel(fSchemaElementDecl); -} -/** - * Process Id - */ -void XSElementDeclaration::setId(unsigned int id) +bool XSElementDeclaration::getAbstract() const { - fId = id; -} + if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_ABSTRACT) + return true; -unsigned int XSElementDeclaration::getId() const -{ - return fId; + return false; } XERCES_CPP_NAMESPACE_END
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]