peiyongz 2003/10/14 08:20:42 Modified: c/src/xercesc/validators/DTD DTDGrammar.cpp DTDGrammar.hpp XMLDTDDescriptionImpl.cpp XMLDTDDescriptionImpl.hpp Log: Implementation of Serialization/Deserialization Revision Changes Path 1.10 +95 -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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- DTDGrammar.cpp 22 Sep 2003 19:49:02 -0000 1.9 +++ DTDGrammar.cpp 14 Oct 2003 15:20:42 -0000 1.10 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.10 2003/10/14 15:20:42 peiyongz + * Implementation of Serialization/Deserialization + * * Revision 1.9 2003/09/22 19:49:02 neilg * implement change to Grammar::putElem(XMLElementDecl, bool). If Grammars are used only to hold declared objects, there will be no need for the fElemNonDeclPool tables; make Grammar implementations lazily create them only if the application requires them (which good cpplications should not.) * @@ -294,6 +297,98 @@ XMLGrammarDescription* DTDGrammar::getGrammarDescription() const { return fGramDesc; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DTDGrammar) + +void DTDGrammar::serialize(XSerializeEngine& serEng) +{ + + Grammar::serialize(serEng); + +/*** + NameIdPool<DTDElementDecl>* fElemDeclPool; + NameIdPool<DTDElementDecl>* fElemNonDeclPool; + NameIdPool<DTDEntityDecl>* fEntityDeclPool; + NameIdPool<XMLNotationDecl>* fNotationDeclPool; + unsigned int fRootElemId; + bool fValidated; + XMLDTDDescription* fGramDesc; +***/ + + if (serEng.isStoring()) + { + //don't serialize fDefaultEntities + + /*** + * + * Serialize NameIdPool<DTDElementDecl>* fElemDeclPool; + * + ***/ + + /*** + * + * Serialize NameIdPool<DTDElementDecl>* fElemNonDeclPool; + * TODO: will this data member removed? + ***/ + + /*** + * + * Serialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; + * + ***/ + + /*** + * + * Serialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; + * + ***/ + + serEng<<fRootElemId; + serEng<<fValidated; + serEng<<fGramDesc; + + } + else + { + + /*** + * + * Deserialize NameIdPool<DTDElementDecl>* fElemDeclPool; + * + ***/ + + /*** + * + * Deserialize NameIdPool<DTDElementDecl>* fElemNonDeclPool; + * TODO: will this data member removed? + ***/ + + /*** + * + * Deserialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; + * + ***/ + + /*** + * + * Deerialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; + * + ***/ + + serEng>>fRootElemId; + serEng>>fValidated; + + XMLDTDDescriptionImpl* gramDesc; + serEng>>gramDesc; + fGramDesc = gramDesc; + + } + } XERCES_CPP_NAMESPACE_END 1.11 +8 -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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DTDGrammar.hpp 22 Sep 2003 19:49:02 -0000 1.10 +++ DTDGrammar.hpp 14 Oct 2003 15:20:42 -0000 1.11 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.11 2003/10/14 15:20:42 peiyongz + * Implementation of Serialization/Deserialization + * * Revision 1.10 2003/09/22 19:49:02 neilg * implement change to Grammar::putElem(XMLElementDecl, bool). If Grammars are used only to hold declared objects, there will be no need for the fElemNonDeclPool tables; make Grammar implementations lazily create them only if the application requires them (which good cpplications should not.) * @@ -262,6 +265,11 @@ // Notification that lazy data has been deleted // ----------------------------------------------------------------------- static void reinitDfltEntities(); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DTDGrammar) private: // ----------------------------------------------------------------------- 1.2 +32 -2 xml-xerces/c/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp Index: XMLDTDDescriptionImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XMLDTDDescriptionImpl.cpp 20 Jun 2003 18:39:33 -0000 1.1 +++ XMLDTDDescriptionImpl.cpp 14 Oct 2003 15:20:42 -0000 1.2 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/10/14 15:20:42 peiyongz + * Implementation of Serialization/Deserialization + * * Revision 1.1 2003/06/20 18:39:33 peiyongz * Stateless Grammar Pool :: Part I * @@ -106,5 +109,32 @@ fRootName = XMLString::replicate(rootName, XMLGrammarDescription::getMemoryManager()); } + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLDTDDescriptionImpl) + +void XMLDTDDescriptionImpl::serialize(XSerializeEngine& serEng) +{ + XMLDTDDescription::serialize(serEng); + + if (serEng.isStoring()) + { + serEng.writeString(fRootName); + } + else + { + serEng.readString((XMLCh*&)fRootName); + } + +} + +XMLDTDDescriptionImpl::XMLDTDDescriptionImpl(MemoryManager* const memMgr) +:XMLDTDDescription(memMgr) +,fRootName(0) +{ +} XERCES_CPP_NAMESPACE_END 1.2 +12 -2 xml-xerces/c/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp Index: XMLDTDDescriptionImpl.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XMLDTDDescriptionImpl.hpp 20 Jun 2003 18:39:33 -0000 1.1 +++ XMLDTDDescriptionImpl.hpp 14 Oct 2003 15:20:42 -0000 1.2 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/10/14 15:20:42 peiyongz + * Implementation of Serialization/Deserialization + * * Revision 1.1 2003/06/20 18:39:33 peiyongz * Stateless Grammar Pool :: Part I * @@ -113,6 +116,13 @@ virtual void setRootName(const XMLCh* const rootName); //@} + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLDTDDescriptionImpl) + + XMLDTDDescriptionImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + private : // ----------------------------------------------------------------------- /** name Unimplemented copy constructor and operator= */
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]