peiyongz 2003/07/31 10:09:59 Modified: c/src/xercesc/validators/DTD DTDGrammar.cpp DTDGrammar.hpp Log: Grammar embed grammar description Revision Changes Path 1.7 +27 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDGrammar.cpp Index: DTDGrammar.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDGrammar.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- DTDGrammar.cpp 18 May 2003 14:02:06 -0000 1.6 +++ DTDGrammar.cpp 31 Jul 2003 17:09:59 -0000 1.7 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/07/31 17:09:59 peiyongz + * Grammar embed grammar description + * * Revision 1.6 2003/05/18 14:02:06 knoaman * Memory manager implementation: pass per instance manager. * @@ -95,6 +98,7 @@ #include <xercesc/util/XMLUniDefs.hpp> #include <xercesc/util/XMLUni.hpp> #include <xercesc/validators/DTD/DTDGrammar.hpp> +#include <xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -108,6 +112,7 @@ , fEntityDeclPool(0) , fNotationDeclPool(0) , fValidated(false) + , fGramDesc(0) { // // Init all the pool members. @@ -120,6 +125,9 @@ fEntityDeclPool = new (fMemoryManager) NameIdPool<DTDEntityDecl>(109, 128, fMemoryManager); fNotationDeclPool = new (fMemoryManager) NameIdPool<XMLNotationDecl>(109, 128, fMemoryManager); + //REVISIT: use grammarPool to create + fGramDesc = new (fMemoryManager) XMLDTDDescriptionImpl(XMLUni::fgDTDEntityString, fMemoryManager); + // // Call our own reset method. This lets us have the pool setup stuff // done in just one place (because this stame setup stuff has to be @@ -134,6 +142,7 @@ delete fElemNonDeclPool; delete fEntityDeclPool; delete fNotationDeclPool; + delete fGramDesc; } // ----------------------------------------------------------------------- @@ -219,6 +228,24 @@ fEntityDeclPool->put(new DTDEntityDecl(XMLUni::fgGT, chCloseAngle, true, true)); fEntityDeclPool->put(new DTDEntityDecl(XMLUni::fgQuot, chDoubleQuote, true, true)); fEntityDeclPool->put(new DTDEntityDecl(XMLUni::fgApos, chSingleQuote, true, true)); +} + +void DTDGrammar::setGrammarDescription( XMLGrammarDescription* gramDesc) +{ + if ((!gramDesc) || + (gramDesc->getGrammarType() != Grammar::DTDGrammarType)) + return; + + if (fGramDesc) + delete fGramDesc; + + //adopt the grammar Description + fGramDesc = (XMLDTDDescription*) gramDesc; +} + +XMLGrammarDescription* DTDGrammar::getGrammarDescription() const +{ + return fGramDesc; } XERCES_CPP_NAMESPACE_END 1.8 +12 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDGrammar.hpp Index: DTDGrammar.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDGrammar.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- DTDGrammar.hpp 16 May 2003 21:43:19 -0000 1.7 +++ DTDGrammar.hpp 31 Jul 2003 17:09:59 -0000 1.8 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2003/07/31 17:09:59 peiyongz + * Grammar embed grammar description + * * Revision 1.7 2003/05/16 21:43:19 knoaman * Memory manager implementation: Modify constructors to pass in the memory manager. * @@ -105,6 +108,8 @@ #include <xercesc/validators/common/Grammar.hpp> #include <xercesc/validators/DTD/DTDElementDecl.hpp> #include <xercesc/validators/DTD/DTDEntityDecl.hpp> +#include <xercesc/framework/XMLDTDDescription.hpp> + XERCES_CPP_NAMESPACE_BEGIN @@ -230,6 +235,9 @@ // ----------------------------------------------------------------------- void setRootElemId(unsigned int rootElemId); + virtual void setGrammarDescription( XMLGrammarDescription*); + virtual XMLGrammarDescription* getGrammarDescription() const; + // ----------------------------------------------------------------------- // Content management methods // ----------------------------------------------------------------------- @@ -272,6 +280,9 @@ // Indicates if the content of the Grammar has been pre-validated // or not. When using a cached grammar, no need for pre content // validation. + // + // fGramDesc: adopted + // // ----------------------------------------------------------------------- MemoryManager* fMemoryManager; NameIdPool<DTDElementDecl>* fElemDeclPool; @@ -280,6 +291,7 @@ NameIdPool<XMLNotationDecl>* fNotationDeclPool; unsigned int fRootElemId; bool fValidated; + XMLDTDDescription* fGramDesc; };
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]