You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/01/25 14:12:58 UTC
cvs commit: ws-axis/c/src/soap/xsd UnsignedInt.cpp UnsignedInt.hpp
dicka 2005/01/25 05:12:58
Modified: c/src/common BasicTypeSerializer.cpp BasicTypeSerializer.h
c/src/soap Makefile.am SoapDeSerializer.cpp
SoapDeSerializer.h
c/vc AxisClientDLL.dsp AxisServerDLL.dsp
Added: c/src/soap/xsd UnsignedInt.cpp UnsignedInt.hpp
Log:
Add UnsignedInt type to Simple types OO model.
Submitted by: Adrian Dick
Revision Changes Path
1.45 +8 -5 ws-axis/c/src/common/BasicTypeSerializer.cpp
Index: BasicTypeSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/BasicTypeSerializer.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- BasicTypeSerializer.cpp 24 Jan 2005 09:38:32 -0000 1.44
+++ BasicTypeSerializer.cpp 25 Jan 2005 13:12:57 -0000 1.45
@@ -66,8 +66,10 @@
}
break;
case XSD_UNSIGNEDINT:
- AxisSprintf (m_Buf, BTS_BUFFSIZE, "%u", *((unsigned int*)(pValue)));
- m_sSZ += m_Buf;
+ {
+ UnsignedInt unsignedIntSerializer;
+ m_sSZ += unsignedIntSerializer.serialize(pValue);
+ }
break;
case XSD_SHORT:
{
@@ -291,9 +293,10 @@
}
break;
case XSD_UNSIGNEDINT:
- AxisSprintf (m_Buf, BTS_BUFFSIZE, "%u", *((unsigned int*)(pValue)));
- m_sSZ += m_Buf;
- break;
+ {
+ UnsignedInt unsignedIntSerializer;
+ m_sSZ += unsignedIntSerializer.serialize(pValue);
+ }
case XSD_SHORT:
{
Short shortSerializer;
1.29 +1 -0 ws-axis/c/src/common/BasicTypeSerializer.h
Index: BasicTypeSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/BasicTypeSerializer.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- BasicTypeSerializer.h 24 Jan 2005 09:38:32 -0000 1.28
+++ BasicTypeSerializer.h 25 Jan 2005 13:12:57 -0000 1.29
@@ -50,6 +50,7 @@
#include "../soap/xsd/Byte.hpp"
#include "../soap/xsd/NonNegativeInteger.hpp"
#include "../soap/xsd/UnsignedLong.hpp"
+#include "../soap/xsd/UnsignedInt.hpp"
using namespace std;
1.25 +1 -0 ws-axis/c/src/soap/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/Makefile.am,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Makefile.am 25 Jan 2005 12:04:51 -0000 1.24
+++ Makefile.am 25 Jan 2005 13:12:57 -0000 1.25
@@ -43,6 +43,7 @@
xsd/Byte.cpp \
xsd/NonNegativeInteger.cpp \
xsd/UnsignedLong.cpp \
+ xsd/UnsignedInt.cpp \
xsd/constraints/IConstrainingFacet.cpp \
xsd/constraints/WhiteSpace.cpp \
xsd/constraints/Pattern.cpp \
1.133 +25 -14 ws-axis/c/src/soap/SoapDeSerializer.cpp
Index: SoapDeSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- SoapDeSerializer.cpp 24 Jan 2005 09:38:32 -0000 1.132
+++ SoapDeSerializer.cpp 25 Jan 2005 13:12:57 -0000 1.133
@@ -879,6 +879,7 @@
#define CONV_STRTOL(str) strtol(str, &m_pEndptr, 10)
#define CONV_STRTONONNEGATIVEINTEGER(str) AxisSoapDeSerializerStringToNonNegativeInteger(str)
#define CONV_STRTOUNSIGNEDLONG(str) AxisSoapDeSerializerStringToUnsignedLong(str)
+#define CONV_STRTOUNSIGNEDINT(str) AxisSoapDeSerializerStringToUnsignedInt(str)
#define CONV_STRTOBYTE(str) AxisSoapDeSerializerStringToByte(str)
#define CONV_STRTOSHORT(str) AxisSoapDeSerializerStringToShort(str)
#define CONV_STRTOINT(str) AxisSoapDeSerializerStringToInt(str)
@@ -900,6 +901,12 @@
#define CONV_STRTOQNAME(str) AxisSoapDeSerializerStringToQName(str)
#define CONV_STRTONOTATION(str) AxisSoapDeSerializerStringToNotation(str)
+unsigned int AxisSoapDeSerializerStringToUnsignedInt(const char *valueAsChar)
+{
+ UnsignedInt unsignedIntDeserializer;
+ return *( unsignedIntDeserializer.deserializeUnsignedInt(valueAsChar));
+}
+
unsigned long AxisSoapDeSerializerStringToUnsignedLong(const char *valueAsChar)
{
UnsignedLong unsignedLongDeserializer;
@@ -1173,7 +1180,7 @@
case XSD_INT:
DESERIALIZE_ENCODED_ARRAY_BLOCK (int, CONV_STRTOINT)
case XSD_UNSIGNEDINT:
- DESERIALIZE_ENCODED_ARRAY_BLOCK (unsigned int, CONV_STRTOUL)
+ DESERIALIZE_ENCODED_ARRAY_BLOCK (unsigned int, CONV_STRTOUNSIGNEDINT)
case XSD_SHORT:
DESERIALIZE_ENCODED_ARRAY_BLOCK (short,CONV_STRTOSHORT)
case XSD_UNSIGNEDSHORT:
@@ -1260,7 +1267,7 @@
case XSD_INT:
DESERIALIZE_LITERAL_ARRAY_BLOCK (int, CONV_STRTOINT)
case XSD_UNSIGNEDINT:
- DESERIALIZE_LITERAL_ARRAY_BLOCK (unsigned int, CONV_STRTOUL)
+ DESERIALIZE_LITERAL_ARRAY_BLOCK (unsigned int, CONV_STRTOUNSIGNEDINT)
case XSD_SHORT:
DESERIALIZE_LITERAL_ARRAY_BLOCK (short, CONV_STRTOSHORT)
case XSD_UNSIGNEDSHORT:
@@ -2091,9 +2098,10 @@
m_pNode = m_pParser->next (true); /* charactor node */
if (m_pNode && (CHARACTER_ELEMENT == m_pNode->m_type))
{
- ret = strtoul (m_pNode->m_pchNameOrValue, &m_pEndptr, 10);
- m_pNode = m_pParser->next (); /* skip end element node too */
- return ret;
+ UnsignedInt unsignedIntDeserializer;
+ ret = *( unsignedIntDeserializer.deserializeUnsignedInt(m_pNode->m_pchNameOrValue) );
+ m_pNode = m_pParser->next (); /* skip end element node too */
+ return ret;
}
}
else
@@ -2116,13 +2124,14 @@
m_pNode = m_pParser->next (true); /* charactor node */
if (m_pNode && (CHARACTER_ELEMENT == m_pNode->m_type))
{
- ret = strtoul (m_pNode->m_pchNameOrValue, &m_pEndptr, 10);
- m_pNode = m_pParser->next (); /* skip end element node too */
- m_pNode = NULL;
- /* this is important in doc/lit style when deserializing
- * arrays
- */
- return ret;
+ UnsignedInt unsignedIntDeserializer;
+ ret = *( unsignedIntDeserializer.deserializeUnsignedInt(m_pNode->m_pchNameOrValue) );
+ m_pNode = m_pParser->next (); /* skip end element node too */
+ m_pNode = NULL;
+ /* this is important in doc/lit style when deserializing
+ * arrays
+ */
+ return ret;
}
else
{
@@ -4101,8 +4110,10 @@
}
break;
case XSD_UNSIGNEDINT:
- *((unsigned int *) (pValue)) =
- strtoul (m_pNode->m_pchNameOrValue, &m_pEndptr, 10);
+ {
+ UnsignedInt unsignedIntDeserializer;
+ pValue = unsignedIntDeserializer.deserialize(m_pNode->m_pchNameOrValue);
+ }
break;
case XSD_SHORT:
{
1.32 +1 -0 ws-axis/c/src/soap/SoapDeSerializer.h
Index: SoapDeSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- SoapDeSerializer.h 24 Jan 2005 09:38:32 -0000 1.31
+++ SoapDeSerializer.h 25 Jan 2005 13:12:57 -0000 1.32
@@ -41,6 +41,7 @@
#include "xsd/Byte.hpp"
#include "xsd/NonNegativeInteger.hpp"
#include "xsd/UnsignedLong.hpp"
+#include "xsd/UnsignedInt.hpp"
#include "../platforms/PlatformAutoSense.hpp"
AXIS_CPP_NAMESPACE_START
1.35 +4 -0 ws-axis/c/vc/AxisClientDLL.dsp
Index: AxisClientDLL.dsp
===================================================================
RCS file: /home/cvs/ws-axis/c/vc/AxisClientDLL.dsp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- AxisClientDLL.dsp 25 Jan 2005 12:04:52 -0000 1.34
+++ AxisClientDLL.dsp 25 Jan 2005 13:12:58 -0000 1.35
@@ -442,6 +442,10 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\UnsignedInt.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\soap\xsd\UnsignedLong.cpp
# End Source File
# Begin Source File
1.34 +4 -0 ws-axis/c/vc/AxisServerDLL.dsp
Index: AxisServerDLL.dsp
===================================================================
RCS file: /home/cvs/ws-axis/c/vc/AxisServerDLL.dsp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- AxisServerDLL.dsp 25 Jan 2005 12:04:52 -0000 1.33
+++ AxisServerDLL.dsp 25 Jan 2005 13:12:58 -0000 1.34
@@ -438,6 +438,10 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\UnsignedInt.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\soap\xsd\UnsignedLong.cpp
# End Source File
# Begin Source File
1.1 ws-axis/c/src/soap/xsd/UnsignedInt.cpp
Index: UnsignedInt.cpp
===================================================================
#include "UnsignedInt.hpp"
AXIS_CPP_NAMESPACE_START
UnsignedInt::UnsignedInt():m_UnsignedInt(NULL)
{
}
UnsignedInt::~UnsignedInt()
{
if (m_UnsignedInt)
delete m_UnsignedInt;
}
AxisChar* UnsignedInt::serialize(const void* value) throw (AxisSoapException)
{
return serialize((unsigned int*) value);
}
void* UnsignedInt::deserializer(const AxisChar* valueAsChar) throw (AxisSoapException)
{
return (void*) deserializeUnsignedInt(valueAsChar);
}
AxisChar* UnsignedInt::serialize(const unsigned int* value) throw (AxisSoapException)
{
unsigned LONGLONG valueAsLong = static_cast<unsigned long>(*value);
return UnsignedLong::serialize(&valueAsLong);
}
unsigned int* UnsignedInt::deserializeUnsignedInt(const AxisChar* valueAsChar) throw (AxisSoapException)
{
unsigned long* returnValue = UnsignedLong::deserializeUnsignedLong(valueAsChar);
if(m_UnsignedInt)
{
delete m_UnsignedInt;
m_UnsignedInt = NULL;
}
m_UnsignedInt = new unsigned int;
*m_UnsignedInt = static_cast<unsigned int> (*returnValue);
return m_UnsignedInt;
}
MaxInclusive* UnsignedInt::getMaxInclusive()
{
AxisChar* end;
LONGLONG* maxInclusive = new LONGLONG;
*maxInclusive = strtol ("4294967295", &end, 10);
MaxInclusive* retVal = new MaxInclusive(*maxInclusive);
delete maxInclusive;
return retVal;
}
AXIS_CPP_NAMESPACE_END
1.1 ws-axis/c/src/soap/xsd/UnsignedInt.hpp
Index: UnsignedInt.hpp
===================================================================
/* -*- C++ -*- */
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* @author Adrian Dick (adrian.dick@uk.ibm.com)
*
*/
#if !defined(_UNSIGNEDINT_HPP____OF_AXIS_INCLUDED_)
#define _UNSIGNEDINT_HPP____OF_AXIS_INCLUDED_
#include "UnsignedLong.hpp"
AXIS_CPP_NAMESPACE_START
using namespace std;
class UnsignedInt : public UnsignedLong {
public:
/**
* Constructor
*/
UnsignedInt();
/**
* Destructor
*/
~UnsignedInt();
/**
* Serialize value to it's on-the-wire string form.
* @param value The value to be serialized.
* @return Serialized form of value.
*/
AxisChar* serialize(const void* value) throw (AxisSoapException);
/**
* Deserialize value from it's on-the-wire string form.
* @param valueAsChar Serialized form of value.
* @return Deserialized value.
*/
void* deserializer(const AxisChar* valueAsChar) throw (AxisSoapException);
/**
* Serialize UnsignedInt value to it's on-the-wire string form.
* @param value The UnsignedInt value to be serialized.
* @return Serialized form of UnsignedInt value.
*/
AxisChar* serialize(const unsigned int* value) throw (AxisSoapException);
/**
* Deserialized UnsignedInt value from it's on-the-wire string form.
* @param valueAsChar Serialized form of UnsignedInt value.
* @return Deserialized UnsignedInt value.
*/
unsigned int* deserializeUnsignedInt(const AxisChar* valueAsChar) throw (AxisSoapException);
protected:
/**
* Creates a MaxInclusive object. For the UnsignedInt type this is
* defined as 4294967295.
* @return MaxInclusive object
*/
virtual MaxInclusive* getMaxInclusive();
private:
unsigned int *m_UnsignedInt;
};
AXIS_CPP_NAMESPACE_END
#endif