peiyongz 2003/09/26 11:29:27
Modified: c/src/xercesc/validators/common ContentSpecNode.cpp
ContentSpecNode.hpp
Log:
Implement serialization/deserialization
Revision Changes Path
1.9 +44 -6 xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.cpp
Index: ContentSpecNode.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ContentSpecNode.cpp 18 May 2003 14:02:06 -0000 1.8
+++ ContentSpecNode.cpp 26 Sep 2003 18:29:27 -0000 1.9
@@ -62,13 +62,8 @@
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
-#include <xercesc/util/Janitor.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/util/XMLUni.hpp>
-#include <xercesc/framework/XMLNotationDecl.hpp>
#include <xercesc/framework/XMLBuffer.hpp>
#include <xercesc/validators/common/ContentSpecNode.hpp>
-#include <xercesc/validators/DTD/DTDValidator.hpp>
#include <xercesc/validators/schema/SchemaSymbols.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -302,6 +297,49 @@
}
return max;
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(ContentSpecNode)
+
+void ContentSpecNode::serialize(XSerializeEngine& serEng)
+{
+ /***
+ * Since fElement, fFirst, fSecond are NOT created by the default
+ * constructor, we need to create them dynamically.
+ ***/
+
+ if (serEng.isStoring())
+ {
+ serEng<<fElement;
+ serEng<<fFirst;
+ serEng<<fSecond;
+
+ serEng<<(int)fType;
+ serEng<<fAdoptFirst;
+ serEng<<fAdoptSecond;
+ serEng<<fMinOccurs;
+ serEng<<fMaxOccurs;
+ }
+ else
+ {
+ serEng>>fElement;
+ serEng>>fFirst;
+ serEng>>fSecond;
+
+ int type;
+ serEng>>type;
+ fType = (NodeTypes)type;
+
+ serEng>>fAdoptFirst;
+ serEng>>fAdoptSecond;
+ serEng>>fMinOccurs;
+ serEng>>fMaxOccurs;
+ }
+
}
XERCES_CPP_NAMESPACE_END
1.8 +10 -2 xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.hpp
Index: ContentSpecNode.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ContentSpecNode.hpp 18 May 2003 14:02:06 -0000 1.7
+++ ContentSpecNode.hpp 26 Sep 2003 18:29:27 -0000 1.8
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.8 2003/09/26 18:29:27 peiyongz
+ * Implement serialization/deserialization
+ *
* Revision 1.7 2003/05/18 14:02:06 knoaman
* Memory manager implementation: pass per instance manager.
*
@@ -167,13 +170,15 @@
#include <xercesc/framework/XMLElementDecl.hpp>
#include <xercesc/framework/MemoryManager.hpp>
+#include <xercesc/internal/XSerializable.hpp>
+
XERCES_CPP_NAMESPACE_BEGIN
class XMLBuffer;
class Grammar;
-class ContentSpecNode : public XMemory
+class XMLUTIL_EXPORT ContentSpecNode : public XSerializable, public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -268,6 +273,10 @@
int getMinTotalRange() const;
int getMaxTotalRange() const;
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(ContentSpecNode)
private :
// -----------------------------------------------------------------------
@@ -403,7 +412,6 @@
, fMaxOccurs(1)
{
}
-
inline ContentSpecNode::~ContentSpecNode()
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]