axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: ws-axis/c/src/soap/xsd GDay.cpp GDay.hpp GMonth.cpp GMonth.hpp GMonthDay.cpp GMonthDay.hpp GYear.cpp GYear.hpp GYearMonth.cpp GYearMonth.hpp
Date Tue, 25 Jan 2005 18:08:30 GMT
dicka       2005/01/25 10:08:30

  Modified:    c/src/soap Makefile.am
               c/vc     AxisClientDLL.dsp AxisServerDLL.dsp
  Added:       c/src/soap/xsd GDay.cpp GDay.hpp GMonth.cpp GMonth.hpp
                        GMonthDay.cpp GMonthDay.hpp GYear.cpp GYear.hpp
                        GYearMonth.cpp GYearMonth.hpp
  Log:
  Add Language, GYearMonth, GYear, GMonthDay, GDay and GMonth types to Simple types OO model.
  
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.34      +5 -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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Makefile.am	25 Jan 2005 17:41:19 -0000	1.33
  +++ Makefile.am	25 Jan 2005 18:08:29 -0000	1.34
  @@ -29,6 +29,11 @@
           xsd/Boolean.cpp \
           xsd/Date.cpp \
           xsd/DateTime.cpp \
  +        xsd/GYearMonth.cpp \
  +        xsd/GYear.cpp \
  +        xsd/GMonthDay.cpp \
  +        xsd/GDay.cpp \
  +        xsd/GMonth.cpp \
           xsd/Decimal.cpp \
           xsd/Double.cpp \
           xsd/Duration.cpp \
  
  
  
  1.44      +20 -0     ws-axis/c/vc/AxisClientDLL.dsp
  
  Index: AxisClientDLL.dsp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/AxisClientDLL.dsp,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- AxisClientDLL.dsp	25 Jan 2005 17:41:19 -0000	1.43
  +++ AxisClientDLL.dsp	25 Jan 2005 18:08:29 -0000	1.44
  @@ -254,7 +254,27 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\GDay.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\common\GDefine.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GMonth.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GMonthDay.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GYear.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GYearMonth.cpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.43      +20 -0     ws-axis/c/vc/AxisServerDLL.dsp
  
  Index: AxisServerDLL.dsp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/vc/AxisServerDLL.dsp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- AxisServerDLL.dsp	25 Jan 2005 17:41:19 -0000	1.42
  +++ AxisServerDLL.dsp	25 Jan 2005 18:08:30 -0000	1.43
  @@ -250,7 +250,27 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\src\soap\xsd\GDay.cpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\src\common\GDefine.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GMonth.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GMonthDay.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GYear.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\src\soap\xsd\GYearMonth.cpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GDay.cpp
  
  Index: GDay.cpp
  ===================================================================
  #include "GDay.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      GDay::GDay():m_GDay(NULL)
      {
      }
  
      AxisChar* GDay::serialize(const void* value) throw (AxisSoapException)
      {
         return serialize((struct tm*) value);
      }
    
      void* GDay::deserialize(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
         return (void*) deserializeGDay(valueAsChar);
      }
     
      AxisChar* GDay::serialize(const struct tm* value) throw (AxisSoapException)
      {
          MinInclusive* minInclusive = getMinInclusive();
          if (minInclusive->isSet())
          {
              struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
              if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
                  exceptionMessage += asctime(&minInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minInclusive;
  
          MinExclusive* minExclusive = getMinExclusive();
          if (minExclusive->isSet())
          {
              struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
              if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
                  exceptionMessage += asctime(&minExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minExclusive;
  
          MaxInclusive* maxInclusive = getMaxInclusive();
          if (maxInclusive->isSet())
          {
              struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
              if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
                  exceptionMessage += asctime(&maxInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxInclusive;
  
          MaxExclusive* maxExclusive = getMaxExclusive();
          if (maxExclusive->isSet())
          {
              struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
              if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
                  exceptionMessage += asctime(&maxExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxExclusive;
       
       AxisChar* serializedValue = new AxisChar[80];
       strftime (serializedValue, 80, "---%d", value);
          
          IAnySimpleType::serialize(serializedValue);
          delete [] serializedValue;
          return m_Buf;
      }
    
      struct tm* GDay::deserializeGDay(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
        struct tm value;
        struct tm *pTm;
          AxisChar *cUtc;
        AxisChar *cTemp;
        AxisChar *cTemp2;
  
         time_t now;
         time (&now);
        pTm = gmtime (&now);
  
          struct tm result1;
          memcpy (&result1, pTm, sizeof (tm));
  
          pTm = localtime (&now);
         struct tm result2;
          memcpy (&result2, pTm, sizeof (tm));
  
          time_t d = mktime (&result1) - mktime (&result2);
       if (d == -1)
        {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
        }
  
          /* dismantle m_sValue to get tm value;
           * XSD_DATETIME format is
           * CCYY(-)MMZ OR
           * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
           */
          if (sscanf (valueAsChar, "---%d", &value.tm_mon) != 1)
          {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
          }
  
          value.tm_year = 1900;
          value.tm_mon--;
          value.tm_mday = 0;
          value.tm_hour = 0;
          value.tm_min = 0;
          value.tm_sec = 0;
          value.tm_isdst = -1;
  #if !defined(WIN32) && !defined(AIX) && !defined( __OS400__ ) && !defined(__sun)
          value.tm_zone = NULL;
          value.tm_gmtoff = -1;
  #endif
          cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
  
          /* if the timezone is represented adding 'Z' at the end */
          if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
          {
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = localtime (&timeInSecs);
          }
          else if (cTemp2 != NULL)
          {
              cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
              if (cUtc == NULL)
              {
                  cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
              }
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int hours = 0;
              int mins = 0;   
              if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int secs = hours * 60 * 60 + mins * 60;
              if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
              {
                  timeInSecs += secs;
              }
              else
              {
                  timeInSecs -= secs;
              }
              
              pTm = localtime (&timeInSecs);
              memcpy (&value, pTm, sizeof (tm));
              time_t t = mktime (&value);
              if (t == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              t = labs (t - d);
              pTm = gmtime (&t);
          }
          /*if the zone is not represented in the date */
          else
          {
              /*else it is assumed that the sent time is localtime */
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = gmtime (&timeInSecs);
          }
          
          if(m_GDay)
          {
              delete m_GDay;
              m_GDay = NULL;
          }
          m_GDay = new struct tm;
          memcpy (m_GDay, pTm, sizeof (tm));
          return m_GDay;
   }
  
      MinInclusive* GDay::getMinInclusive()
      {
          return new MinInclusive();
      }
  
      MinExclusive* GDay::getMinExclusive()
      {
          return new MinExclusive();
      }
  
      MaxInclusive* GDay::getMaxInclusive()
      {
          return new MaxInclusive();
      }
  
      MaxExclusive* GDay::getMaxExclusive()
      {
          return new MaxExclusive();
      }
  
      WhiteSpace* GDay::getWhiteSpace()
      {
          return new WhiteSpace(COLLAPSE);
      }
      
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GDay.hpp
  
  Index: GDay.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(_GDAY_HPP____OF_AXIS_INCLUDED_)
  #define _GDAY_HPP____OF_AXIS_INCLUDED_
  
  #include "IAnySimpleType.hpp"
  #include "constraints/MinInclusive.hpp"
  #include "constraints/MinExclusive.hpp"
  #include "constraints/MaxInclusive.hpp"
  #include "constraints/MaxExclusive.hpp"
  #include <ctime>
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class GDay : public IAnySimpleType {
  public:
  
      /**
       * Constructor
       */
      GDay();
      
    /**
      * 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* deserialize(const AxisChar* valueAsChar) throw (AxisSoapException);
      
    /**
      * Serialize GDay value to it's on-the-wire string form.
     * @param value The GDay value to be serialized.
     * @return Serialized form of GDay value.
    */
      AxisChar* serialize(const struct tm* value) throw (AxisSoapException);
     
    /**
      * Deserialized GDay value from it's on-the-wire string form.
    * @param valueAsChar Serialized form of GDay value.
     * @return Deserialized GDay value.
      */
      struct tm* deserializeGDay(const AxisChar* valueAsChar) throw (AxisSoapException);
  
  protected:
  
      /**
       * Creates a MinInclusive object.  For the GDay type this is undefined, 
       * so an unset MinInclusive object is created.
       * @return MinInclusive object
       */
      MinInclusive* getMinInclusive();
  
      /**
       * Creates a MinExclusive object.  For the GDay type this is undefined, 
       * so an unset MinExclusive object is created.
       * @return MinExclusive object
       */
      MinExclusive* getMinExclusive();    
  
      /**
       * Creates a MaxInclusive object.  For the GDay type this is undefined, 
       * so an unset MaxInclusive object is created.
       * @return MaxInclusive object
       */
      MaxInclusive* getMaxInclusive();
  
      /**
       * Creates a MaxExclusive object.  For the GDay type this is undefined, 
       * so an unset MaxExclusive object is created.
       * @return MaxExclusive object
       */
      MaxExclusive* getMaxExclusive();    
  
      /**
       * Creates a WhiteSpace object to collapse whitespace
       * @return WhiteSpace object set to collapse whitespace
       */
      WhiteSpace* getWhiteSpace();
  
  private:
     struct tm* m_GDay;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GMonth.cpp
  
  Index: GMonth.cpp
  ===================================================================
  #include "GMonth.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      GMonth::GMonth():m_GMonth(NULL)
      {
      }
  
      AxisChar* GMonth::serialize(const void* value) throw (AxisSoapException)
      {
         return serialize((struct tm*) value);
      }
    
      void* GMonth::deserialize(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
         return (void*) deserializeGMonth(valueAsChar);
      }
     
      AxisChar* GMonth::serialize(const struct tm* value) throw (AxisSoapException)
      {
          MinInclusive* minInclusive = getMinInclusive();
          if (minInclusive->isSet())
          {
              struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
              if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
                  exceptionMessage += asctime(&minInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minInclusive;
  
          MinExclusive* minExclusive = getMinExclusive();
          if (minExclusive->isSet())
          {
              struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
              if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
                  exceptionMessage += asctime(&minExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minExclusive;
  
          MaxInclusive* maxInclusive = getMaxInclusive();
          if (maxInclusive->isSet())
          {
              struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
              if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
                  exceptionMessage += asctime(&maxInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxInclusive;
  
          MaxExclusive* maxExclusive = getMaxExclusive();
          if (maxExclusive->isSet())
          {
              struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
              if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
                  exceptionMessage += asctime(&maxExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxExclusive;
       
       AxisChar* serializedValue = new AxisChar[80];
       strftime (serializedValue, 80, "--%m--", value);
          
          IAnySimpleType::serialize(serializedValue);
          delete [] serializedValue;
          return m_Buf;
      }
    
      struct tm* GMonth::deserializeGMonth(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
        struct tm value;
        struct tm *pTm;
          AxisChar *cUtc;
        AxisChar *cTemp;
        AxisChar *cTemp2;
  
         time_t now;
         time (&now);
        pTm = gmtime (&now);
  
          struct tm result1;
          memcpy (&result1, pTm, sizeof (tm));
  
          pTm = localtime (&now);
         struct tm result2;
          memcpy (&result2, pTm, sizeof (tm));
  
          time_t d = mktime (&result1) - mktime (&result2);
       if (d == -1)
        {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
        }
  
          /* dismantle m_sValue to get tm value;
           * XSD_DATETIME format is
           * CCYY(-)MMZ OR
           * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
           */
          if (sscanf (valueAsChar, "--%d--", 
              &value.tm_mon) != 1)
          {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
          }
  
          value.tm_year = 1900;
          value.tm_mon--;
          value.tm_mday = 0;
          value.tm_hour = 0;
          value.tm_min = 0;
          value.tm_sec = 0;
          value.tm_isdst = -1;
  #if !defined(WIN32) && !defined(AIX) && !defined( __OS400__ ) && !defined(__sun)
          value.tm_zone = NULL;
          value.tm_gmtoff = -1;
  #endif
          cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
  
          /* if the timezone is represented adding 'Z' at the end */
          if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
          {
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = localtime (&timeInSecs);
          }
          else if (cTemp2 != NULL)
          {
              cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
              if (cUtc == NULL)
              {
                  cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
              }
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int hours = 0;
              int mins = 0;   
              if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int secs = hours * 60 * 60 + mins * 60;
              if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
              {
                  timeInSecs += secs;
              }
              else
              {
                  timeInSecs -= secs;
              }
              
              pTm = localtime (&timeInSecs);
              memcpy (&value, pTm, sizeof (tm));
              time_t t = mktime (&value);
              if (t == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              t = labs (t - d);
              pTm = gmtime (&t);
          }
          /*if the zone is not represented in the date */
          else
          {
              /*else it is assumed that the sent time is localtime */
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = gmtime (&timeInSecs);
          }
          
          if(m_GMonth)
          {
              delete m_GMonth;
              m_GMonth = NULL;
          }
          m_GMonth = new struct tm;
          memcpy (m_GMonth, pTm, sizeof (tm));
          return m_GMonth;
   }
  
      MinInclusive* GMonth::getMinInclusive()
      {
          return new MinInclusive();
      }
  
      MinExclusive* GMonth::getMinExclusive()
      {
          return new MinExclusive();
      }
  
      MaxInclusive* GMonth::getMaxInclusive()
      {
          return new MaxInclusive();
      }
  
      MaxExclusive* GMonth::getMaxExclusive()
      {
          return new MaxExclusive();
      }
  
      WhiteSpace* GMonth::getWhiteSpace()
      {
          return new WhiteSpace(COLLAPSE);
      }
      
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GMonth.hpp
  
  Index: GMonth.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(_GMONTH_HPP____OF_AXIS_INCLUDED_)
  #define _GMONTH_HPP____OF_AXIS_INCLUDED_
  
  #include "IAnySimpleType.hpp"
  #include "constraints/MinInclusive.hpp"
  #include "constraints/MinExclusive.hpp"
  #include "constraints/MaxInclusive.hpp"
  #include "constraints/MaxExclusive.hpp"
  #include <ctime>
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class GMonth : public IAnySimpleType {
  public:
  
      /**
       * Constructor
       */
      GMonth();
      
    /**
      * 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* deserialize(const AxisChar* valueAsChar) throw (AxisSoapException);
      
    /**
      * Serialize GMonth value to it's on-the-wire string form.
     * @param value The GMonth value to be serialized.
     * @return Serialized form of GMonth value.
    */
      AxisChar* serialize(const struct tm* value) throw (AxisSoapException);
     
    /**
      * Deserialized GMonth value from it's on-the-wire string form.
    * @param valueAsChar Serialized form of GMonth value.
     * @return Deserialized GMonth value.
      */
      struct tm* deserializeGMonth(const AxisChar* valueAsChar) throw (AxisSoapException);
  
  protected:
  
      /**
       * Creates a MinInclusive object.  For the GMonth type this is undefined, 
       * so an unset MinInclusive object is created.
       * @return MinInclusive object
       */
      MinInclusive* getMinInclusive();
  
      /**
       * Creates a MinExclusive object.  For the GMonth type this is undefined, 
       * so an unset MinExclusive object is created.
       * @return MinExclusive object
       */
      MinExclusive* getMinExclusive();    
  
      /**
       * Creates a MaxInclusive object.  For the GMonth type this is undefined, 
       * so an unset MaxInclusive object is created.
       * @return MaxInclusive object
       */
      MaxInclusive* getMaxInclusive();
  
      /**
       * Creates a MaxExclusive object.  For the GMonth type this is undefined, 
       * so an unset MaxExclusive object is created.
       * @return MaxExclusive object
       */
      MaxExclusive* getMaxExclusive();    
  
      /**
       * Creates a WhiteSpace object to collapse whitespace
       * @return WhiteSpace object set to collapse whitespace
       */
      WhiteSpace* getWhiteSpace();
  
  private:
     struct tm* m_GMonth;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GMonthDay.cpp
  
  Index: GMonthDay.cpp
  ===================================================================
  #include "GMonthDay.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      GMonthDay::GMonthDay():m_GMonthDay(NULL)
      {
      }
  
      AxisChar* GMonthDay::serialize(const void* value) throw (AxisSoapException)
      {
         return serialize((struct tm*) value);
      }
    
      void* GMonthDay::deserialize(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
         return (void*) deserializeGMonthDay(valueAsChar);
      }
     
      AxisChar* GMonthDay::serialize(const struct tm* value) throw (AxisSoapException)
      {
          MinInclusive* minInclusive = getMinInclusive();
          if (minInclusive->isSet())
          {
              struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
              if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
                  exceptionMessage += asctime(&minInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minInclusive;
  
          MinExclusive* minExclusive = getMinExclusive();
          if (minExclusive->isSet())
          {
              struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
              if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
                  exceptionMessage += asctime(&minExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minExclusive;
  
          MaxInclusive* maxInclusive = getMaxInclusive();
          if (maxInclusive->isSet())
          {
              struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
              if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
                  exceptionMessage += asctime(&maxInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxInclusive;
  
          MaxExclusive* maxExclusive = getMaxExclusive();
          if (maxExclusive->isSet())
          {
              struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
              if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
                  exceptionMessage += asctime(&maxExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxExclusive;
       
       AxisChar* serializedValue = new AxisChar[80];
       strftime (serializedValue, 80, "--%m-%d", value);
          
          IAnySimpleType::serialize(serializedValue);
          delete [] serializedValue;
          return m_Buf;
      }
    
      struct tm* GMonthDay::deserializeGMonthDay(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
        struct tm value;
        struct tm *pTm;
          AxisChar *cUtc;
        AxisChar *cTemp;
        AxisChar *cTemp2;
  
         time_t now;
         time (&now);
        pTm = gmtime (&now);
  
          struct tm result1;
          memcpy (&result1, pTm, sizeof (tm));
  
          pTm = localtime (&now);
         struct tm result2;
          memcpy (&result2, pTm, sizeof (tm));
  
          time_t d = mktime (&result1) - mktime (&result2);
       if (d == -1)
        {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
        }
  
          /* dismantle m_sValue to get tm value;
           * XSD_DATETIME format is
           * CCYY(-)MMZ OR
           * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
           */
          if (sscanf (valueAsChar, "--%d-%d", &value.tm_mon, 
              &value.tm_mday) != 2)
          {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
          }
  
          value.tm_year = 1900;
          value.tm_mon--;
          value.tm_hour = 0;
          value.tm_min = 0;
          value.tm_sec = 0;
          value.tm_isdst = -1;
  #if !defined(WIN32) && !defined(AIX) && !defined( __OS400__ ) && !defined(__sun)
          value.tm_zone = NULL;
          value.tm_gmtoff = -1;
  #endif
          cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
  
          /* if the timezone is represented adding 'Z' at the end */
          if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
          {
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = localtime (&timeInSecs);
          }
          else if (cTemp2 != NULL)
          {
              cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
              if (cUtc == NULL)
              {
                  cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
              }
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int hours = 0;
              int mins = 0;   
              if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int secs = hours * 60 * 60 + mins * 60;
              if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
              {
                  timeInSecs += secs;
              }
              else
              {
                  timeInSecs -= secs;
              }
              
              pTm = localtime (&timeInSecs);
              memcpy (&value, pTm, sizeof (tm));
              time_t t = mktime (&value);
              if (t == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              t = labs (t - d);
              pTm = gmtime (&t);
          }
          /*if the zone is not represented in the date */
          else
          {
              /*else it is assumed that the sent time is localtime */
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = gmtime (&timeInSecs);
          }
          
          if(m_GMonthDay)
          {
              delete m_GMonthDay;
              m_GMonthDay = NULL;
          }
          m_GMonthDay = new struct tm;
          memcpy (m_GMonthDay, pTm, sizeof (tm));
          return m_GMonthDay;
   }
  
      MinInclusive* GMonthDay::getMinInclusive()
      {
          return new MinInclusive();
      }
  
      MinExclusive* GMonthDay::getMinExclusive()
      {
          return new MinExclusive();
      }
  
      MaxInclusive* GMonthDay::getMaxInclusive()
      {
          return new MaxInclusive();
      }
  
      MaxExclusive* GMonthDay::getMaxExclusive()
      {
          return new MaxExclusive();
      }
  
      WhiteSpace* GMonthDay::getWhiteSpace()
      {
          return new WhiteSpace(COLLAPSE);
      }
      
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GMonthDay.hpp
  
  Index: GMonthDay.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(_GMONTHDAY_HPP____OF_AXIS_INCLUDED_)
  #define _GMONTHDAY_HPP____OF_AXIS_INCLUDED_
  
  #include "IAnySimpleType.hpp"
  #include "constraints/MinInclusive.hpp"
  #include "constraints/MinExclusive.hpp"
  #include "constraints/MaxInclusive.hpp"
  #include "constraints/MaxExclusive.hpp"
  #include <ctime>
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class GMonthDay : public IAnySimpleType {
  public:
  
      /**
       * Constructor
       */
      GMonthDay();
      
    /**
      * 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* deserialize(const AxisChar* valueAsChar) throw (AxisSoapException);
      
    /**
      * Serialize GMonthDay value to it's on-the-wire string form.
     * @param value The GMonthDay value to be serialized.
     * @return Serialized form of GMonthDay value.
    */
      AxisChar* serialize(const struct tm* value) throw (AxisSoapException);
     
    /**
      * Deserialized GMonthDay value from it's on-the-wire string form.
    * @param valueAsChar Serialized form of GMonthDay value.
     * @return Deserialized GMonthDay value.
      */
      struct tm* deserializeGMonthDay(const AxisChar* valueAsChar) throw (AxisSoapException);
  
  protected:
  
      /**
       * Creates a MinInclusive object.  For the GMonthDay type this is undefined, 
       * so an unset MinInclusive object is created.
       * @return MinInclusive object
       */
      MinInclusive* getMinInclusive();
  
      /**
       * Creates a MinExclusive object.  For the GMonthDay type this is undefined, 
       * so an unset MinExclusive object is created.
       * @return MinExclusive object
       */
      MinExclusive* getMinExclusive();    
  
      /**
       * Creates a MaxInclusive object.  For the GMonthDay type this is undefined, 
       * so an unset MaxInclusive object is created.
       * @return MaxInclusive object
       */
      MaxInclusive* getMaxInclusive();
  
      /**
       * Creates a MaxExclusive object.  For the GMonthDay type this is undefined, 
       * so an unset MaxExclusive object is created.
       * @return MaxExclusive object
       */
      MaxExclusive* getMaxExclusive();    
  
      /**
       * Creates a WhiteSpace object to collapse whitespace
       * @return WhiteSpace object set to collapse whitespace
       */
      WhiteSpace* getWhiteSpace();
  
  private:
     struct tm* m_GMonthDay;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GYear.cpp
  
  Index: GYear.cpp
  ===================================================================
  #include "GYear.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      GYear::GYear():m_GYear(NULL)
      {
      }
  
      AxisChar* GYear::serialize(const void* value) throw (AxisSoapException)
      {
         return serialize((struct tm*) value);
      }
    
      void* GYear::deserialize(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
         return (void*) deserializeGYear(valueAsChar);
      }
     
      AxisChar* GYear::serialize(const struct tm* value) throw (AxisSoapException)
      {
          MinInclusive* minInclusive = getMinInclusive();
          if (minInclusive->isSet())
          {
              struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
              if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
                  exceptionMessage += asctime(&minInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minInclusive;
  
          MinExclusive* minExclusive = getMinExclusive();
          if (minExclusive->isSet())
          {
              struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
              if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
                  exceptionMessage += asctime(&minExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minExclusive;
  
          MaxInclusive* maxInclusive = getMaxInclusive();
          if (maxInclusive->isSet())
          {
              struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
              if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
                  exceptionMessage += asctime(&maxInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxInclusive;
  
          MaxExclusive* maxExclusive = getMaxExclusive();
          if (maxExclusive->isSet())
          {
              struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
              if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
                  exceptionMessage += asctime(&maxExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxExclusive;
       
       AxisChar* serializedValue = new AxisChar[80];
       strftime (serializedValue, 80, "%Y", value);
          
          IAnySimpleType::serialize(serializedValue);
          delete [] serializedValue;
          return m_Buf;
      }
    
      struct tm* GYear::deserializeGYear(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
        struct tm value;
        struct tm *pTm;
          AxisChar *cUtc;
        AxisChar *cTemp;
        AxisChar *cTemp2;
  
         time_t now;
         time (&now);
        pTm = gmtime (&now);
  
          struct tm result1;
          memcpy (&result1, pTm, sizeof (tm));
  
          pTm = localtime (&now);
         struct tm result2;
          memcpy (&result2, pTm, sizeof (tm));
  
          time_t d = mktime (&result1) - mktime (&result2);
       if (d == -1)
        {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
        }
  
          /* dismantle m_sValue to get tm value;
           * XSD_DATETIME format is
           * CCYY(-)MMZ OR
           * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
           */
          if (sscanf (valueAsChar, "%d", &value.tm_year) != 1)
          {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
          }
  
          value.tm_year -= 1900;
          value.tm_mon = 0;
          value.tm_mday = 0;
          value.tm_hour = 0;
          value.tm_min = 0;
          value.tm_sec = 0;
          value.tm_isdst = -1;
  #if !defined(WIN32) && !defined(AIX) && !defined( __OS400__ ) && !defined(__sun)
          value.tm_zone = NULL;
          value.tm_gmtoff = -1;
  #endif
          cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
  
          /* if the timezone is represented adding 'Z' at the end */
          if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
          {
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = localtime (&timeInSecs);
          }
          else if (cTemp2 != NULL)
          {
              cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
              if (cUtc == NULL)
              {
                  cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
              }
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int hours = 0;
              int mins = 0;   
              if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int secs = hours * 60 * 60 + mins * 60;
              if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
              {
                  timeInSecs += secs;
              }
              else
              {
                  timeInSecs -= secs;
              }
              
              pTm = localtime (&timeInSecs);
              memcpy (&value, pTm, sizeof (tm));
              time_t t = mktime (&value);
              if (t == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              t = labs (t - d);
              pTm = gmtime (&t);
          }
          /*if the zone is not represented in the date */
          else
          {
              /*else it is assumed that the sent time is localtime */
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = gmtime (&timeInSecs);
          }
          
          if(m_GYear)
          {
              delete m_GYear;
              m_GYear = NULL;
          }
          m_GYear = new struct tm;
          memcpy (m_GYear, pTm, sizeof (tm));
          return m_GYear;
   }
  
      MinInclusive* GYear::getMinInclusive()
      {
          return new MinInclusive();
      }
  
      MinExclusive* GYear::getMinExclusive()
      {
          return new MinExclusive();
      }
  
      MaxInclusive* GYear::getMaxInclusive()
      {
          return new MaxInclusive();
      }
  
      MaxExclusive* GYear::getMaxExclusive()
      {
          return new MaxExclusive();
      }
  
      WhiteSpace* GYear::getWhiteSpace()
      {
          return new WhiteSpace(COLLAPSE);
      }
      
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GYear.hpp
  
  Index: GYear.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(_GYEAR_HPP____OF_AXIS_INCLUDED_)
  #define _GYEAR_HPP____OF_AXIS_INCLUDED_
  
  #include "IAnySimpleType.hpp"
  #include "constraints/MinInclusive.hpp"
  #include "constraints/MinExclusive.hpp"
  #include "constraints/MaxInclusive.hpp"
  #include "constraints/MaxExclusive.hpp"
  #include <ctime>
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class GYear : public IAnySimpleType {
  public:
  
      /**
       * Constructor
       */
      GYear();
      
    /**
      * 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* deserialize(const AxisChar* valueAsChar) throw (AxisSoapException);
      
    /**
      * Serialize GYear value to it's on-the-wire string form.
     * @param value The GYear value to be serialized.
     * @return Serialized form of GYear value.
    */
      AxisChar* serialize(const struct tm* value) throw (AxisSoapException);
     
    /**
      * Deserialized GYear value from it's on-the-wire string form.
    * @param valueAsChar Serialized form of GYear value.
     * @return Deserialized GYear value.
      */
      struct tm* deserializeGYear(const AxisChar* valueAsChar) throw (AxisSoapException);
  
  protected:
  
      /**
       * Creates a MinInclusive object.  For the GYear type this is undefined, 
       * so an unset MinInclusive object is created.
       * @return MinInclusive object
       */
      MinInclusive* getMinInclusive();
  
      /**
       * Creates a MinExclusive object.  For the GYear type this is undefined, 
       * so an unset MinExclusive object is created.
       * @return MinExclusive object
       */
      MinExclusive* getMinExclusive();    
  
      /**
       * Creates a MaxInclusive object.  For the GYear type this is undefined, 
       * so an unset MaxInclusive object is created.
       * @return MaxInclusive object
       */
      MaxInclusive* getMaxInclusive();
  
      /**
       * Creates a MaxExclusive object.  For the GYear type this is undefined, 
       * so an unset MaxExclusive object is created.
       * @return MaxExclusive object
       */
      MaxExclusive* getMaxExclusive();    
  
      /**
       * Creates a WhiteSpace object to collapse whitespace
       * @return WhiteSpace object set to collapse whitespace
       */
      WhiteSpace* getWhiteSpace();
  
  private:
     struct tm* m_GYear;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GYearMonth.cpp
  
  Index: GYearMonth.cpp
  ===================================================================
  #include "GYearMonth.hpp"
  
  AXIS_CPP_NAMESPACE_START
  
      GYearMonth::GYearMonth():m_GYearMonth(NULL)
      {
      }
  
      AxisChar* GYearMonth::serialize(const void* value) throw (AxisSoapException)
      {
         return serialize((struct tm*) value);
      }
    
      void* GYearMonth::deserialize(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
         return (void*) deserializeGYearMonth(valueAsChar);
      }
     
      AxisChar* GYearMonth::serialize(const struct tm* value) throw (AxisSoapException)
      {
          MinInclusive* minInclusive = getMinInclusive();
          if (minInclusive->isSet())
          {
              struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
              if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
                  exceptionMessage += asctime(&minInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minInclusive;
  
          MinExclusive* minExclusive = getMinExclusive();
          if (minExclusive->isSet())
          {
              struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
              if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
                  exceptionMessage += asctime(&minExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete minExclusive;
  
          MaxInclusive* maxInclusive = getMaxInclusive();
          if (maxInclusive->isSet())
          {
              struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
              if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
                  exceptionMessage += asctime(&maxInclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxInclusive;
  
          MaxExclusive* maxExclusive = getMaxExclusive();
          if (maxExclusive->isSet())
          {
              struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
              if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
              {
                  AxisString exceptionMessage =
                  "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
                  exceptionMessage += asctime(&maxExclusiveAsStructTM);
                  exceptionMessage += ", Value = ";
                  exceptionMessage += asctime(value);
                  exceptionMessage += ".";
                  
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                      const_cast<AxisChar*>(exceptionMessage.c_str()));
              }
          }
          delete maxExclusive;
       
       AxisChar* serializedValue = new AxisChar[80];
       strftime (serializedValue, 80, "%Y-%m", value);
          
          IAnySimpleType::serialize(serializedValue);
          delete [] serializedValue;
          return m_Buf;
      }
    
      struct tm* GYearMonth::deserializeGYearMonth(const AxisChar* valueAsChar) throw (AxisSoapException)
      {
        struct tm value;
        struct tm *pTm;
          AxisChar *cUtc;
        AxisChar *cTemp;
        AxisChar *cTemp2;
  
         time_t now;
         time (&now);
        pTm = gmtime (&now);
  
          struct tm result1;
          memcpy (&result1, pTm, sizeof (tm));
  
          pTm = localtime (&now);
         struct tm result2;
          memcpy (&result2, pTm, sizeof (tm));
  
          time_t d = mktime (&result1) - mktime (&result2);
       if (d == -1)
        {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
        }
  
          /* dismantle m_sValue to get tm value;
           * XSD_DATETIME format is
           * CCYY(-)MMZ OR
           * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
           */
          if (sscanf (valueAsChar, "%d-%d", &value.tm_year, 
              &value.tm_mon) != 2)
          {
           throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
          }
  
          value.tm_year -= 1900;
          value.tm_mon--;
          value.tm_mday = 0;
          value.tm_hour = 0;
          value.tm_min = 0;
          value.tm_sec = 0;
          value.tm_isdst = -1;
  #if !defined(WIN32) && !defined(AIX) && !defined( __OS400__ ) && !defined(__sun)
          value.tm_zone = NULL;
          value.tm_gmtoff = -1;
  #endif
          cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
  
          /* if the timezone is represented adding 'Z' at the end */
          if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
          {
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = localtime (&timeInSecs);
          }
          else if (cTemp2 != NULL)
          {
              cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
              if (cUtc == NULL)
              {
                  cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
              }
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int hours = 0;
              int mins = 0;   
              if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              
              int secs = hours * 60 * 60 + mins * 60;
              if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
              {
                  timeInSecs += secs;
              }
              else
              {
                  timeInSecs -= secs;
              }
              
              pTm = localtime (&timeInSecs);
              memcpy (&value, pTm, sizeof (tm));
              time_t t = mktime (&value);
              if (t == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              t = labs (t - d);
              pTm = gmtime (&t);
          }
          /*if the zone is not represented in the date */
          else
          {
              /*else it is assumed that the sent time is localtime */
              time_t timeInSecs = mktime (&value);
              if (timeInSecs == -1)
              {
                  throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
              }
              pTm = gmtime (&timeInSecs);
          }
          
          if(m_GYearMonth)
          {
              delete m_GYearMonth;
              m_GYearMonth = NULL;
          }
          m_GYearMonth = new struct tm;
          memcpy (m_GYearMonth, pTm, sizeof (tm));
          return m_GYearMonth;
   }
  
      MinInclusive* GYearMonth::getMinInclusive()
      {
          return new MinInclusive();
      }
  
      MinExclusive* GYearMonth::getMinExclusive()
      {
          return new MinExclusive();
      }
  
      MaxInclusive* GYearMonth::getMaxInclusive()
      {
          return new MaxInclusive();
      }
  
      MaxExclusive* GYearMonth::getMaxExclusive()
      {
          return new MaxExclusive();
      }
  
      WhiteSpace* GYearMonth::getWhiteSpace()
      {
          return new WhiteSpace(COLLAPSE);
      }
      
  AXIS_CPP_NAMESPACE_END
  
  
  
  1.1                  ws-axis/c/src/soap/xsd/GYearMonth.hpp
  
  Index: GYearMonth.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(_GYEARMONTH_HPP____OF_AXIS_INCLUDED_)
  #define _GYEARMONTH_HPP____OF_AXIS_INCLUDED_
  
  #include "IAnySimpleType.hpp"
  #include "constraints/MinInclusive.hpp"
  #include "constraints/MinExclusive.hpp"
  #include "constraints/MaxInclusive.hpp"
  #include "constraints/MaxExclusive.hpp"
  #include <ctime>
  
  AXIS_CPP_NAMESPACE_START
  
  using namespace std;
  
  class GYearMonth : public IAnySimpleType {
  public:
  
      /**
       * Constructor
       */
      GYearMonth();
      
    /**
      * 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* deserialize(const AxisChar* valueAsChar) throw (AxisSoapException);
      
    /**
      * Serialize GYearMonth value to it's on-the-wire string form.
     * @param value The GYearMonth value to be serialized.
     * @return Serialized form of GYearMonth value.
    */
      AxisChar* serialize(const struct tm* value) throw (AxisSoapException);
     
    /**
      * Deserialized GYearMonth value from it's on-the-wire string form.
    * @param valueAsChar Serialized form of GYearMonth value.
     * @return Deserialized GYearMonth value.
      */
      struct tm* deserializeGYearMonth(const AxisChar* valueAsChar) throw (AxisSoapException);
  
  protected:
  
      /**
       * Creates a MinInclusive object.  For the GYearMonth type this is undefined, 
       * so an unset MinInclusive object is created.
       * @return MinInclusive object
       */
      MinInclusive* getMinInclusive();
  
      /**
       * Creates a MinExclusive object.  For the GYearMonth type this is undefined, 
       * so an unset MinExclusive object is created.
       * @return MinExclusive object
       */
      MinExclusive* getMinExclusive();    
  
      /**
       * Creates a MaxInclusive object.  For the GYearMonth type this is undefined, 
       * so an unset MaxInclusive object is created.
       * @return MaxInclusive object
       */
      MaxInclusive* getMaxInclusive();
  
      /**
       * Creates a MaxExclusive object.  For the GYearMonth type this is undefined, 
       * so an unset MaxExclusive object is created.
       * @return MaxExclusive object
       */
      MaxExclusive* getMaxExclusive();    
  
      /**
       * Creates a WhiteSpace object to collapse whitespace
       * @return WhiteSpace object set to collapse whitespace
       */
      WhiteSpace* getWhiteSpace();
  
  private:
     struct tm* m_GYearMonth;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  

Mime
View raw message