axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject cvs commit: xml-axis/c/src/common AxisTime.cpp AxisTime.h AxisUtils.cpp BasicTypeSerializer.cpp BasicTypeSerializer.h GDefine.h IParam.h IWrapperSoapSerializer.h Makefile.am Param.cpp Param.h TypeMapping.cpp
Date Mon, 01 Sep 2003 13:43:31 GMT
damitha     2003/09/01 06:43:31

  Modified:    c/src/common AxisUtils.cpp BasicTypeSerializer.cpp
                        BasicTypeSerializer.h GDefine.h IParam.h
                        IWrapperSoapSerializer.h Makefile.am Param.cpp
                        Param.h TypeMapping.cpp
  Added:       c/src/common AxisTime.cpp AxisTime.h
  Log:
  
  
  Revision  Changes    Path
  1.2       +3 -3      xml-axis/c/src/common/AxisUtils.cpp
  
  Index: AxisUtils.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/AxisUtils.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AxisUtils.cpp	27 Aug 2003 12:18:39 -0000	1.1
  +++ AxisUtils.cpp	1 Sep 2003 13:43:31 -0000	1.2
  @@ -85,16 +85,16 @@
   
   bool AxisUtils::convert(AxisString &wstr, const char *str)
   {
  -	AxisChar* pWchar = XMLString::transcode(str);
  +	AxisChar* pWchar = (wchar_t*) XMLString::transcode(str);
   	if (!pWchar) return false;
   	wstr = pWchar;
  -	XMLString::release(&pWchar);
  +	XMLString::release((XMLCh**) &pWchar);
   	return true;
   }
   
   bool AxisUtils::convert(string &str, const AxisChar *wstr)
   {
  -	char* pChar = XMLString::transcode(wstr);
  +	char* pChar = XMLString::transcode((const XMLCh*) wstr);
   	if (!pChar) return false;
   	str = pChar;
   	XMLString::release(&pChar);
  
  
  
  1.10      +90 -2     xml-axis/c/src/common/BasicTypeSerializer.cpp
  
  Index: BasicTypeSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/BasicTypeSerializer.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BasicTypeSerializer.cpp	27 Aug 2003 12:16:34 -0000	1.9
  +++ BasicTypeSerializer.cpp	1 Sep 2003 13:43:31 -0000	1.10
  @@ -85,7 +85,63 @@
   const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, int nValue)
   {
   	m_Type = XSD_INT;
  -	swprintf(m_Buf, L"%d", nValue);
  +	AxisSprintf(m_Buf, 32, L"%d", nValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, unsigned int unValue)
  +{
  +	m_Type = XSD_UNSIGNEDINT;
  +	AxisSprintf(m_Buf, 32, L"%d", unValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, char cValue)
  +{
  +	m_Type = XSD_BYTE;
  +	AxisSprintf(m_Buf, 32,L"%c", cValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, unsigned char ucValue)
  +{
  +	m_Type = XSD_UNSIGNEDBYTE;
  +	AxisSprintf(m_Buf, 32,L"%c", ucValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, short sValue)
  +{
  +	m_Type = XSD_SHORT;
  +	AxisSprintf(m_Buf, 32,L"%d", sValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, unsigned short usValue)
  +{
  +	m_Type = XSD_UNSIGNEDSHORT;
  +	AxisSprintf(m_Buf, 32,L"%d", usValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, long lValue, XSDTYPE type)
  +{
  +	m_Type = type;
  +	AxisSprintf(m_Buf, 32,L"%d", lValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, unsigned long ulValue)
  +{
  +	m_Type = XSD_UNSIGNEDLONG;
  +	AxisSprintf(m_Buf, 32,L"%d", ulValue);
   	HelpSerialize(sName, sName);
   	return m_sSZ.c_str();
   }
  @@ -93,12 +149,21 @@
   const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, float fValue)
   {
   	m_Type = XSD_FLOAT;
  -	swprintf(m_Buf, L"%f", fValue);
  +	AxisSprintf(m_Buf, 32,L"%f", fValue);
  +	HelpSerialize(sName, sName);
  +	return m_sSZ.c_str();
  +}
  +
  +const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, double dValue, XSDTYPE type)
  +{
  +	m_Type = type;
  +	AxisSprintf(m_Buf, 32,L"%f", dValue);
   	HelpSerialize(sName, sName);
   	return m_sSZ.c_str();
   }
   
   const AxisChar* BasicTypeSerializer::serialize(const AxisChar* sName, const AxisChar* sValue, XSDTYPE type)
  +
   {
   	m_Type = type;
   	HelpSerialize(sName, sValue);
  @@ -118,6 +183,7 @@
   		m_AuxStr = sValue;
   		m_sSZ += GetEntityReferenced(m_AuxStr).c_str();	
   		break;
  +          
   	default:
   		m_sSZ += m_Buf;
   	}
  @@ -131,10 +197,32 @@
   	switch (type)
   	{
   	case XSD_INT: return L"int";
  +    case XSD_UNSIGNEDINT: return L"unsignedInt";
  +    case XSD_SHORT: return L"short";
  +    case XSD_UNSIGNEDSHORT: return L"unsignedShort";
  +    case XSD_BYTE: return L"byte";
  +    case XSD_UNSIGNEDBYTE: return L"unsignedByte";
  +    case XSD_LONG: return L"long";
  +    case XSD_INTEGER: return L"integer";
  +    case XSD_UNSIGNEDLONG: return L"unsignedLong";
   	case XSD_FLOAT: return L"float";
  +    case XSD_DOUBLE: return L"double";
  +    case XSD_DECIMAL: return L"decimal";  
   	case XSD_STRING: return L"string";
   	case XSD_HEXBINARY: return L"hexBinary";
   	case XSD_BASE64BINARY: return L"base64Binary";
  +    case XSD_DURATION: return L"duration";
  +    case XSD_DATETIME: return L"dateTime";
  +    case XSD_TIME: return L"time";
  +    case XSD_DATE: return L"date";
  +    case XSD_YEARMONTH: return L"gYearMonth";
  +    case XSD_YEAR: return L"gYear";
  +    case XSD_MONTHDAY: return L"gMonthDay";
  +    case XSD_DAY: return L"gDay";
  +    case XSD_MONTH: return L"gMonth";
  +    case XSD_ANYURI: return L"anyURI";
  +    case XSD_QNAME: return L"QName";
  +    
   	default: return L" ";
   	}
   }
  
  
  
  1.12      +9 -0      xml-axis/c/src/common/BasicTypeSerializer.h
  
  Index: BasicTypeSerializer.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/BasicTypeSerializer.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- BasicTypeSerializer.h	1 Sep 2003 07:28:28 -0000	1.11
  +++ BasicTypeSerializer.h	1 Sep 2003 13:43:31 -0000	1.12
  @@ -85,8 +85,17 @@
   	const AxisString& GetEntityReferenced(const AxisString& str);
   	const AxisChar* serialize(const AxisChar* sName, const AxisChar* sValue, XSDTYPE type=XSD_STRING);
   	const AxisChar* serialize(const AxisChar* sName, float fValue);
  +    const AxisChar* serialize(const AxisChar* sName, double dValue, XSDTYPE type=XSD_DOUBLE);    
   	const AxisChar* serialize(const AxisChar* sName, int nValue);
  +    const AxisChar* serialize(const AxisChar* sName, unsigned int unValue);
  +    const AxisChar* serialize(const AxisChar* sName, short sValue);
  +    const AxisChar* serialize(const AxisChar* sName, unsigned short usValue);
  +    const AxisChar* serialize(const AxisChar* sName, char cValue);
  +    const AxisChar* serialize(const AxisChar* sName, unsigned char ucValue);
  +    const AxisChar* serialize(const AxisChar* sName, long lValue, XSDTYPE type=XSD_LONG);
  +    const AxisChar* serialize(const AxisChar* sName, unsigned long ulValue);
   	const AxisChar* BasicTypeStr(XSDTYPE type);
  +
   	BasicTypeSerializer();
   	virtual ~BasicTypeSerializer();
   
  
  
  
  1.6       +7 -1      xml-axis/c/src/common/GDefine.h
  
  Index: GDefine.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/GDefine.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GDefine.h	27 Aug 2003 12:16:34 -0000	1.5
  +++ GDefine.h	1 Sep 2003 13:43:31 -0000	1.6
  @@ -72,7 +72,13 @@
   
   #define SOAPACTIONHEADER "SOAPAction"
   #define AxisChar wchar_t //Wide charactor used in Axis
  -#define AxisString wstring //Wide string used in Axis 
  +#define AxisString wstring //Wide string used in Axis
  +
  +#ifdef WIN32
  +    #define AxisSprintf(X, Y, Z, W) swprintf(X, Z, W)        
  +#else //linux
  +    #define AxisSprintf(X, Y, Z, W) swprintf(X, Y, Z, W) 
  +#endif
   
   extern void Ax_Sleep(int);
   extern void ModuleInitialize();
  
  
  
  1.5       +51 -2     xml-axis/c/src/common/IParam.h
  
  Index: IParam.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/IParam.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IParam.h	1 Sep 2003 07:28:28 -0000	1.4
  +++ IParam.h	1 Sep 2003 13:43:31 -0000	1.5
  @@ -69,6 +69,9 @@
   #include "IWrapperSoapDeSerializer.h"
   #include "IWrapperSoapSerializer.h"
   
  +#include "TypeMapping.h"
  +#include "time.h"
  +
   #include <string>
   using namespace std;
   
  @@ -97,14 +100,27 @@
   typedef union uParamValue
   {
   	int nValue;
  +    unsigned int unValue;
  +    short sValue;
  +    unsigned short usValue;
  +    long lValue;
  +    unsigned ulValue;
  +    char cValue;
  +    unsigned char ucValue;
   	float fValue;
   	double dValue;
  +    struct tm tValue;/* this will hold the c type tm struct*/
  +    long lDuration;/* duration in seconds*/
  +    
  +
   	//all basic types should come here
   	class ArrayBean* pArray; //this is used to hold arrays
   	class IArrayBean* pIArray; //used by wrapper classes
  +
   //	class AccessBean* pBean; //this is used to hold user types
   //	class IAccessBean* pIBean; //used by wrapper classes
   	ComplexObjectHandler* pCplxObj;
  +
   	//following is used by the wrapper class to set return value in case of strings	
   	const AxisChar* pStrValue; 
   } uParamValue;
  @@ -114,17 +130,50 @@
   public:
   	IParam(){};
   	virtual ~IParam(){};
  -	virtual int GetInt()=0;
  + 
  +    virtual int GetInt() = 0;
  +    virtual unsigned int GetUnsignedInt() = 0;
  +    virtual short GetShort() = 0;
  +    virtual unsigned short GetUnsignedShort() = 0;
  +    virtual char GetByte() = 0;
  +    virtual unsigned char GetUnsignedByte() = 0;
  +    virtual long GetLong() = 0;
  +    virtual long GetInteger() = 0;
  +    virtual unsigned long GetUnsignedLong() = 0;
  +	virtual float GetFloat() = 0;
  +    virtual double GetDouble() = 0;
  +    virtual double GetDecimal() = 0;
  +	virtual const AxisString& GetString() = 0;
  +    virtual const AxisString& GetAnyURI() = 0;
  +    virtual const AxisString& GetQName() = 0;
  +	virtual const AxisString& GetHexString() = 0;
  +	virtual const AxisString& GetBase64String() = 0;
  +    /*return a tm struct which contain year-month-date-hour-
  +      minute-second*/
  +    virtual struct tm GetDateTime() = 0;
  +    virtual struct tm GetDate() = 0;
  +    virtual struct tm GetTime() = 0;
  +    /*return a tm struct which contain years-months-dates-hours-
  +      minutes-seconds which represents a duration*/
  +    virtual long GetDuration() = 0;
  +
  +    virtual int GetArraySize()= 0;
  +	virtual int SetArrayElements(void* pElements)= 0;
  +	//virtual int SetUserType(IAccessBean* pObject)= 0;
  +	//virtual void SetName(const AxisChar* sName)= 0;
  +	/*virtual int GetInt()=0;
   	virtual float GetFloat()=0;
   	virtual const AxisString& GetString()=0;
   	virtual const AxisString& GetHexString()=0;
   	virtual const AxisString& GetBase64String()=0;
   	virtual int GetArraySize()=0;
  -	virtual int SetArrayElements(void* pElements)=0;
  +	virtual int SetArrayElements(void* pElements)=0;*/
  +
   	virtual int SetArrayElements(void* pObject, AXIS_DESERIALIZE_FUNCT pDZFunct, AXIS_OBJECT_DELETE_FUNCT pDelFunct, AXIS_OBJECT_SIZE_FUNCT pSizeFunct)=0;
   //	virtual int SetUserType(IAccessBean* pObject)=0;
   	virtual int SetUserType(void* pObject, AXIS_DESERIALIZE_FUNCT pDZFunct, AXIS_OBJECT_DELETE_FUNCT pDelFunct)=0;
   	virtual void SetName(const AxisChar* sName)=0;
  +
   };
   
   #endif // !defined(AFX_IPARAM_H__25C278BB_5875_49E6_A3EC_B6AD3E543D69__INCLUDED_)
  
  
  
  1.6       +11 -2     xml-axis/c/src/common/IWrapperSoapSerializer.h
  
  Index: IWrapperSoapSerializer.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/IWrapperSoapSerializer.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- IWrapperSoapSerializer.h	1 Sep 2003 07:28:28 -0000	1.5
  +++ IWrapperSoapSerializer.h	1 Sep 2003 13:43:31 -0000	1.6
  @@ -89,8 +89,17 @@
   	virtual IArrayBean* makeArrayBean(void* pObject, void* pSZFunct, void* pDelFunct, void* pSizeFunct)=0;
   public: //Basic Type Serializing methods
   	virtual const AxisChar* SerializeBasicType(const AxisChar* sName, const AxisChar* sValue, XSDTYPE type=XSD_STRING)=0;
  -	virtual const AxisChar* SerializeBasicType(const AxisChar* sName, float fValue)=0;
  -	virtual const AxisChar* SerializeBasicType(const AxisChar* sName, int nValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, struct tm tValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, int nValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, unsigned int unValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, short sValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, unsigned short usValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, char cValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, unsigned char ucValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, long lValue, XSDTYPE type=XSD_LONG)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, unsigned long ulValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, float fValue)=0;
  +    virtual const AxisChar* SerializeBasicType(const AxisChar* sName, double dValue, XSDTYPE type=XSD_DOUBLE)=0;
   };
   
   #endif // !defined(AFX_IWRAPPERSOAPSERIALIZER_H__D3E794EC_8A67_4E0E_BE28_583DCDCE1C42__INCLUDED_)
  
  
  
  1.3       +5 -3      xml-axis/c/src/common/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Makefile.am,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.am	19 Aug 2003 04:51:13 -0000	1.2
  +++ Makefile.am	1 Sep 2003 13:43:31 -0000	1.3
  @@ -1,6 +1,8 @@
   noinst_LTLIBRARIES = libcommon.la
   
  -libcommon_la_SOURCES = Param.cpp TypeMapping.cpp Packet.cpp MessageData.cpp Debug.cpp BasicTypeSerializer.cpp AxisException.cpp ArrayBean.cpp AccessBean.cpp
  +libcommon_la_SOURCES = Param.cpp TypeMapping.cpp Packet.cpp MessageData.cpp Debug.cpp \
  + BasicTypeSerializer.cpp AxisException.cpp ArrayBean.cpp AccessBean.cpp AxisTime.cpp \
  + GDefine.cpp AxisUtils.cpp
   
  -libcommon_la_LIBADD = -L$(XERCES_HOME)/lib -lxerces-c
  -INCLUDES = -I$(XERCES_HOME)/include
  +#libcommon_la_LIBADD = -L$(XERCES_HOME)/lib -lxerces-c
  +INCLUDES = -I$(AXISCPP_HOME)/include
  
  
  
  1.13      +484 -7    xml-axis/c/src/common/Param.cpp
  
  Index: Param.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Param.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Param.cpp	1 Sep 2003 07:28:28 -0000	1.12
  +++ Param.cpp	1 Sep 2003 13:43:31 -0000	1.13
  @@ -95,6 +95,10 @@
   		m_Value.pArray->m_ItemName = param.m_Value.pArray->m_ItemName;
   		//copy constructor is not intended to use to copy the array in
   		//union v
  +	}
  +    if (m_Type == XSD_DURATION || m_Type == XSD_DATETIME)
  +	{
  +        m_uAxisTime.setType(m_Type);
   	}	
   	else 
   	{
  @@ -108,12 +112,33 @@
   	m_Type = type;
   	switch (type)
   	{
  +    case XSD_DURATION: m_sName = L"Duration"; break;
  +    case XSD_DATETIME: m_sName = L"DateTime"; break;
  +    case XSD_TIME: m_sName = L"Time"; break;
  +    case XSD_DATE: m_sName = L"Date"; break;
  +    case XSD_YEARMONTH: m_sName = L"YearMonth"; break;
  +    case XSD_YEAR: m_sName = L"Year"; break;
  +    case XSD_MONTHDAY: m_sName = L"MonthDay"; break;
  +    case XSD_DAY: m_sName = L"Day"; break;
  +    case XSD_MONTH: m_sName = L"Month"; break;
  +    case XSD_ANYURI: m_sName = L"AnyURIString"; break;
  +    case XSD_QNAME: m_sName = L"QNameString"; break;
   	case XSD_STRING: m_sName = L"String"; break;
   	case XSD_BASE64BINARY: m_sName = L"Base64BinaryString"; break;
   	case XSD_HEXBINARY: m_sName = L"HexBinaryString"; break;
   	}
   }
   
  +Param::Param(time_t time)
  +{
  +    m_uAxisTime = AxisTime(time);
  +}
  +
  +Param::Param(struct tm timeStruct)
  +{
  +    m_uAxisTime = AxisTime(timeStruct);
  +}
  +
   Param::Param(int nValue)
   {
   	m_sName = L"Int";
  @@ -121,6 +146,60 @@
   	m_Type = XSD_INT;
   }
   
  +Param::Param(unsigned int unValue)
  +{
  +	m_sName = L"Unsigned Int";
  +	m_Value.unValue = unValue;
  +	m_Type = XSD_UNSIGNEDINT;
  +}
  +
  +Param::Param(short sValue)
  +{
  +    m_sName = L"Short";
  +	m_Value.sValue = sValue;
  +	m_Type = XSD_SHORT;	
  +}
  +
  +Param::Param(unsigned short usValue)
  +{
  +    m_sName = L"Unsigned Short";
  +	m_Value.usValue = usValue;
  +	m_Type = XSD_UNSIGNEDSHORT;
  +}
  +
  +Param::Param(char cValue)
  +{
  +    m_sName = L"Byte";
  +	m_Value.cValue = cValue;
  +	m_Type = XSD_BYTE;
  +}
  +
  +Param::Param(unsigned char ucValue)
  +{
  +    m_sName = L"Unsigned Byte";
  +	m_Value.ucValue = ucValue;
  +	m_Type = XSD_UNSIGNEDBYTE;
  +}
  +
  +Param::Param(long lValue, XSDTYPE type)
  +{
  +    m_Type = type;
  +	switch (type)
  +	{
  +        case XSD_LONG:m_sName = L"Long";
  +        case XSD_INTEGER: m_sName = L"Integer";
  +            m_Value.lValue = lValue;
  +            break;
  +	}
  +}
  +
  +Param::Param(unsigned long ulValue)
  +{
  +	m_sName = L"Unsigned Long";
  +	m_Value.ulValue = ulValue;
  +	m_Type = XSD_UNSIGNEDLONG;
  +}
  +
   Param::Param(float fValue)
   {
   	m_sName = L"Float";
  @@ -128,13 +207,24 @@
   	m_Type = XSD_FLOAT;
   }
   
  -Param::Param(double dValue)
  +Param::Param(double dValue, XSDTYPE type)
   {
  -	m_sName = L"Double";
  +	m_Type = type;
  +	switch (type)
  +	{
  +        case XSD_DOUBLE: m_sName = L"Double";
  +        case XSD_DECIMAL: m_sName = L"Decimal";
  +            m_Value.dValue = dValue;
  +            break;
  +	}
  +	/*m_sName = L"Double";
   	m_Value.dValue = dValue;
  -	m_Type = XSD_DOUBLE;
  +	m_Type = XSD_DOUBLE;*/
  +
   }
   
  +
  +
   Param::~Param()
   {
   	switch (m_Type){
  @@ -163,7 +253,36 @@
   	return m_sValue;
   }
   
  +const AxisString& Param::GetAnyURI()
  +{
  +	if (m_Type == XSD_ANYURI){}
  +	else if (m_Type == XSD_UNKNOWN) //see GetInt() to see why we do this
  +	{
  +		m_Type = XSD_ANYURI;
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_sValue;
  +}
  +
  +const AxisString& Param::GetQName()
  +{
  +	if (m_Type == XSD_QNAME){}
  +	else if (m_Type == XSD_UNKNOWN) //see GetInt() to see why we do this
  +	{
  +		m_Type = XSD_QNAME;
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_sValue;
  +}
  +
   const AxisString& Param::GetHexString()
  +
   {
   	if (m_Type == XSD_HEXBINARY){}
   	else if (m_Type == XSD_UNKNOWN) //see GetInt() to see why we do this
  @@ -210,6 +329,234 @@
   	return m_Value.nValue;
   }
   
  +struct tm Param::GetDateTime()
  +{
  +	if (m_Type == XSD_DATETIME){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_DATETIME;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_uAxisTime.getDateTime();
  +}
  +
  +struct tm Param::GetDate()
  +{
  +	if (m_Type == XSD_DATE){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_DATE;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_uAxisTime.getDate();
  +}
  +
  +struct tm Param::GetTime()
  +{
  +	if (m_Type == XSD_TIME){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_TIME;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_uAxisTime.getTime();
  +}
  +
  +long Param::GetDuration()
  +{
  +	if (m_Type == XSD_DURATION){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_DATETIME;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_uAxisTime.getDuration();
  +}
  +
  +unsigned int Param::GetUnsignedInt()
  +{
  +	if (m_Type == XSD_UNSIGNEDINT){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_UNSIGNEDINT;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.unValue;
  +}
  +
  +short Param::GetShort()
  +{
  +	if (m_Type == XSD_SHORT){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_SHORT;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.sValue;
  +}
  +
  +unsigned short Param::GetUnsignedShort()
  +{
  +	if (m_Type == XSD_UNSIGNEDSHORT){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_UNSIGNEDSHORT;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.usValue;
  +}
  +
  +char Param::GetByte()
  +{
  +	if (m_Type == XSD_BYTE){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_BYTE;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.cValue;
  +}
  +
  +unsigned char Param::GetUnsignedByte()
  +{
  +	if (m_Type == XSD_UNSIGNEDBYTE){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_UNSIGNEDBYTE;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.ucValue;
  +}
  +
  +long Param::GetLong()
  +{
  +	if (m_Type == XSD_LONG){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_LONG;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.lValue;
  +}
  +
  +long Param::GetInteger()
  +{
  +	if (m_Type == XSD_INTEGER){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_INTEGER;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.lValue;
  +}
  +
  +unsigned long Param::GetUnsignedLong()
  +{
  +	if (m_Type == XSD_UNSIGNEDLONG){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		//this situation comes when the soap does not contain the type of a parameter
  +		//but the wrapper class method knows exactly what the type of this parameter is.
  +		//then the deserializer must have put the value as a string and type as XSD_UNKNOWN.
  +		//so convert the m_sValue in to an int and change the types etc
  +		m_Type = XSD_UNSIGNEDLONG;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.ulValue;
  +}
  +
   float Param::GetFloat()
   {
   	if (m_Type == XSD_FLOAT){}
  @@ -225,6 +572,36 @@
   	return m_Value.fValue;
   }
   
  +double Param::GetDouble()
  +{
  +	if (m_Type == XSD_DOUBLE){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		m_Type = XSD_DOUBLE;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.dValue;
  +}
  +
  +double Param::GetDecimal()
  +{
  +	if (m_Type == XSD_DECIMAL){}
  +	else if (m_Type == XSD_UNKNOWN)
  +	{
  +		m_Type = XSD_DECIMAL;
  +		SetValue(m_sValue.c_str());
  +	}
  +	else
  +	{
  +		//exception
  +	}
  +	return m_Value.dValue;
  +}
  +
   XSDTYPE Param::GetType() const
   {
   	return m_Type;
  @@ -235,11 +612,38 @@
   	AxisString ATprefix;
   	switch (m_Type){
   	case XSD_INT:
  -		pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.nValue);
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.nValue);
  +		break; 
  +    case XSD_UNSIGNEDINT:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.unValue);
  +		break;           
  +    case XSD_SHORT:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.sValue);
  +		break; 
  +    case XSD_UNSIGNEDSHORT:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.usValue);
  +		break;         
  +    case XSD_BYTE:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.cValue);
  +		break; 
  +    case XSD_UNSIGNEDBYTE:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.ucValue);
  +		break;
  +    case XSD_LONG:
  +    case XSD_INTEGER:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.lValue);
  +		break;        
  +    case XSD_UNSIGNEDLONG:
  +        pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.ulValue);
  +
   		break;
   	case XSD_FLOAT:
   		pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.fValue);
   		break;
  +    case XSD_DOUBLE:
  +    case XSD_DECIMAL:
  +		pSZ << m_BTSZ.serialize(m_sName.c_str(), m_Value.dValue);
  +		break;              
   	case XSD_STRING:
   		pSZ << m_BTSZ.serialize(m_sName.c_str(), m_sValue.c_str());
   		break;
  @@ -249,6 +653,14 @@
   	case XSD_BASE64BINARY:
   		pSZ << m_BTSZ.serialize(m_sName.c_str(), m_sValue.c_str(), XSD_BASE64BINARY);
   		break;
  +	case XSD_DURATION:
  +        pSZ << m_uAxisTime.serialize(m_sName, m_Value.lDuration).c_str();
  +        break;
  +    case XSD_DATETIME:
  +    case XSD_DATE:
  +    case XSD_TIME:
  +            pSZ << m_uAxisTime.serialize(m_sName, m_Value.tValue).c_str();            
  +        break;        
   	case XSD_ARRAY:
   		//pSZ << "<abc:ArrayOfPhoneNumbers xmlns:abc="http://example.org/2001/06/numbers"
   		//				xmlns:enc="http://www.w3.org/2001/06/soap-encoding" 
  @@ -321,16 +733,48 @@
   	switch (m_Type)
   	{
   	case XSD_INT:
  -		m_Value.nValue = wcstol(sValue, &endptr, 10);
  +        m_Value.nValue = wcstol(sValue, &endptr, 10);
  +		break;
  +    case XSD_UNSIGNEDINT:
  +        m_Value.nValue = wcstol(sValue, &endptr, 10);
   		break;
  +    case XSD_SHORT:
  +        m_Value.sValue = wcstol(sValue, &endptr, 10);
  +		break;
  +    case XSD_UNSIGNEDSHORT:
  +        m_Value.usValue = wcstol(sValue, &endptr, 10);
  +		break;
  +    case XSD_BYTE:
  +        m_Value.cValue = wcstol(sValue, &endptr, 10);
  +		break;
  +    case XSD_UNSIGNEDBYTE:
  +		m_Value.ucValue = wcstol(sValue, &endptr, 10);
  +		break;              
  +    case XSD_LONG:
  +    case XSD_INTEGER:
  +        m_Value.lValue = wcstol(sValue, &endptr, 10);
  +		break;                
  +    case XSD_UNSIGNEDLONG:
  +		m_Value.ulValue = wcstol(sValue, &endptr, 10);
  +		break;        
   	case XSD_FLOAT:
   		m_Value.fValue = wcstod(sValue, &endptr);
   		break;
  +    case XSD_DOUBLE:
  +    case XSD_DECIMAL:
  +		m_Value.dValue = wcstod(sValue, &endptr);
  +		break;        
   	case XSD_STRING:
   	case XSD_HEXBINARY:
   	case XSD_BASE64BINARY:
   		m_sValue = sValue;
   		break;
  +    case XSD_DURATION:
  +    case XSD_DATETIME:
  +    case XSD_DATE:
  +    case XSD_TIME:
  +		m_uAxisTime.setValue(sValue);
  +		break;        
   	//Continue this for all basic types
   	case XSD_ARRAY:
   	case USER_TYPE:
  @@ -348,16 +792,49 @@
   	switch (m_Type)
   	{
   	case XSD_INT:
  -		m_Value.nValue = Value.nValue;
  +        m_Value.nValue = Value.nValue;
  +		break;
  +	case XSD_UNSIGNEDINT:
  +        m_Value.unValue = Value.unValue;
  +		break;
  +    case XSD_SHORT:
  +        m_Value.sValue = Value.sValue;
  +		break;
  +	case XSD_UNSIGNEDSHORT:
  +        m_Value.usValue = Value.usValue;
  +		break;
  +    case XSD_BYTE:
  +        m_Value.cValue = Value.cValue;
  +		break;
  +	case XSD_UNSIGNEDBYTE:
  +        m_Value.ucValue = Value.ucValue;
  +		break;
  +    case XSD_LONG:
  +    case XSD_INTEGER:
  +        m_Value.lValue = Value.lValue;
  +		break;
  +	case XSD_UNSIGNEDLONG:
  +        m_Value.ulValue = Value.ulValue;
   		break;
   	case XSD_FLOAT:
  -		m_Value.fValue = Value.fValue;
  +        m_Value.fValue = Value.fValue;
   		break;
  +    case XSD_DOUBLE:
  +    case XSD_DECIMAL:
  +		m_Value.dValue = Value.dValue;
  +		break;        
   	case XSD_STRING:
   	case XSD_HEXBINARY:
   	case XSD_BASE64BINARY:
   		m_sValue = Value.pStrValue;
   		break;
  +  case XSD_DURATION:
  +        m_Value.lDuration = Value.lDuration;
  +    case XSD_DATETIME:
  +    case XSD_DATE:
  +    case XSD_TIME:
  +        m_Value.tValue = Value.tValue;
  +        m_uAxisTime.setValue(nType, m_Value);
   	//Continue this for all basic types
   	case XSD_ARRAY:
   		m_Value.pArray = Value.pArray;
  
  
  
  1.12      +30 -1     xml-axis/c/src/common/Param.h
  
  Index: Param.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Param.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Param.h	1 Sep 2003 07:28:28 -0000	1.11
  +++ Param.h	1 Sep 2003 13:43:31 -0000	1.12
  @@ -71,6 +71,7 @@
   
   #include "IParam.h"
   #include "BasicTypeSerializer.h"
  +#include "AxisTime.h"
   
   #include <string>
   using namespace std;
  @@ -84,11 +85,21 @@
   	friend class XMLStreamHandler;
   public:
   	Param(){ m_Type = USER_TYPE;}; //if there is no attribute that says the type
  +
  +    Param(time_t time);
  +    Param(struct tm timeStruct);
   	Param(const Param& param);
   	Param(const AxisChar* str, XSDTYPE type = XSD_STRING);
   	Param(int nValue);
  +    Param(unsigned int unValue);   
  +    Param(short sValue);
  +    Param(unsigned short usValue);
  +    Param(char cValue);
  +    Param(unsigned char ucValue);
  +    Param(long lValue, XSDTYPE type=XSD_LONG);
  +    Param(unsigned long ulValue);
   	Param(float fValue);
  -	Param(double dValue);
  +	Param(double dValue, XSDTYPE type=XSD_DOUBLE);
   	virtual ~Param();
   	void operator=(const Param &param);
   
  @@ -110,7 +121,23 @@
   
   	//Following functions are used by wrapper class methods making sure of the valid type.
   	int GetInt();
  +    unsigned int GetUnsignedInt();    
  +    short GetShort();
  +    unsigned short GetUnsignedShort();
  +    char GetByte();
  +    unsigned char GetUnsignedByte();
  +    long GetLong();
  +    long GetInteger();
  +    unsigned long GetUnsignedLong();
   	float GetFloat();
  +    double GetDouble();
  +    double GetDecimal();
  +    const AxisString& GetAnyURI();
  +    const AxisString& GetQName();
  +    struct tm GetDateTime();
  +    struct tm GetDate();
  +    struct tm GetTime();
  +    long GetDuration();
   	const AxisString& GetString();
   	const AxisString& GetHexString();
   	const AxisString& GetBase64String();
  @@ -124,6 +151,8 @@
   	void SetName(const AxisChar* sName);
   private:
   	BasicTypeSerializer m_BTSZ;
  +    AxisTime m_uAxisTime;
  +    //uDuration duration;
   };
   
   #endif // !defined(AFX_PARAM_H__351B13BB_5D03_40C5_93F5_56D17295A8BD__INCLUDED_)
  
  
  
  1.4       +16 -0     xml-axis/c/src/common/TypeMapping.cpp
  
  Index: TypeMapping.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/TypeMapping.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeMapping.cpp	27 Aug 2003 12:16:34 -0000	1.3
  +++ TypeMapping.cpp	1 Sep 2003 13:43:31 -0000	1.4
  @@ -91,7 +91,23 @@
   	if (!m_bInit)
   	{
   		m_sTypeMap[L"int"] = XSD_INT;
  +        m_sTypeMap[L"unsignedInt"] = XSD_UNSIGNEDINT;
  +        m_sTypeMap[L"short"] = XSD_SHORT;
  +        m_sTypeMap[L"unsignedShort"] = XSD_UNSIGNEDSHORT;
  +        m_sTypeMap[L"byte"] = XSD_BYTE;
  +        m_sTypeMap[L"unsignedByte"] = XSD_UNSIGNEDBYTE;
  +        m_sTypeMap[L"long"] = XSD_LONG;
  +        m_sTypeMap[L"integer"] = XSD_INTEGER;
  +        m_sTypeMap[L"unsignedLong"] = XSD_UNSIGNEDLONG;
  +        m_sTypeMap[L"float"] = XSD_FLOAT;
  +        m_sTypeMap[L"double"] = XSD_DOUBLE;
  +        m_sTypeMap[L"decimal"] = XSD_DECIMAL;
   		m_sTypeMap[L"string"] = XSD_STRING;
  +        m_sTypeMap[L"duration"] = XSD_DURATION;
  +        m_sTypeMap[L"dateTime"] = XSD_DATETIME;
  +        m_sTypeMap[L"date"] = XSD_DATE;
  +        m_sTypeMap[L"time"] = XSD_TIME;
  +        
   		m_bInit = true;
   	}
   }
  
  
  
  1.1                  xml-axis/c/src/common/AxisTime.cpp
  
  Index: AxisTime.cpp
  ===================================================================
  #include "AxisTime.h"
  #include "AxisUtils.h"
  
  AxisTime::AxisTime()
  {
      
  }
  
  AxisTime::AxisTime(struct tm ntime)
  {
      m_TMUTC = ntime;
  }
  
  AxisTime::AxisTime(time_t m_Time)
  {
      if(m_Time != NULL)
      {
          gmtime_r(&m_Time, &m_TMUTC);
      }
  }
  
  AxisTime::~AxisTime()
  {
      
  }
  
  void AxisTime::setValue(const AxisChar* strValue)
  {
      m_sValue = strValue;
      mkCTime();
  }
  
  void AxisTime::setValue(XSDTYPE type,  uParamValue Value)
  {
      m_Type = type;
      if(type = XSD_DURATION)
      {
          m_Duration = Value.lDuration;        
      }
      else
      {
          m_TM = Value.tValue;
      }
  }
  
  void AxisTime::setType(XSDTYPE xsdType)
  {
      m_Type = xsdType;
  }
  
  AxisString AxisTime::getValue()
  {
      return m_sValue;
  }
  
  /**
  * Serialize the duration in seconds into a xml duration string
  * of the format PnYnMnDTnHnMnS
  */
  AxisString& AxisTime::serialize(const AxisString& sName, long lDuration)
  {
          AxisChar buff[4];
          strXSDDuration = L"P";
          int x = 365 * 24 * 3600;
          int intYears = lDuration / x;
          //sprintf((char*)buff,"%d", intYears);
          AxisSprintf(buff, 4, L"%d", intYears);
          strXSDDuration.append(buff);
          lDuration = lDuration - (lDuration / x * x);
          x = 30 * 24 * 3600;
          int intMonths = lDuration / x;
          //sprintf((char*)buff,"%d", intMonths);
          AxisSprintf(buff, 4, L"%d", intMonths);
          strXSDDuration.append(buff);
          lDuration = lDuration - (lDuration / x * x);
          x = 24 * 3600;
          int intDays = lDuration / x;
          //sprintf((char*)buff,"%d", intDays);
          AxisSprintf(buff, 4, L"%d", intDays);
          strXSDDuration.append(buff);
          lDuration = lDuration - (lDuration / x * x);
          x = 3600;
          int intHours = lDuration / x;
          //sprintf((char*)buff,"%d", intHours);
          AxisSprintf(buff, 4, L"%d", intHours);
          strXSDDuration.append(buff);
          lDuration = lDuration - (lDuration / x * x);
          x = 60;
          int intMins = lDuration / x;
          //sprintf((char*)buff,"%d", intMins);
          AxisSprintf(buff, 4, L"%d", intMins);
          strXSDDuration.append(buff);
          int intSecs = lDuration - (lDuration / x * x);
          //sprintf((char*)buff,"%d", intSecs);
          AxisSprintf(buff, 4, L"%d", intSecs);
          strXSDDuration.append(buff);
          
          return strXSDDuration;
  }
  
  /**
  * Serialize the c type tm struct into a xml date string.
  * The serialized date will represent UTC time
  */
  AxisString& AxisTime::serialize(const AxisString& sName, struct tm tValue)
  {
          /*formats the output date in the format CCYY-MM-DDThh:mm:ssZ*/
          switch(m_Type)
          {
              case XSD_DATETIME:
                  strftime(buf1, 80, "%Y-%m-%dT%H:%M:%SZ", &tValue);
                  //strXSDDate = buf1;
                  AxisUtils::convert(strXSDDate, buf1);
              case XSD_DATE:
                  strftime(buf1, 80, "%Y-%m-%dZ", &tValue);
                  //strXSDDate = buf1;
                  AxisUtils::convert(strXSDDate, buf1);
              case XSD_TIME:
                  strftime(buf1, 80, "%H:%M:%SZ", &tValue);
                  //strXSDDate = buf1;
                  AxisUtils::convert(strXSDDate, buf1);
              
          }
          
          return strXSDDate;
  }
  
  /**
  * This function deserialize the xml datetime type into a c type
  * tm struct. The struct tm created will contain the UTC time
  */
  void AxisTime::mkCTime()
  {
      AxisChar* endptr;
      int intPos, intPos1, intPos2, intPos3, intPos4, intPos5, intPos6;
      AxisChar buff[4];
      time_t now;
      struct tm result1, result2;
      time(&now);
      gmtime_r(&now, &result1);
      localtime_r(&now, &result2);
      time_t d = mktime(&result1) - mktime(&result2);
      
      switch(m_Type)
      {
          case XSD_DURATION:
              /*XSD_DURATION is of the format PnYnMnDTnHnMnS*/
              intPos1 = m_sValue.find_first_of(L"Y");
              strYears = m_sValue.substr(1,intPos1 - 1);
              //intYears = atoi(strYears.c_str());
              intYears = wcstol(strYears.c_str(), &endptr, 10);
              duration.years = intYears;
              intPos2 = m_sValue.find_first_of(L"M");
              strMonths = m_sValue.substr(intPos1 + 1, intPos2 - intPos1 - 1);
              //intMonths = atoi(strMonths.c_str());
              intMonths = wcstol(strMonths.c_str(), &endptr, 10);
              duration.months = intMonths;
              intPos3 = m_sValue.find_first_of(L"D");
              strDays = m_sValue.substr(intPos2 + 1, intPos3 - intPos2 -1);
              //intDays = atoi(strDays.c_str());
              intDays = wcstol(strDays.c_str(), &endptr, 10);
              duration.days = intDays;
              intPos4 = m_sValue.find_first_of(L"H");
              strHours = m_sValue.substr(intPos3 + 1, intPos4 - intPos3 -1);
              //intHours = atoi(strHours.c_str());
              intHours = wcstol(strHours.c_str(), &endptr, 10);
              duration.hours = intHours;
              intPos5 = m_sValue.find_first_of(L"M");
              strMins = m_sValue.substr(intPos4 + 1, intPos5 - intPos4 -1);
              //intMins = atoi(strMins.c_str());
              intMins = wcstol(strMins.c_str(), &endptr, 10);
              duration.mins = intMins;
              intPos6 = m_sValue.find_first_of(L"S");
              strSecs = m_sValue.substr(intPos5 + 1, intPos6 - intPos5 -1);
              //intSecs = atoi(strSecs.c_str());
              intSecs = wcstol(strSecs.c_str(), &endptr, 10);
              duration.secs = intSecs;
  
              break;
      
          case XSD_DATETIME:
      
              /*dismantle m_sValue to get tm value;
                  XSD_DATETIME format is
                  CCYY(-)MM(-)DDThh:mm:ss.ss...Z OR
                  CCYY(-)MM(-)DDThh:mm:ss.ss...+/-<UTC TIME DIFFERENCE>            
              */        
              strYears = m_sValue.substr(0,2);
              //intYears = atoi(strYears.c_str()) - 1900;
              intYears = wcstol(strYears.c_str(), &endptr, 10) - 1900;
              //sprintf((char*)buff,"%d", intYears);
              AxisSprintf(buff, 4, L"%d", intYears);
              strYears = buff;
              intPos = m_sValue.find_first_of(L"-");
              /* date is of the format CCYY-MM-DD */
              if(intPos != std::string::npos && intPos<=7)
              {
                  strMonths = m_sValue.substr(5,2);            
                  strDays = m_sValue.substr(8,2);            
                  strHours = m_sValue.substr(11,2);            
                  strMins = m_sValue.substr(14,2);            
                  /*Decimal fraction of the second is omitted*/
                  strSecs = m_sValue.substr(17,2);
                  strZone = m_sValue.substr(19,m_sValue.length()-19);            
              }
              /* date is of the format CCYYMMDD */
              else if((intPos == std::string::npos) || (intPos != std::string::npos && intPos > 7))
              {
                  strMonths = m_sValue.substr(4,2);
                  strMonths = m_sValue.substr(6,2);
                  strHours = m_sValue.substr(9,2);
                  strMins = m_sValue.substr(12,2);
                  /*Decimal fraction of the second is omitted*/
                  strSecs = m_sValue.substr(15,2);
                  strZone = m_sValue.substr(17,m_sValue.length()-17);            
              }
  
              //m_TM.tm_year = atoi(strYears.c_str());
              m_TM.tm_year = wcstol(strYears.c_str(), &endptr, 10);
              //m_TM.tm_mon = atoi(strMonths.c_str());
              m_TM.tm_mon = wcstol(strMonths.c_str(), &endptr, 10);
              //m_TM.tm_mday = atoi(strDays.c_str());
              m_TM.tm_mday = wcstol(strDays.c_str(), &endptr, 10);
              //m_TM.tm_hour = atoi(strHours.c_str());
              m_TM.tm_hour = wcstol(strHours.c_str(), &endptr, 10);
              //m_TM.tm_min = atoi(strMins.c_str());
              m_TM.tm_min = wcstol(strMins.c_str(), &endptr, 10);
              //m_TM.tm_sec = atoi(strSecs.c_str());
              m_TM.tm_sec = wcstol(strSecs.c_str(), &endptr, 10);
  
              /*if the timezone is represented adding 'Z' at the end*/
              if(strZone.substr(0,1) == L"Z")
              {
                  time_t timeInSecs = mktime(&m_TM);
                  localtime_r(&timeInSecs, &m_TMUTC);                        
              }
              /*if the timezone is represented using +/-hh:mm format*/
              else if(strZone.substr(0,1) == L"+" ||strZone.substr(0,1) == L"-")
              {
                  time_t timeInSecs = mktime(&m_TM);
                  localtime_r(&timeInSecs, &m_TMUTC);
                  //intHours = atoi(strZone.substr(1,2).c_str());
                  intHours = wcstol(strZone.substr(1,2).c_str(), &endptr, 10);
                  //intMins = atoi(strZone.substr(3,2).c_str());
                  intMins = wcstol(strZone.substr(3,2).c_str(), &endptr, 10);
                  intSecs = intHours * 60 * 60 + intMins * 60;
                  if(strZone.substr(0,1) == L"+")
                  {
                      timeInSecs += intSecs;
                      localtime_r(&timeInSecs, &m_TM);
                      time_t t = mktime(&m_TM);
                      t = abs(t - d);
                      gmtime_r(&t, &m_TMUTC);
                  
                  }
                  else if(strZone.substr(0,1) == L"-")
                  {
                      timeInSecs - intSecs;
                      localtime_r(&timeInSecs, &m_TM);
                      time_t t = mktime(&m_TM);
                      t = abs(t - d);
                      gmtime_r(&t, &m_TMUTC);
                  }
              }
              /*if the zone is not represented in the date*/
              else
              {
                  /*else it is assumed that the sent time is localtime*/
                  time_t timeInSecs = mktime(&m_TM);
                  gmtime_r(&timeInSecs, &m_TMUTC);
              }
  
              break;
  
          case XSD_DATE:
              /*dismantle m_sValue to get tm value;
                  XSD_DATETIME format is
                  CCYY(-)MM(-)DDZ OR
                  CCYY(-)MM(-)DD+/-<UTC TIME DIFFERENCE>
              */
              strYears = m_sValue.substr(0,2);
              //intYears = atoi(strYears.c_str()) - 1900;
              intYears = wcstol(strYears.c_str(), &endptr, 10) - 1900;
              //sprintf((char*)buff,"%d", intYears);
              AxisSprintf(buff, 4, L"%d", intYears);
              strYears = buff;
              intPos = m_sValue.find_first_of(L"-");
              /* date is of the format CCYY-MM-DD */
              if(intPos != std::string::npos && intPos <= 7)
              {
                  strMonths = m_sValue.substr(5,2);
                  strDays = m_sValue.substr(8,2);
                  strZone = m_sValue.substr(10,m_sValue.length() - 10);
              }
              /* date is of the format CCYYMMDD */
              else if((intPos == std::string::npos) || (intPos != std::string::npos && intPos > 7))
              {
                  strMonths = m_sValue.substr(4,2);
                  strMonths = m_sValue.substr(6,2);
                  strZone = m_sValue.substr(8,m_sValue.length() - 8);
              }
  
              //m_TM.tm_year = atoi(strYears.c_str());
              m_TM.tm_year= wcstol(strYears.c_str(), &endptr, 10);
              //m_TM.tm_mon = atoi(strMonths.c_str());
              m_TM.tm_mon = wcstol(strMonths.c_str(), &endptr, 10);
              //m_TM.tm_mday = atoi(strDays.c_str());
              m_TM.tm_mday = wcstol(strDays.c_str(), &endptr, 10);
  
              /*if the timezone is represented adding 'Z' at the end*/
              if(strZone.substr(0,1) == L"Z")
              {
                  time_t timeInSecs = mktime(&m_TM);
                  localtime_r(&timeInSecs, &m_TMUTC);
              }
              /*if the timezone is represented using +/-hh:mm format*/
              else if(strZone.substr(0,1) == L"+" ||strZone.substr(0,1) == L"-")
              {
                  time_t timeInSecs = mktime(&m_TM);
                  localtime_r(&timeInSecs, &m_TMUTC);
                  //intHours = atoi(strZone.substr(1,2).c_str());
                  intHours = wcstol(strZone.substr(1,2).c_str(), &endptr, 10);
                  //intMins = atoi(strZone.substr(3,2).c_str());
                  intMins = wcstol(strZone.substr(3,2).c_str(), &endptr, 10);
                  intSecs = intHours * 60 * 60 + intMins * 60;
                  if(strZone.substr(0,1) == L"+")
                  {
                      timeInSecs += intSecs;
                      localtime_r(&timeInSecs, &m_TM);
                      time_t t = mktime(&m_TM);
                      t = abs(t - d);
                      gmtime_r(&t, &m_TMUTC);
  
                  }
                  else if(strZone.substr(0,1) == L"-")
                  {
                      timeInSecs - intSecs;
                      localtime_r(&timeInSecs, &m_TM);
                      time_t t = mktime(&m_TM);
                      t = abs(t - d);
                      gmtime_r(&t, &m_TMUTC);
                  }
              }
              /*if the zone is not represented in the date*/
              else
              {
                  /*else it is assumed that the sent time is localtime*/
                  time_t timeInSecs = mktime(&m_TM);
                  gmtime_r(&timeInSecs, &m_TMUTC);
              }
  
              break;
              
          case XSD_TIME:
              /*dismantle m_sValue to get tm value;
                  XSD_TIME format is
                  hh:mm:ss.ss...Z OR
                  hh:mm:ss.ss...+/-<UTC TIME DIFFERENCE>
              */ 
              strHours = m_sValue.substr(0,2);
              strMins = m_sValue.substr(3,2);
              /*Decimal fraction of the second is omitted*/
              strSecs = m_sValue.substr(6,2);
              strZone = m_sValue.substr(8,m_sValue.length() - 8);
  
              //m_TM.tm_hour = atoi(strHours.c_str());
              m_TM.tm_hour = wcstol(strHours.c_str(), &endptr, 10);
              //m_TM.tm_min = atoi(strMins.c_str());
              m_TM.tm_min = wcstol(strMins.c_str(), &endptr, 10);
              //m_TM.tm_sec = atoi(strSecs.c_str());
              m_TM.tm_sec = wcstol(strSecs.c_str(), &endptr, 10);
  
              /*if the timezone is represented adding 'Z' at the end*/
              if(strZone.substr(0,1) == L"Z")
              {
                  time_t timeInSecs = mktime(&m_TM);
                  localtime_r(&timeInSecs, &m_TMUTC);
              }
              /*if the timezone is represented using +/-hh:mm format*/
              else if(strZone.substr(0,1) == L"+" ||strZone.substr(0,1) == L"-")
              {
                  time_t timeInSecs = mktime(&m_TM);
                  localtime_r(&timeInSecs, &m_TMUTC);
                  //intHours = atoi(strZone.substr(1,2).c_str());
                  intHours = wcstol(strZone.substr(1,2).c_str(), &endptr, 10);
                  //intMins = atoi(strZone.substr(3,2).c_str());
                  intMins = wcstol(strZone.substr(3,2).c_str(), &endptr, 10);
                  intSecs = intHours * 60 * 60 + intMins * 60;
                  if(strZone.substr(0,1) == L"+")
                  {
                      timeInSecs += intSecs;
                      localtime_r(&timeInSecs, &m_TM);
                      time_t t = mktime(&m_TM);
                      t = abs(t - d);
                      gmtime_r(&t, &m_TMUTC);
  
                  }
                  else if(strZone.substr(0,1) == L"-")
                  {
                      timeInSecs - intSecs;
                      localtime_r(&timeInSecs, &m_TM);
                      time_t t = mktime(&m_TM);
                      t = abs(t - d);
                      gmtime_r(&t, &m_TMUTC);
                  }
              }
              /*if the zone is not represented in the date*/
              else
              {
                  /*else it is assumed that the sent time is localtime*/
                  time_t timeInSecs = mktime(&m_TM);
                  gmtime_r(&timeInSecs, &m_TMUTC);
              }
  
              break;
      }    
  }
  
  
  long AxisTime::getDuration()
  {
      return m_Duration;  
  }
  
  struct tm AxisTime::getDateTime()
  {
      return m_TMUTC;
  }
  
  struct tm AxisTime::getDate()
  {
      return m_TMUTC;
  }
  
  struct tm AxisTime::getTime()
  {
      return m_TMUTC;
  }
  
  
  1.1                  xml-axis/c/src/common/AxisTime.h
  
  Index: AxisTime.h
  ===================================================================
  #ifndef __AXISTIME_H_INCLUDED_
  #define __AXISTIME_H_INCLUDED_
  
  #include <time.h>
  #include <string>
  #include "TypeMapping.h"
  #include "IParam.h"
  
  using namespace std;
  
  typedef union uDuration
  {
      int years;
      int months;
      int days;
      int hours;
      int mins;
      double secs;
  } uDuration;
  
  class AxisTime
  {
      public:
          AxisTime();
          AxisTime(time_t ptrTime_t);
          AxisTime(struct tm ntime);
          virtual ~AxisTime();
          void setValue(const AxisChar* strValue);
          void setValue(XSDTYPE type, uParamValue Value);
          void setType(XSDTYPE m_Type);
          AxisString getValue();
          AxisString& serialize(const AxisString& sName, struct tm tValue);
          AxisString& serialize(const AxisString& sName, long lDuration);
          long getDuration();
          struct tm getDateTime();
          struct tm getDate();
          struct tm getTime();
          void mkCTime();
  
      private:
          void processValue();
          AxisString m_sValue;
          XSDTYPE m_Type;
          struct tm m_TM, m_TMUTC, m_TMDuration;
          time_t m_Time;
          char buf1[80];
          AxisString strYears;
          AxisString strMonths;
          AxisString strDays;
          AxisString strHours;
          AxisString strMins;
          AxisString strSecs;
          int intYears;
          int intMonths;
          int intDays;
          int intHours;
          int intMins;
          int intSecs;
          AxisString strZone;
          uDuration duration;
          long m_Duration;
          //string strXSDDuration;
          AxisString strXSDDuration;
          AxisString strXSDDate;
  };
  
  #endif
  
  

Mime
View raw message