diff --git a/src/xercesc/framework/psvi/XSModel.cpp b/src/xercesc/framework/psvi/XSModel.cpp index 6431ba139b032667ce101f7e8f2c9e619fcb96ea..334faaa720ce6ea321b00959defcc15e582d55b0 100644 --- a/src/xercesc/framework/psvi/XSModel.cpp +++ b/src/xercesc/framework/psvi/XSModel.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/10/10 18:37:51 neilg + * update XSModel and XSObject interface so that IDs can be used to query components in XSModels, and so that those IDs can be recovered from components + * * Revision 1.1 2003/09/16 14:33:36 neilg * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them * @@ -65,7 +68,30 @@ XERCES_CPP_NAMESPACE_BEGIN -XSModel::XSModel( MemoryManager* const manager ): +/** + * The constructor to be used wen a grammar pool contains all needed info + * + * @param grammarPool the grammar pool containing the underlying data structures + * @param manager The configurable memory manager + */ +XSModel::XSModel( XMLGrammarPool *grammarPool + , MemoryManager* const manager ): + fMemoryManager(manager) +{ +} + +/** + * The constructor to be used when the XSModel must represent all + * components in the union of an existing XSModel and a newly-created + * Grammar + * + * @param baseModel the XSModel upon which this one is based + * @param grammar the newly-created grammar whose components are to be merged + * @param manager The configurable memory manager + */ +XSModel::XSModel( XSModel *baseModel + , Grammar *grammar + , MemoryManager* const manager ): fMemoryManager(manager) { } @@ -227,6 +253,21 @@ XSNotationDeclaration *XSModel::getNotationDeclaration(const XMLCh *name return 0; } +/** + * Optional. Return a component given a component type and a unique Id. + * May not be supported for all component types. + * @param compId unique Id of the component within its type + * @param compType type of the component + * @return the component of the given type with the given Id, or 0 + * if no such component exists or this is unsupported for + * this type of component. + */ +XSObject *XSModel::getXSObjectById(unsigned int compId + , XSConstants::COMPONENT_TYPE compType) +{ + return 0; +} + XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/framework/psvi/XSModel.hpp b/src/xercesc/framework/psvi/XSModel.hpp index 2d1e1a1f2f5fc4b71bbac39c79582dc323f7b64d..1e6df4500bd5aa8b16b8a40b3e075b8a459f0386 100644 --- a/src/xercesc/framework/psvi/XSModel.hpp +++ b/src/xercesc/framework/psvi/XSModel.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/10/10 18:37:51 neilg + * update XSModel and XSObject interface so that IDs can be used to query components in XSModels, and so that those IDs can be recovered from components + * * Revision 1.1 2003/09/16 14:33:36 neilg * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them * @@ -83,6 +86,8 @@ XERCES_CPP_NAMESPACE_BEGIN */ // forward declarations +class Grammar; +class XMLGrammarPool; class XSAnnotation; class XSAttributeDeclaration; class XSAttributeGroupDefinition; @@ -102,12 +107,26 @@ public: //@{ /** - * The default constructor + * The constructor to be used wen a grammar pool contains all needed info * + * @param grammarPool the grammar pool containing the underlying data structures * @param manager The configurable memory manager */ - XSModel( - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XSModel( XMLGrammarPool *grammarPool + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * The constructor to be used when the XSModel must represent all + * components in the union of an existing XSModel and a newly-created + * Grammar + * + * @param baseModel the XSModel upon which this one is based + * @param grammar the newly-created grammar whose components are to be merged + * @param manager The configurable memory manager + */ + XSModel( XSModel *baseModel + , Grammar *grammar + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); //@}; @@ -232,6 +251,18 @@ public: XSNotationDeclaration *getNotationDeclaration(const XMLCh *name , const XMLCh *compNamespace); + /** + * Optional. Return a component given a component type and a unique Id. + * May not be supported for all component types. + * @param compId unique Id of the component within its type + * @param compType type of the component + * @return the component of the given type with the given Id, or 0 + * if no such component exists or this is unsupported for + * this type of component. + */ + XSObject *getXSObjectById(unsigned int compId + , XSConstants::COMPONENT_TYPE compType); + // @} //---------------------------------- diff --git a/src/xercesc/framework/psvi/XSObject.cpp b/src/xercesc/framework/psvi/XSObject.cpp index c061cad642c534ce879834713cdaf988fd54d093..599be45178eb734746f8649912013fa197a1e556 100644 --- a/src/xercesc/framework/psvi/XSObject.cpp +++ b/src/xercesc/framework/psvi/XSObject.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.3 2003/10/10 18:37:51 neilg + * update XSModel and XSObject interface so that IDs can be used to query components in XSModels, and so that those IDs can be recovered from components + * * Revision 1.2 2003/09/17 17:45:37 neilg * remove spurious inlines; hopefully this will make Solaris/AIX compilers happy. * @@ -95,6 +98,17 @@ XSNamespaceItem *XSObject::getNamespaceItem() return 0; } +/** + * Optional. return a unique identifier for a component within this XSModel, to + * optimize querying. May not be defined for all component types. + * @return id unique for this type of component within this XSModel + * or 0 to indicate that this is unsupported for this type of component. + */ +inline unsigned int XSObject::getId() const +{ + return 0; +} + XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/framework/psvi/XSObject.hpp b/src/xercesc/framework/psvi/XSObject.hpp index 448e72a534a0e6b6d09da1214414c7659471d673..c504702d3094fa5518b7b3a18d14f7749c3c9190 100644 --- a/src/xercesc/framework/psvi/XSObject.hpp +++ b/src/xercesc/framework/psvi/XSObject.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/10/10 18:37:51 neilg + * update XSModel and XSObject interface so that IDs can be used to query components in XSModels, and so that those IDs can be recovered from components + * * Revision 1.1 2003/09/16 14:33:36 neilg * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them * @@ -134,6 +137,14 @@ public: */ virtual XSNamespaceItem *getNamespaceItem(); + /** + * Optional. Return a unique identifier for a component within this XSModel, to + * optimize querying. May not be defined for all types of component. + * @return id unique for this type of component within this XSModel or 0 + * to indicate that this is not supported for this type of component. + */ + virtual unsigned int getId() const; + //@} //----------------------------------