peiyongz 2003/10/17 14:14:30 Modified: c/src/xercesc/validators/DTD DTDAttDefList.cpp DTDElementDecl.cpp DTDGrammar.cpp Log: using XTemplateSerializer Revision Changes Path 1.4 +13 -45 xml-xerces/c/src/xercesc/validators/DTD/DTDAttDefList.cpp Index: DTDAttDefList.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDAttDefList.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DTDAttDefList.cpp 10 Oct 2003 16:24:51 -0000 1.3 +++ DTDAttDefList.cpp 17 Oct 2003 21:14:30 -0000 1.4 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2003/10/17 21:14:30 peiyongz + * using XTemplateSerializer + * * Revision 1.3 2003/10/10 16:24:51 peiyongz * Implementation of Serialization/Deserialization * @@ -87,6 +90,8 @@ // --------------------------------------------------------------------------- #include <xercesc/validators/DTD/DTDAttDefList.hpp> +#include <xercesc/internal/XTemplateSerializer.hpp> + XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- @@ -180,29 +185,10 @@ { /*** * - * Serialize RefHashTableOf<DTDAttDef> + * Serialize RefHashTableOf<DTDAttDef> * ***/ - if (serEng.needToWriteTemplateObject(fList)) - { - int itemNumber = 0; - fEnum->Reset(); - - while (fEnum->hasMoreElements()) - { - fEnum->nextElement(); - itemNumber++; - } - - serEng<<itemNumber; - - fEnum->Reset(); - while (fEnum->hasMoreElements()) - { - DTDAttDef& curAttDef = fEnum->nextElement(); - curAttDef.serialize(serEng); - } - } + XTemplateSerializer::storeObject(fList, serEng); // do not serialize fEnum } @@ -210,33 +196,15 @@ { /*** * - * Deserialize RefHashTableOf<DTDAttDef> + * Deserialize RefHashTableOf<DTDAttDef> * ***/ - if (serEng.needToReadTemplateObject((void**)&fList)) + XTemplateSerializer::loadObject(&fList, 3, true, serEng); + + if (!fEnum && fList) { - if (!fList) - { - fList = new RefHashTableOf<DTDAttDef>(3); - } - - serEng.registerTemplateObject(fList); - - int itemNumber = 0; - serEng>>itemNumber; - - for (int itemIndex = 0; itemIndex < itemNumber; itemIndex++) - { - DTDAttDef* data = new DTDAttDef(); - data->serialize(serEng); - fList->put((void*) data->getFullName(), data); - } - } - - if (!fEnum) - { - fEnum = new RefHashTableOfEnumerator<DTDAttDef>(fList); - } + fEnum = new RefHashTableOfEnumerator<DTDAttDef>(fList); + } } } 1.9 +7 -47 xml-xerces/c/src/xercesc/validators/DTD/DTDElementDecl.cpp Index: DTDElementDecl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDElementDecl.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- DTDElementDecl.cpp 10 Oct 2003 16:24:51 -0000 1.8 +++ DTDElementDecl.cpp 17 Oct 2003 21:14:30 -0000 1.9 @@ -73,6 +73,8 @@ #include <xercesc/validators/DTD/DTDAttDefList.hpp> #include <xercesc/validators/DTD/DTDElementDecl.hpp> +#include <xercesc/internal/XTemplateSerializer.hpp> + XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- @@ -469,38 +471,14 @@ void DTDElementDecl::serialize(XSerializeEngine& serEng) { - /*** - RefHashTableOf<DTDAttDef>* fAttDefs; - ***/ - if (serEng.isStoring()) { - /*** * - * Serialize RefHashTableOf<DTDAttDef> + * Serialize RefHashTableOf<DTDAttDef> * ***/ - if (serEng.needToWriteTemplateObject(fAttDefs)) - { - RefHashTableOfEnumerator<DTDAttDef> e(fAttDefs); - - int itemNumber = 0; - while (e.hasMoreElements()) - { - e.nextElement(); - itemNumber++; - } - - serEng<<itemNumber; - - e.Reset(); - while (e.hasMoreElements()) - { - DTDAttDef& curAttDef = e.nextElement(); - curAttDef.serialize(serEng); - } - } + XTemplateSerializer::storeObject(fAttDefs, serEng); serEng<<fAttList; serEng<<fContentSpec; @@ -519,28 +497,10 @@ { /*** * - * Deserialize RefHashTableOf<DTDAttDef> + * Deserialize RefHashTableOf<DTDAttDef> * ***/ - if (serEng.needToReadTemplateObject((void**)&fAttDefs)) - { - if (!fAttDefs) - { - fAttDefs = new RefHashTableOf<DTDAttDef>(3); - } - - serEng.registerTemplateObject(fAttDefs); - - int itemNumber = 0; - serEng>>itemNumber; - - for (int itemIndex = 0; itemIndex < itemNumber; itemIndex++) - { - DTDAttDef* data = new DTDAttDef(); - data->serialize(serEng); - fAttDefs->put((void*) data->getFullName(), data); - } - } + XTemplateSerializer::loadObject(&fAttDefs, 3, true, serEng); serEng>>fAttList; serEng>>fContentSpec; 1.11 +15 -44 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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DTDGrammar.cpp 14 Oct 2003 15:20:42 -0000 1.10 +++ DTDGrammar.cpp 17 Oct 2003 21:14:30 -0000 1.11 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.11 2003/10/17 21:14:30 peiyongz + * using XTemplateSerializer + * * Revision 1.10 2003/10/14 15:20:42 peiyongz * Implementation of Serialization/Deserialization * @@ -110,6 +113,8 @@ #include <xercesc/validators/DTD/DTDGrammar.hpp> #include <xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp> +#include <xercesc/internal/XTemplateSerializer.hpp> + XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- @@ -310,43 +315,21 @@ Grammar::serialize(serEng); -/*** - NameIdPool<DTDElementDecl>* fElemDeclPool; - NameIdPool<DTDElementDecl>* fElemNonDeclPool; - NameIdPool<DTDEntityDecl>* fEntityDeclPool; - NameIdPool<XMLNotationDecl>* fNotationDeclPool; - unsigned int fRootElemId; - bool fValidated; - XMLDTDDescription* fGramDesc; -***/ + //don't serialize fDefaultEntities 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; - * ***/ + XTemplateSerializer::storeObject(fElemDeclPool, serEng); + XTemplateSerializer::storeObject(fElemNonDeclPool, serEng); //TODO: to be removed + XTemplateSerializer::storeObject(fEntityDeclPool, serEng); + XTemplateSerializer::storeObject(fNotationDeclPool, serEng); serEng<<fRootElemId; serEng<<fValidated; @@ -359,26 +342,14 @@ /*** * * Deserialize NameIdPool<DTDElementDecl>* fElemDeclPool; - * - ***/ - - /*** - * * Deserialize NameIdPool<DTDElementDecl>* fElemNonDeclPool; - * TODO: will this data member removed? - ***/ - - /*** - * * Deserialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; - * - ***/ - - /*** - * - * Deerialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; - * + * Deerialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; ***/ + XTemplateSerializer::loadObject(&fElemDeclPool, 109, 128, serEng); + XTemplateSerializer::loadObject(&fElemNonDeclPool, 109, 128, serEng); //TODO: to be removed + XTemplateSerializer::loadObject(&fEntityDeclPool, 109, 128, serEng); + XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng); serEng>>fRootElemId; serEng>>fValidated;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]