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/24 10:38:32 UTC

cvs commit: ws-axis/c/src/soap/xsd NonNegativeInteger.cpp NonNegativeInteger.hpp UnsignedLong.cpp UnsignedLong.hpp

dicka       2005/01/24 01:38:32

  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 NonNegativeInteger.cpp NonNegativeInteger.hpp
                        UnsignedLong.cpp UnsignedLong.hpp
  Log:
  Add NonNegativeInteger and UnsignedLong types to Simple types OO model.
  
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.44      +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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- BasicTypeSerializer.cpp	21 Jan 2005 17:07:56 -0000	1.43
  +++ BasicTypeSerializer.cpp	24 Jan 2005 09:38:32 -0000	1.44
  @@ -110,8 +110,10 @@
           	}
               break;
           case XSD_UNSIGNEDLONG:
  -            AxisSprintf (m_Buf, BTS_BUFFSIZE, "%lu", *((unsigned long*)(pValue)));
  -            m_sSZ += m_Buf;
  +            {
  +                UnsignedLong unsignedLongSerializer;
  +                m_sSZ += unsignedLongSerializer.serialize(pValue);
  +            }
               break;
           case XSD_FLOAT:
           	{
  @@ -333,9 +335,10 @@
           	}
               break;
           case XSD_UNSIGNEDLONG:
  -            AxisSprintf (m_Buf, BTS_BUFFSIZE, "%lu",
  -                       *((unsigned long*)(pValue)));
  -            m_sSZ += m_Buf;
  +            {
  +                UnsignedLong unsignedLongSerializer;
  +                m_sSZ += unsignedLongSerializer.serialize(pValue);
  +            }
               break;
           case XSD_FLOAT:
           	{
  
  
  
  1.28      +2 -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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- BasicTypeSerializer.h	21 Jan 2005 17:07:56 -0000	1.27
  +++ BasicTypeSerializer.h	24 Jan 2005 09:38:32 -0000	1.28
  @@ -48,6 +48,8 @@
   #include "../soap/xsd/Int.hpp"
   #include "../soap/xsd/Short.hpp"
   #include "../soap/xsd/Byte.hpp"
  +#include "../soap/xsd/NonNegativeInteger.hpp"
  +#include "../soap/xsd/UnsignedLong.hpp"
   
   using namespace std;
   
  
  
  
  1.20      +2 -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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Makefile.am	21 Jan 2005 17:07:56 -0000	1.19
  +++ Makefile.am	24 Jan 2005 09:38:32 -0000	1.20
  @@ -41,6 +41,8 @@
           xsd/XSD_QName.cpp \
           xsd/Short.cpp \
           xsd/Byte.cpp \
  +        xsd/NonNegativeInteger.cpp \
  +        xsd/UnsignedLong.cpp \
           xsd/constraints/WhiteSpace.cpp \
           xsd/constraints/Pattern.cpp \
           xsd/constraints/MinLength.cpp \
  
  
  
  1.132     +32 -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.131
  retrieving revision 1.132
  diff -u -r1.131 -r1.132
  --- SoapDeSerializer.cpp	21 Jan 2005 17:07:56 -0000	1.131
  +++ SoapDeSerializer.cpp	24 Jan 2005 09:38:32 -0000	1.132
  @@ -877,6 +877,8 @@
   
   /* Following macros are used just to shorten the coding */
   #define CONV_STRTOL(str) strtol(str, &m_pEndptr, 10)
  +#define CONV_STRTONONNEGATIVEINTEGER(str) AxisSoapDeSerializerStringToNonNegativeInteger(str)
  +#define CONV_STRTOUNSIGNEDLONG(str) AxisSoapDeSerializerStringToUnsignedLong(str)
   #define CONV_STRTOBYTE(str) AxisSoapDeSerializerStringToByte(str)
   #define CONV_STRTOSHORT(str) AxisSoapDeSerializerStringToShort(str)
   #define CONV_STRTOINT(str) AxisSoapDeSerializerStringToInt(str)
  @@ -898,6 +900,18 @@
   #define CONV_STRTOQNAME(str) AxisSoapDeSerializerStringToQName(str)
   #define CONV_STRTONOTATION(str) AxisSoapDeSerializerStringToNotation(str)
   
  +unsigned long AxisSoapDeSerializerStringToUnsignedLong(const char *valueAsChar)
  +{
  +    UnsignedLong unsignedLongDeserializer;
  +    return *(unsignedLongDeserializer.deserializeUnsignedLong(valueAsChar));
  +}
  +
  +LONGLONG AxisSoapDeSerializerStringToNonNegativeInteger(const char *valueAsChar)
  +{
  +    NonNegativeInteger nonNegativeIntegerDeserializer;
  +    return *(nonNegativeIntegerDeserializer.deserializeNonNegativeInteger(valueAsChar));
  +}
  +
   char AxisSoapDeSerializerStringToByte(const char *valueAsChar)
   {
       Byte byteDeserializer;
  @@ -1173,7 +1187,7 @@
   		    case XSD_INTEGER:
   		    	DESERIALIZE_ENCODED_ARRAY_BLOCK (LONGLONG, CONV_STRTOINTEGER)
   		    case XSD_UNSIGNEDLONG:
  -		    	DESERIALIZE_ENCODED_ARRAY_BLOCK (unsigned long, CONV_STRTOUL)
  +		    	DESERIALIZE_ENCODED_ARRAY_BLOCK (unsigned long, CONV_STRTOUNSIGNEDLONG)
   		    case XSD_FLOAT:
   		    	DESERIALIZE_ENCODED_ARRAY_BLOCK (float, CONV_STRTOFLOAT)
   		    case XSD_DOUBLE:
  @@ -1260,7 +1274,7 @@
   		case XSD_INTEGER:
   		    DESERIALIZE_LITERAL_ARRAY_BLOCK (LONGLONG, CONV_STRTOINTEGER)
   		case XSD_UNSIGNEDLONG:
  -			DESERIALIZE_LITERAL_ARRAY_BLOCK (unsigned long, CONV_STRTOUL)
  +			DESERIALIZE_LITERAL_ARRAY_BLOCK (unsigned long, CONV_STRTOUNSIGNEDLONG)
   		case XSD_FLOAT:
   			DESERIALIZE_LITERAL_ARRAY_BLOCK (float, CONV_STRTOFLOAT)
   		case XSD_DOUBLE:
  @@ -2592,9 +2606,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;
  +            UnsignedLong unsignedLongDeserializer;
  +            ret = *( unsignedLongDeserializer.deserializeUnsignedLong(m_pNode->m_pchNameOrValue) );
  +    		m_pNode = m_pParser->next ();	/* skip end element node too */
  +    		return ret;
   	    }
   	}
   	else
  @@ -2617,13 +2632,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;
  +            UnsignedLong unsignedLongDeserializer;
  +            ret = *( unsignedLongDeserializer.deserializeUnsignedLong(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
   	    {
  @@ -4127,8 +4143,10 @@
   		}
   	    break;
   	case XSD_UNSIGNEDLONG:
  -	    *((unsigned long *) (pValue)) =
  -		strtoul (m_pNode->m_pchNameOrValue, &m_pEndptr, 10);
  +        {
  +            UnsignedLong unsignedLongDeserializer;
  +            pValue = unsignedLongDeserializer.deserialize(m_pNode->m_pchNameOrValue);
  +        }
   	    break;
   	case XSD_FLOAT:
   		{
  
  
  
  1.31      +2 -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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- SoapDeSerializer.h	21 Jan 2005 17:07:56 -0000	1.30
  +++ SoapDeSerializer.h	24 Jan 2005 09:38:32 -0000	1.31
  @@ -39,6 +39,8 @@
   #include "xsd/Int.hpp"
   #include "xsd/Short.hpp"
   #include "xsd/Byte.hpp"
  +#include "xsd/NonNegativeInteger.hpp"
  +#include "xsd/UnsignedLong.hpp"
   #include "../platforms/PlatformAutoSense.hpp"
   
   AXIS_CPP_NAMESPACE_START
  
  
  
  1.30      +8 -0      ws-axis/c/vc/AxisClientDLL.dsp
  
  Index: AxisClientDLL.dsp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/AxisClientDLL.dsp,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- AxisClientDLL.dsp	21 Jan 2005 17:07:56 -0000	1.29
  +++ AxisClientDLL.dsp	24 Jan 2005 09:38:32 -0000	1.30
  @@ -306,6 +306,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\NonNegativeInteger.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\soap\xsd\NOTATION.cpp
   # End Source File
   # Begin Source File
  @@ -411,6 +415,10 @@
   # Begin Source File
   
   SOURCE=..\src\common\TypeMapping.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\UnsignedLong.cpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.29      +8 -0      ws-axis/c/vc/AxisServerDLL.dsp
  
  Index: AxisServerDLL.dsp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/AxisServerDLL.dsp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- AxisServerDLL.dsp	21 Jan 2005 17:07:56 -0000	1.28
  +++ AxisServerDLL.dsp	24 Jan 2005 09:38:32 -0000	1.29
  @@ -302,6 +302,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\NonNegativeInteger.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\soap\xsd\NOTATION.cpp
   # End Source File
   # Begin Source File
  @@ -407,6 +411,10 @@
   # Begin Source File
   
   SOURCE=..\src\common\TypeMapping.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/NonNegativeInteger.cpp
  
  Index: NonNegativeInteger.cpp
  ===================================================================
  #include "NonNegativeInteger.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
  LONGLONG* NonNegativeInteger::deserializeNonNegativeInteger(const AxisChar* valueAsChar) throw (AxisSoapException)
  {
      return (LONGLONG*) deserialize(valueAsChar);
  }
  
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/NonNegativeInteger.hpp
  
  Index: NonNegativeInteger.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(_NONNEGATIVEINTEGER_HPP____OF_AXIS_INCLUDED_)
  #define _NONNEGATIVEINTEGER_HPP____OF_AXIS_INCLUDED_
  
  #include "Integer.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class NonNegativeInteger : public Integer {
  public:
    
    /**
     * Deserialized NonNegativeInteger value from it's on-the-wire string form.
     * @param valueAsChar Serialized form of NonNegativeInteger value.
     * @return Deserialized NonNegativeInteger value.
     */
      LONGLONG* deserializeNonNegativeInteger(const AxisChar* valueAsChar) throw (AxisSoapException);
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/UnsignedLong.cpp
  
  Index: UnsignedLong.cpp
  ===================================================================
  #include "UnsignedLong.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
  UnsignedLong::UnsignedLong():m_UnsignedLong(NULL)
  {
  }
  
  UnsignedLong::~UnsignedLong()
  {
      if (m_UnsignedLong)
          delete m_UnsignedLong;
  }
  
  AxisChar* UnsignedLong::serialize(const void* value) throw (AxisSoapException)
  {
      return serialize((unsigned long*) value);
  }
  
  void* UnsignedLong::deserializer(const AxisChar* valueAsChar) throw (AxisSoapException)
  {
      return (void*) deserializeUnsignedLong(valueAsChar);
  }
  
  AxisChar* UnsignedLong::serialize(const unsigned long* value) throw (AxisSoapException)
  {
      LONGLONG valueAsLong = static_cast<LONGLONG>(*value);
      return NonNegativeInteger::serialize(&valueAsLong);
  }
  
  unsigned long* UnsignedLong::deserializeUnsignedLong(const AxisChar* valueAsChar) throw (AxisSoapException)
  {
      LONGLONG* returnValue = NonNegativeInteger::deserializeNonNegativeInteger(valueAsChar);
   
      if(m_UnsignedLong)
      {
          delete m_UnsignedLong;
          m_UnsignedLong = NULL;
      }
      m_UnsignedLong = new unsigned long;
      *m_UnsignedLong = static_cast<unsigned long> (*returnValue);
      return m_UnsignedLong;
  }
  
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/UnsignedLong.hpp
  
  Index: UnsignedLong.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(_UNSIGNEDLONG_HPP____OF_AXIS_INCLUDED_)
  #define _UNSIGNEDLONG_HPP____OF_AXIS_INCLUDED_
  
  #include "NonNegativeInteger.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class UnsignedLong : public NonNegativeInteger {
  public:
      
      /**
       * Constructor
       */
      UnsignedLong();
      
      /**
       * Destructor
       */
      ~UnsignedLong();
  
      /**
       * 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 UnsignedLong value to it's on-the-wire string form.
       * @param value The UnsignedLong value to be serialized.
       * @return Serialized form of UnsignedLong value.
       */  
      AxisChar* serialize(const unsigned long* value) throw (AxisSoapException);
    
    /**
     * Deserialized UnsignedLong value from it's on-the-wire string form.
     * @param valueAsChar Serialized form of UnsignedLong value.
     * @return Deserialized UnsignedLong value.
     */
      unsigned long* deserializeUnsignedLong(const AxisChar* valueAsChar) throw (AxisSoapException);
      
  private:
      unsigned long *m_UnsignedLong;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif