You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2003/10/10 18:24:52 UTC
cvs commit: xml-xerces/c/src/xercesc/validators/DTD DTDEntityDecl.cpp DTDAttDef.cpp DTDAttDef.hpp DTDAttDefList.cpp DTDAttDefList.hpp DTDElementDecl.cpp DTDElementDecl.hpp DTDEntityDecl.hpp Makefile.in
peiyongz 2003/10/10 09:24:52
Modified: c/src/xercesc/validators/DTD DTDAttDef.cpp DTDAttDef.hpp
DTDAttDefList.cpp DTDAttDefList.hpp
DTDElementDecl.cpp DTDElementDecl.hpp
DTDEntityDecl.hpp Makefile.in
Added: c/src/xercesc/validators/DTD DTDEntityDecl.cpp
Log:
Implementation of Serialization/Deserialization
Revision Changes Path
1.5 +27 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDAttDef.cpp
Index: DTDAttDef.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDAttDef.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DTDAttDef.cpp 16 May 2003 21:43:19 -0000 1.4
+++ DTDAttDef.cpp 10 Oct 2003 16:24:51 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/10/10 16:24:51 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.4 2003/05/16 21:43:19 knoaman
* Memory manager implementation: Modify constructors to pass in the memory manager.
*
@@ -143,5 +146,29 @@
getMemoryManager()->deallocate(fName); //delete [] fName;
fName = XMLString::replicate(newName, getMemoryManager());
}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(DTDAttDef)
+
+void DTDAttDef::serialize(XSerializeEngine& serEng)
+{
+
+ XMLAttDef::serialize(serEng);
+
+ if (serEng.isStoring())
+ {
+ serEng<<fElemId;
+ serEng.writeString(fName);
+ }
+ else
+ {
+ serEng>>fElemId;
+ serEng.readString(fName);
+ }
+}
+
XERCES_CPP_NAMESPACE_END
1.6 +7 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDAttDef.hpp
Index: DTDAttDef.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDAttDef.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DTDAttDef.hpp 16 May 2003 21:43:19 -0000 1.5
+++ DTDAttDef.hpp 10 Oct 2003 16:24:51 -0000 1.6
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.6 2003/10/10 16:24:51 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.5 2003/05/16 21:43:19 knoaman
* Memory manager implementation: Modify constructors to pass in the memory manager.
*
@@ -151,6 +154,10 @@
void setElemId(const unsigned int newId);
void setName(const XMLCh* const newName);
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(DTDAttDef)
private :
// -----------------------------------------------------------------------
1.3 +90 -4 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DTDAttDefList.cpp 4 Nov 2002 14:50:40 -0000 1.2
+++ DTDAttDefList.cpp 10 Oct 2003 16:24:51 -0000 1.3
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.3 2003/10/10 16:24:51 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.2 2002/11/04 14:50:40 tng
* C++ Namespace Support.
*
@@ -89,10 +92,9 @@
// ---------------------------------------------------------------------------
// DTDAttDefList: Constructors and Destructor
// ---------------------------------------------------------------------------
-DTDAttDefList::DTDAttDefList(RefHashTableOf<DTDAttDef>* const listToUse) :
-
- fEnum(0)
- , fList(listToUse)
+DTDAttDefList::DTDAttDefList(RefHashTableOf<DTDAttDef>* const listToUse)
+:fEnum(0)
+,fList(listToUse)
{
fEnum = new RefHashTableOfEnumerator<DTDAttDef>(listToUse);
}
@@ -163,4 +165,88 @@
fEnum->Reset();
}
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(DTDAttDefList)
+
+void DTDAttDefList::serialize(XSerializeEngine& serEng)
+{
+
+ XMLAttDefList::serialize(serEng);
+
+ if (serEng.isStoring())
+ {
+ /***
+ *
+ * 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);
+ }
+ }
+
+ // do not serialize fEnum
+ }
+ else
+ {
+ /***
+ *
+ * Deserialize RefHashTableOf<DTDAttDef>
+ *
+ ***/
+ if (serEng.needToReadTemplateObject((void**)&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);
+ }
+ }
+
+}
+
+
+DTDAttDefList::DTDAttDefList(MemoryManager* const manager)
+:fEnum(0)
+,fList(0)
+{
+}
+
XERCES_CPP_NAMESPACE_END
+
1.4 +9 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDAttDefList.hpp
Index: DTDAttDefList.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDAttDefList.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DTDAttDefList.hpp 6 Dec 2002 13:27:22 -0000 1.3
+++ DTDAttDefList.hpp 10 Oct 2003 16:24:51 -0000 1.4
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/10/10 16:24:51 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.3 2002/12/06 13:27:22 tng
* [Bug 9083] Make some classes be exportable.
*
@@ -147,6 +150,12 @@
virtual XMLAttDef& nextElement();
virtual void Reset();
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(DTDAttDefList)
+
+ DTDAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
private :
// -----------------------------------------------------------------------
1.8 +102 -0 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DTDElementDecl.cpp 8 Oct 2003 21:33:18 -0000 1.7
+++ DTDElementDecl.cpp 10 Oct 2003 16:24:51 -0000 1.8
@@ -460,4 +460,106 @@
((DTDElementDecl*)this)->fAttDefs = new (getMemoryManager()) RefHashTableOf<DTDAttDef>(29, true, getMemoryManager());
}
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(DTDElementDecl)
+
+void DTDElementDecl::serialize(XSerializeEngine& serEng)
+{
+
+ /***
+ RefHashTableOf<DTDAttDef>* fAttDefs;
+ ***/
+
+ if (serEng.isStoring())
+ {
+
+ /***
+ *
+ * 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);
+ }
+ }
+
+ serEng<<fAttList;
+ serEng<<fContentSpec;
+ serEng<<(int) fModelType;
+
+ /***
+ * don't serialize
+ *
+ * XMLContentModel* fContentModel;
+ * XMLCh* fFormattedModel;
+ *
+ ***/
+
+ }
+ else
+ {
+ /***
+ *
+ * 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);
+ }
+ }
+
+ serEng>>fAttList;
+ serEng>>fContentSpec;
+
+ int i;
+ serEng>>i;
+ fModelType=(ModelTypes)i;
+
+ /***
+ * don't deserialize
+ *
+ * XMLContentModel* fContentModel;
+ * XMLCh* fFormattedModel;
+ *
+ ***/
+ fContentModel = 0;
+ fFormattedModel = 0;
+ }
+
+}
+
XERCES_CPP_NAMESPACE_END
1.7 +7 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDElementDecl.hpp
Index: DTDElementDecl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDElementDecl.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DTDElementDecl.hpp 8 Oct 2003 21:33:18 -0000 1.6
+++ DTDElementDecl.hpp 10 Oct 2003 16:24:51 -0000 1.7
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.7 2003/10/10 16:24:51 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.6 2003/10/08 21:33:18 peiyongz
* Synchronize ContentSpec/ContentModel/FormattedModel
*
@@ -230,6 +233,10 @@
void addAttDef(DTDAttDef* const toAdd);
void setModelType(const DTDElementDecl::ModelTypes toSet);
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(DTDElementDecl)
private :
// -----------------------------------------------------------------------
1.5 +7 -0 xml-xerces/c/src/xercesc/validators/DTD/DTDEntityDecl.hpp
Index: DTDEntityDecl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDEntityDecl.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DTDEntityDecl.hpp 16 May 2003 21:43:19 -0000 1.4
+++ DTDEntityDecl.hpp 10 Oct 2003 16:24:51 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/10/10 16:24:51 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.4 2003/05/16 21:43:19 knoaman
* Memory manager implementation: Modify constructors to pass in the memory manager.
*
@@ -144,6 +147,10 @@
void setIsParameter(const bool newValue);
void setIsSpecialChar(const bool newValue);
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(DTDEntityDecl)
private :
// -----------------------------------------------------------------------
1.5 +4 -0 xml-xerces/c/src/xercesc/validators/DTD/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/Makefile.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.in 20 Jun 2003 19:00:00 -0000 1.4
+++ Makefile.in 10 Oct 2003 16:24:51 -0000 1.5
@@ -55,6 +55,9 @@
#
#
# $Log$
+# Revision 1.5 2003/10/10 16:24:51 peiyongz
+# Implementation of Serialization/Deserialization
+#
# Revision 1.4 2003/06/20 19:00:00 peiyongz
# Stateless Grammar Pool :: Part I
#
@@ -154,6 +157,7 @@
DTDAttDef.$(TO) \
DTDAttDefList.$(TO) \
DTDElementDecl.$(TO) \
+ DTDEntityDecl.$(TO) \
DTDGrammar.$(TO) \
DTDScanner.$(TO) \
DTDValidator.$(TO) \
1.1 xml-xerces/c/src/xercesc/validators/DTD/DTDEntityDecl.cpp
Index: DTDEntityDecl.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DTDEntityDecl.cpp,v 1.1 2003/10/10 16:24:51 peiyongz Exp $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/validators/DTD/DTDEntityDecl.hpp>
XERCES_CPP_NAMESPACE_BEGIN
/***
* Support for Serialization/De-serialization
***/
IMPL_XSERIALIZABLE_TOCREATE(DTDEntityDecl)
void DTDEntityDecl::serialize(XSerializeEngine& serEng)
{
if (serEng.isStoring())
{
serEng<<fDeclaredInIntSubset;
serEng<<fIsParameter;
serEng<<fIsSpecialChar;
}
else
{
serEng>>fDeclaredInIntSubset;
serEng>>fIsParameter;
serEng>>fIsSpecialChar;
}
}
XERCES_CPP_NAMESPACE_END
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org