peiyongz 2003/09/23 11:16:07
Modified: c/src/xercesc/util XMLAbstractDoubleFloat.cpp
XMLAbstractDoubleFloat.hpp XMLBigDecimal.cpp
XMLBigDecimal.hpp XMLDateTime.cpp XMLDateTime.hpp
XMLDouble.cpp XMLDouble.hpp XMLFloat.cpp
XMLFloat.hpp XMLNumber.cpp XMLNumber.hpp
Log:
Inplementation for Serialization/Deserialization
Revision Changes Path
1.14 +53 -1 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp
Index: XMLAbstractDoubleFloat.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XMLAbstractDoubleFloat.cpp 16 May 2003 06:01:52 -0000 1.13
+++ XMLAbstractDoubleFloat.cpp 23 Sep 2003 18:16:07 -0000 1.14
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.14 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.13 2003/05/16 06:01:52 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -423,5 +426,54 @@
return;
}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_NOCREATE(XMLAbstractDoubleFloat)
+
+void XMLAbstractDoubleFloat::serialize(XSerializeEngine& serEng)
+{
+ //REVISIT: may not need to call base since it does nothing
+ XMLNumber::serialize(serEng);
+
+ if (serEng.isStoring())
+ {
+ serEng << fValue;
+ serEng << fType;
+ serEng << fDataConverted;
+ serEng << fSign;
+
+ int rawDataLen = XMLString::stringLen(fRawData);
+ serEng << rawDataLen;
+ serEng.write(fRawData, rawDataLen);
+
+ // Do not serialize fFormattedString
+
+ }
+ else
+ {
+ serEng >> fValue;
+
+ int type = 0;
+ serEng >> type;
+ fType = (LiteralType) type;
+
+ serEng >> fDataConverted;
+ serEng >> fSign;
+
+ int rawDataLen = 0;
+ serEng >> rawDataLen;
+ fRawData = (XMLCh*) fMemoryManager->allocate(rawDataLen+1);
+ serEng.read(fRawData, rawDataLen);
+ fRawData[rawDataLen] = 0;
+
+ // Set it to 0 force it to re-format if needed
+ fFormattedString = 0;
+
+ }
+
+}
XERCES_CPP_NAMESPACE_END
1.14 +9 -1 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp
Index: XMLAbstractDoubleFloat.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XMLAbstractDoubleFloat.hpp 18 May 2003 14:02:05 -0000 1.13
+++ XMLAbstractDoubleFloat.hpp 23 Sep 2003 18:16:07 -0000 1.14
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.14 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.13 2003/05/18 14:02:05 knoaman
* Memory manager implementation: pass per instance manager.
*
@@ -178,6 +181,11 @@
virtual int getSign() const;
MemoryManager* getMemoryManager() const;
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLAbstractDoubleFloat)
protected:
1.11 +60 -0 xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp
Index: XMLBigDecimal.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLBigDecimal.cpp 14 Aug 2003 02:57:27 -0000 1.10
+++ XMLBigDecimal.cpp 23 Sep 2003 18:16:07 -0000 1.11
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.11 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.10 2003/08/14 02:57:27 knoaman
* Code refactoring to improve performance of validation.
*
@@ -352,6 +355,63 @@
return -1 * lSign;
else
return 0;
+ }
+
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(XMLBigDecimal)
+
+XMLBigDecimal::XMLBigDecimal(MemoryManager* const manager)
+: fSign(0)
+, fTotalDigits(0)
+, fScale(0)
+, fRawDataLen(0)
+, fRawData(0)
+, fIntVal(0)
+, fMemoryManager(manager)
+{
+}
+
+void XMLBigDecimal::serialize(XSerializeEngine& serEng)
+{
+ //REVISIT: may not need to call base since it does nothing
+ XMLNumber::serialize(serEng);
+
+ if (serEng.isStoring())
+ {
+ serEng<<fSign;
+ serEng<<fTotalDigits;
+ serEng<<fScale;
+ serEng<<fRawDataLen;
+
+ serEng.write(fRawData, fRawDataLen);
+
+ int intValLen = XMLString::stringLen(fIntVal);
+ serEng<<intValLen;
+
+ serEng.write(fIntVal, intValLen);
+
+ }
+ else
+ {
+ serEng>>fSign;
+ serEng>>fTotalDigits;
+ serEng>>fScale;
+ serEng>>fRawDataLen;
+
+ fRawData = (XMLCh*) fMemoryManager->allocate(fRawDataLen+1);
+ serEng.read(fRawData, fRawDataLen);
+ fRawData[fRawDataLen] = 0;
+
+ int intValLen = 0;
+ serEng>>intValLen;
+ fIntVal = (XMLCh*) fMemoryManager->allocate(intValLen+1);
+ serEng.read(fIntVal, intValLen);
+ fIntVal[intValLen] = 0;
}
}
1.12 +8 -1 xml-xerces/c/src/xercesc/util/XMLBigDecimal.hpp
Index: XMLBigDecimal.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XMLBigDecimal.hpp 14 Aug 2003 02:57:27 -0000 1.11
+++ XMLBigDecimal.hpp 23 Sep 2003 18:16:07 -0000 1.12
@@ -128,6 +128,13 @@
*/
void setDecimalValue(const XMLCh* const strValue);
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLBigDecimal)
+
+ XMLBigDecimal(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
private:
void parseBigDecimal( const XMLCh* const strValue
, unsigned int strValueLen);
1.14 +61 -1 xml-xerces/c/src/xercesc/util/XMLDateTime.cpp
Index: XMLDateTime.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDateTime.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XMLDateTime.cpp 14 Aug 2003 02:57:27 -0000 1.13
+++ XMLDateTime.cpp 23 Sep 2003 18:16:07 -0000 1.14
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.14 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.13 2003/08/14 02:57:27 knoaman
* Code refactoring to improve performance of validation.
*
@@ -1429,6 +1432,63 @@
bool negative = (fBuffer[0] == chDash);
int yearVal = parseInt((negative ? 1 : 0), end);
return ( negative ? (-1) * yearVal : yearVal );
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(XMLDateTime)
+
+void XMLDateTime::serialize(XSerializeEngine& serEng)
+{
+ //REVISIT: may not need to call base since it does nothing
+ XMLNumber::serialize(serEng);
+
+ if (serEng.isStoring())
+ {
+ for (int i = 0; i < TOTAL_SIZE; i++)
+ {
+ serEng<<fValue[i];
+ }
+
+ for (int i = 0; i < TIMEZONE_ARRAYSIZE; i++)
+ {
+ serEng<<fTimeZone[i];
+ }
+
+ serEng<<fStart;
+ serEng<<fEnd;
+ serEng<<fBufferMaxLen;
+
+ int bufferLen = XMLString::stringLen(fBuffer);
+ serEng<<bufferLen;
+ serEng.write(fBuffer, bufferLen);
+ }
+ else
+ {
+ for (int i = 0; i < TOTAL_SIZE; i++)
+ {
+ serEng>>fValue[i];
+ }
+
+ for (int i = 0; i < TIMEZONE_ARRAYSIZE; i++)
+ {
+ serEng>>fTimeZone[i];
+ }
+
+ serEng>>fStart;
+ serEng>>fEnd;
+ serEng>>fBufferMaxLen;
+
+ fBuffer = (XMLCh*) fMemoryManager->allocate(fBufferMaxLen+1);
+
+ int bufferLen = 0;
+ serEng>>bufferLen;
+ serEng.read(fBuffer, bufferLen);
+ fBuffer[bufferLen] = 0;
+ }
+
}
XERCES_CPP_NAMESPACE_END
1.10 +9 -1 xml-xerces/c/src/xercesc/util/XMLDateTime.hpp
Index: XMLDateTime.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDateTime.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLDateTime.hpp 14 Aug 2003 02:57:27 -0000 1.9
+++ XMLDateTime.hpp 23 Sep 2003 18:16:07 -0000 1.10
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.10 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.9 2003/08/14 02:57:27 knoaman
* Code refactoring to improve performance of validation.
*
@@ -204,6 +207,11 @@
static int compareOrder(const XMLDateTime* const
, const XMLDateTime* const);
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLDateTime)
private:
1.11 +20 -1 xml-xerces/c/src/xercesc/util/XMLDouble.cpp
Index: XMLDouble.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDouble.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLDouble.cpp 16 May 2003 06:01:53 -0000 1.10
+++ XMLDouble.cpp 23 Sep 2003 18:16:07 -0000 1.11
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.11 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.10 2003/05/16 06:01:53 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -216,6 +219,22 @@
}
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(XMLDouble)
+
+XMLDouble::XMLDouble(MemoryManager* const manager)
+:XMLAbstractDoubleFloat(manager)
+{
+}
+
+void XMLDouble::serialize(XSerializeEngine& serEng)
+{
+ XMLAbstractDoubleFloat::serialize(serEng);
}
XERCES_CPP_NAMESPACE_END
1.6 +11 -1 xml-xerces/c/src/xercesc/util/XMLDouble.hpp
Index: XMLDouble.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDouble.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLDouble.hpp 16 May 2003 06:01:53 -0000 1.5
+++ XMLDouble.hpp 23 Sep 2003 18:16:07 -0000 1.6
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.6 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.5 2003/05/16 06:01:53 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -144,6 +147,13 @@
inline static int compareValues(const XMLDouble* const lValue
, const XMLDouble* const rValue);
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLDouble)
+
+ XMLDouble(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
protected:
1.12 +20 -1 xml-xerces/c/src/xercesc/util/XMLFloat.cpp
Index: XMLFloat.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLFloat.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XMLFloat.cpp 16 May 2003 06:01:53 -0000 1.11
+++ XMLFloat.cpp 23 Sep 2003 18:16:07 -0000 1.12
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.12 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.11 2003/05/16 06:01:53 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -235,6 +238,22 @@
fDataConverted = true;
}
}
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(XMLFloat)
+
+XMLFloat::XMLFloat(MemoryManager* const manager)
+:XMLAbstractDoubleFloat(manager)
+{
+}
+
+void XMLFloat::serialize(XSerializeEngine& serEng)
+{
+ XMLAbstractDoubleFloat::serialize(serEng);
}
XERCES_CPP_NAMESPACE_END
1.6 +11 -1 xml-xerces/c/src/xercesc/util/XMLFloat.hpp
Index: XMLFloat.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLFloat.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLFloat.hpp 16 May 2003 06:01:53 -0000 1.5
+++ XMLFloat.hpp 23 Sep 2003 18:16:07 -0000 1.6
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.6 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.5 2003/05/16 06:01:53 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -138,6 +141,13 @@
inline static int compareValues(const XMLFloat* const lValue
, const XMLFloat* const rValue);
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLFloat)
+
+ XMLFloat(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
protected:
1.3 +15 -1 xml-xerces/c/src/xercesc/util/XMLNumber.cpp
Index: XMLNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLNumber.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLNumber.cpp 4 Nov 2002 15:22:05 -0000 1.2
+++ XMLNumber.cpp 23 Sep 2003 18:16:07 -0000 1.3
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.3 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.2 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -83,5 +86,16 @@
XMLNumber::~XMLNumber()
{}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_NOCREATE(XMLNumber)
+
+void XMLNumber::serialize(XSerializeEngine& serEng)
+{
+ // this class has no data to serialize/de-serilize
+}
XERCES_CPP_NAMESPACE_END
1.8 +11 -2 xml-xerces/c/src/xercesc/util/XMLNumber.hpp
Index: XMLNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLNumber.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLNumber.hpp 15 May 2003 19:07:46 -0000 1.7
+++ XMLNumber.hpp 23 Sep 2003 18:16:07 -0000 1.8
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.8 2003/09/23 18:16:07 peiyongz
+ * Inplementation for Serialization/Deserialization
+ *
* Revision 1.7 2003/05/15 19:07:46 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -89,11 +92,12 @@
#ifndef XMLNUMBER_HPP
#define XMLNUMBER_HPP
+#include <xercesc/internal/XSerializable.hpp>
#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-class XMLUTIL_EXPORT XMLNumber : public XMemory
+class XMLUTIL_EXPORT XMLNumber : public XSerializable, public XMemory
{
public:
@@ -144,6 +148,11 @@
*
*/
virtual int getSign() const = 0;
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLNumber)
protected:
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]