You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/11/22 11:11:42 UTC
svn commit: r478106 [2/3] - /webservices/axis/trunk/c/src/soap/xsd/
Modified: webservices/axis/trunk/c/src/soap/xsd/Duration.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Duration.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Duration.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Duration.cpp Wed Nov 22 02:11:36 2006
@@ -17,269 +17,261 @@
AXIS_CPP_NAMESPACE_START
- Duration::Duration()
- {
- }
+Duration::Duration()
+{
+}
- Duration::Duration(const xsd__duration* value)
+Duration::Duration(const xsd__duration* value)
+{
+ if (value)
{
- if (value)
- {
- setNil(false);
- serialize(value);
- }
+ setNil(false);
+ serialize(value);
}
+}
- XSDTYPE Duration::getType()
- {
- return XSD_DURATION;
- }
+XSDTYPE Duration::getType()
+{
+ return XSD_DURATION;
+}
- xsd__duration* Duration::getDuration()
+xsd__duration* Duration::getDuration()
+{
+ if (isNil())
{
- if (isNil())
- {
- return NULL;
- }
- else
- {
- return deserializeDuration(m_Buf);
- }
+ return NULL;
}
-
- void * Duration::getValue()
+ else
{
- return (void*) getDuration();
+ return deserializeDuration(m_Buf);
}
+}
- AxisChar* Duration::serialize(const xsd__duration* value) throw (AxisSoapException)
- {
-
- MinInclusive* minInclusive = getMinInclusive();
- if (minInclusive->isSet())
+void * Duration::getValue()
+{
+ return (void*) getDuration();
+}
+
+AxisChar* Duration::serialize(const xsd__duration* value) throw (AxisSoapException)
+{
+
+ MinInclusive* minInclusive = getMinInclusive();
+ if (minInclusive->isSet())
+ if ( *value < minInclusive->getMinInclusiveAsLONGLONG() )
{
- if ( *value < minInclusive->getMinInclusiveAsLONGLONG() )
- {
- AxisString exceptionMessage =
- "Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
- AxisChar* length = new AxisChar[25];
- sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, minInclusive->getMinInclusiveAsLONGLONG());
- exceptionMessage += length;
- exceptionMessage += ", Value = ";
- sprintf(length, "%ld", *value);
- exceptionMessage += length;
- exceptionMessage += ".";
- delete [] length;
-
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
+ AxisString exceptionMessage =
+ "Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
+ AxisChar length[100];
+ sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, minInclusive->getMinInclusiveAsLONGLONG());
+ exceptionMessage += length;
+ exceptionMessage += ", Value = ";
+ sprintf(length, "%ld", *value);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ delete minInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- delete minInclusive;
-
- MinExclusive* minExclusive = getMinExclusive();
- if (minExclusive->isSet())
+ delete minInclusive;
+
+ MinExclusive* minExclusive = getMinExclusive();
+ if (minExclusive->isSet())
+ if ( *value <= minExclusive->getMinExclusiveAsLONGLONG() )
{
- if ( *value <= minExclusive->getMinExclusiveAsLONGLONG() )
- {
- AxisString exceptionMessage =
- "Value to be serialized is less than or equal to MinExclusive specified for this type. MinExclusive = ";
- AxisChar* length = new AxisChar[25];
- sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, minExclusive->getMinExclusiveAsLONGLONG());
- exceptionMessage += length;
- exceptionMessage += ", Value = ";
- sprintf(length, "%ld", *value);
- exceptionMessage += length;
- exceptionMessage += ".";
- delete [] length;
-
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
+ AxisString exceptionMessage =
+ "Value to be serialized is less than or equal to MinExclusive specified for this type. MinExclusive = ";
+ AxisChar length[100];
+ sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, minExclusive->getMinExclusiveAsLONGLONG());
+ exceptionMessage += length;
+ exceptionMessage += ", Value = ";
+ sprintf(length, "%ld", *value);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ delete minExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- delete minExclusive;
+ delete minExclusive;
- MaxInclusive* maxInclusive = getMaxInclusive();
- if (maxInclusive->isSet())
+ MaxInclusive* maxInclusive = getMaxInclusive();
+ if (maxInclusive->isSet())
+ if ( *value > maxInclusive->getMaxInclusiveAsLONGLONG() )
{
- if ( *value > maxInclusive->getMaxInclusiveAsLONGLONG() )
- {
- AxisString exceptionMessage =
- "Value to be serialized is greater than MaxInclusive specified for this type. MaxInclusive = ";
- AxisChar* length = new AxisChar[25];
- sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxInclusive->getMaxInclusiveAsLONGLONG());
- exceptionMessage += length;
- exceptionMessage += ", Value = ";
- sprintf(length, "%ld", *value);
- exceptionMessage += length;
- exceptionMessage += ".";
- delete [] length;
-
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
+ AxisString exceptionMessage =
+ "Value to be serialized is greater than MaxInclusive specified for this type. MaxInclusive = ";
+ AxisChar length[100];
+ sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxInclusive->getMaxInclusiveAsLONGLONG());
+ exceptionMessage += length;
+ exceptionMessage += ", Value = ";
+ sprintf(length, "%ld", *value);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ delete maxInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- delete maxInclusive;
-
- MaxExclusive* maxExclusive = getMaxExclusive();
- if (maxExclusive->isSet())
+ delete maxInclusive;
+
+ MaxExclusive* maxExclusive = getMaxExclusive();
+ if (maxExclusive->isSet())
+ if ( *value >= maxExclusive->getMaxExclusiveAsLONGLONG() )
{
- if ( *value >= maxExclusive->getMaxExclusiveAsLONGLONG() )
- {
- AxisString exceptionMessage =
- "Value to be serialized is greater than or equal to MaxExclusive specified for this type. MaxExclusive = ";
- AxisChar* length = new AxisChar[25];
- sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxExclusive->getMaxExclusiveAsLONGLONG());
- exceptionMessage += length;
- exceptionMessage += ", Value = ";
- sprintf(length, "%ld", *value);
- exceptionMessage += length;
- exceptionMessage += ".";
- delete [] length;
-
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
+ AxisString exceptionMessage =
+ "Value to be serialized is greater than or equal to MaxExclusive specified for this type. MaxExclusive = ";
+ AxisChar length[100];
+ sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxExclusive->getMaxExclusiveAsLONGLONG());
+ exceptionMessage += length;
+ exceptionMessage += ", Value = ";
+ sprintf(length, "%ld", *value);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ delete maxExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- delete maxExclusive;
-
- long valueToSerialize = *value;
- AxisChar buff[4];
- AxisString serializedValue;
- /*
- * Duration takes the form:
- * PnYnMnDTnHnMnS
- */
- serializedValue = "P";
-
- // Calculate years
- int x = 365 * 24 * 3600;
- int intYears = valueToSerialize / x;
- long tempYears = intYears * x;
- AxisSprintf (buff, 4, "%d", intYears);
- serializedValue.append (buff);
- serializedValue.append ("Y");
-
-
- // Calculate Months
- valueToSerialize = valueToSerialize - (tempYears);
- x = 30 * 24 * 3600;
- int intMonths = valueToSerialize / x;
- AxisSprintf (buff, 4, "%d", intMonths);
- serializedValue.append (buff);
- serializedValue.append ("M");
-
- // Calculate Days
- valueToSerialize = valueToSerialize - (intMonths * x);
- x = 24 * 3600;
- int intDays = valueToSerialize / x;
- AxisSprintf (buff, 4, "%d", intDays);
- serializedValue.append (buff);
- serializedValue.append ("DT");
-
- // Calculate Hours
- valueToSerialize = valueToSerialize - (intDays * x);
- x = 3600;
- int intHours = valueToSerialize / x;
- AxisSprintf (buff, 4, "%d", intHours);
- serializedValue.append (buff);
- serializedValue.append ("H");
-
- // Calculate Minutes
- valueToSerialize = valueToSerialize - (intHours * x);
- x = 60;
- int intMins = valueToSerialize / x;
- AxisSprintf (buff, 4, "%d", intMins);
- serializedValue.append (buff);
- serializedValue.append ("M");
-
- // Calculate Seconds
- int intSecs = valueToSerialize - (intMins * x);
- AxisSprintf (buff, 4, "%d", intSecs);
- serializedValue.append (buff);
- serializedValue.append ("S");
-
- // Convert from String to Char[]
- AxisChar* returnValue = (AxisChar*) serializedValue.c_str ();
-
- IAnySimpleType::serialize(returnValue);
- return m_Buf;
- }
-
- xsd__duration* Duration::deserializeDuration(const AxisChar* valueAsChar) throw (AxisSoapException)
- {
- AxisString valueAsString = valueAsChar;
- AxisString buff;
- unsigned int intPos1, intPos2, intPos3, intPos4, intPos5, intPos6;
-
- xsd__duration* value = new xsd__duration;
-
- /*XSD_DURATION is of the format PnYnMnDTnHnMnS */
-
- // Deserialize Years
- *value = 0;
- intPos1 = valueAsString.find_first_of ("Y");
- buff = valueAsString.substr (1, intPos1 - 1);
- int years = atoi (buff.c_str ());
- *value += years * 365 * 24 * 3600;
-
- // Deserialize Months
- intPos2 = valueAsString.find_first_of ("M");
- buff = valueAsString.substr (intPos1 + 1, intPos2 - intPos1 - 1);
- int months = atoi (buff.c_str ());
- *value += months * 30 * 24 * 3600;
-
- // Deserialize Days
- intPos3 = valueAsString.find_first_of ("D");
- buff = valueAsString.substr (intPos2 + 1, intPos3 - intPos2 - 1);
- int days = atoi (buff.c_str ());
- *value += days * 24 * 3600;
-
- // Deserialize Hours
- intPos4 = valueAsString.find_first_of ("H");
- buff = valueAsString.substr (intPos3 + 2, intPos4 - intPos3 - 2);
- int hours = atoi (buff.c_str ());
- *value += hours * 3600;
-
- // Deserialize Minutes
- intPos5 = valueAsString.find_last_of ("M");
- buff = valueAsString.substr (intPos4 + 1, intPos5 - intPos4 - 1);
- int mins = atoi (buff.c_str ());
- *value += mins * 60;
-
- // Deserialize Seconds
- intPos6 = valueAsString.find_first_of ("S");
- buff = valueAsString.substr (intPos5 + 1, intPos6 - intPos5 - 1);
- int secs = atoi (buff.c_str ());
- *value += secs;
-
- return value;
- }
-
- WhiteSpace* Duration::getWhiteSpace()
- {
- return new WhiteSpace(COLLAPSE);
- }
-
- MinInclusive* Duration::getMinInclusive()
- {
- return new MinInclusive();
- }
-
- MinExclusive* Duration::getMinExclusive()
- {
- return new MinExclusive();
- }
-
- MaxInclusive* Duration::getMaxInclusive()
- {
- return new MaxInclusive();
- }
-
- MaxExclusive* Duration::getMaxExclusive()
- {
- return new MaxExclusive();
- }
+ delete maxExclusive;
+
+ long valueToSerialize = *value;
+ AxisChar buff[4];
+ AxisString serializedValue;
+ /*
+ * Duration takes the form:
+ * PnYnMnDTnHnMnS
+ */
+ serializedValue = "P";
+
+ // Calculate years
+ int x = 365 * 24 * 3600;
+ int intYears = valueToSerialize / x;
+ long tempYears = intYears * x;
+ AxisSprintf (buff, 4, "%d", intYears);
+ serializedValue.append (buff);
+ serializedValue.append ("Y");
+
+
+ // Calculate Months
+ valueToSerialize = valueToSerialize - (tempYears);
+ x = 30 * 24 * 3600;
+ int intMonths = valueToSerialize / x;
+ AxisSprintf (buff, 4, "%d", intMonths);
+ serializedValue.append (buff);
+ serializedValue.append ("M");
+
+ // Calculate Days
+ valueToSerialize = valueToSerialize - (intMonths * x);
+ x = 24 * 3600;
+ int intDays = valueToSerialize / x;
+ AxisSprintf (buff, 4, "%d", intDays);
+ serializedValue.append (buff);
+ serializedValue.append ("DT");
+
+ // Calculate Hours
+ valueToSerialize = valueToSerialize - (intDays * x);
+ x = 3600;
+ int intHours = valueToSerialize / x;
+ AxisSprintf (buff, 4, "%d", intHours);
+ serializedValue.append (buff);
+ serializedValue.append ("H");
+
+ // Calculate Minutes
+ valueToSerialize = valueToSerialize - (intHours * x);
+ x = 60;
+ int intMins = valueToSerialize / x;
+ AxisSprintf (buff, 4, "%d", intMins);
+ serializedValue.append (buff);
+ serializedValue.append ("M");
+
+ // Calculate Seconds
+ int intSecs = valueToSerialize - (intMins * x);
+ AxisSprintf (buff, 4, "%d", intSecs);
+ serializedValue.append (buff);
+ serializedValue.append ("S");
+
+ // Convert from String to Char[]
+ AxisChar* returnValue = (AxisChar*) serializedValue.c_str ();
+
+ IAnySimpleType::serialize(returnValue);
+ return m_Buf;
+}
+
+xsd__duration* Duration::deserializeDuration(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
+ AxisString valueAsString = valueAsChar;
+ AxisString buff;
+ unsigned int intPos1, intPos2, intPos3, intPos4, intPos5, intPos6;
+
+ xsd__duration* value = new xsd__duration;
+
+ /*XSD_DURATION is of the format PnYnMnDTnHnMnS */
+
+ // Deserialize Years
+ *value = 0;
+ intPos1 = valueAsString.find_first_of ("Y");
+ buff = valueAsString.substr (1, intPos1 - 1);
+ int years = atoi (buff.c_str ());
+ *value += years * 365 * 24 * 3600;
+
+ // Deserialize Months
+ intPos2 = valueAsString.find_first_of ("M");
+ buff = valueAsString.substr (intPos1 + 1, intPos2 - intPos1 - 1);
+ int months = atoi (buff.c_str ());
+ *value += months * 30 * 24 * 3600;
+
+ // Deserialize Days
+ intPos3 = valueAsString.find_first_of ("D");
+ buff = valueAsString.substr (intPos2 + 1, intPos3 - intPos2 - 1);
+ int days = atoi (buff.c_str ());
+ *value += days * 24 * 3600;
+
+ // Deserialize Hours
+ intPos4 = valueAsString.find_first_of ("H");
+ buff = valueAsString.substr (intPos3 + 2, intPos4 - intPos3 - 2);
+ int hours = atoi (buff.c_str ());
+ *value += hours * 3600;
+
+ // Deserialize Minutes
+ intPos5 = valueAsString.find_last_of ("M");
+ buff = valueAsString.substr (intPos4 + 1, intPos5 - intPos4 - 1);
+ int mins = atoi (buff.c_str ());
+ *value += mins * 60;
+
+ // Deserialize Seconds
+ intPos6 = valueAsString.find_first_of ("S");
+ buff = valueAsString.substr (intPos5 + 1, intPos6 - intPos5 - 1);
+ int secs = atoi (buff.c_str ());
+ *value += secs;
+
+ return value;
+}
+
+WhiteSpace* Duration::getWhiteSpace()
+{
+ return new WhiteSpace(COLLAPSE);
+}
+
+MinInclusive* Duration::getMinInclusive()
+{
+ return new MinInclusive();
+}
+
+MinExclusive* Duration::getMinExclusive()
+{
+ return new MinExclusive();
+}
+
+MaxInclusive* Duration::getMaxInclusive()
+{
+ return new MaxInclusive();
+}
+
+MaxExclusive* Duration::getMaxExclusive()
+{
+ return new MaxExclusive();
+}
AXIS_CPP_NAMESPACE_END
Modified: webservices/axis/trunk/c/src/soap/xsd/Float.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Float.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Float.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Float.cpp Wed Nov 22 02:11:36 2006
@@ -60,46 +60,42 @@
{
MinInclusive* minInclusive = getMinInclusive();
if (minInclusive->isSet())
- {
if ( *value < static_cast<float>(minInclusive->getMinInclusiveAsDouble()) )
{
AxisString exceptionMessage =
"Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[100];
sprintf(length, "%f", minInclusive->getMinInclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+ delete minInclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- }
delete minInclusive;
MinExclusive* minExclusive = getMinExclusive();
if (minExclusive->isSet())
- {
if ( *value <= static_cast<float>(minExclusive->getMinExclusiveAsDouble()) )
{
AxisString exceptionMessage =
"Value to be serialized is less than or equal to MinExclusive specified for this type. MinExclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[100];
sprintf(length, "%f", minExclusive->getMinExclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+ delete minExclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- }
delete minExclusive;
@@ -110,15 +106,15 @@
{
AxisString exceptionMessage =
"Value to be serialized is greater than MaxInclusive specified for this type. MaxInclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[100];
sprintf(length, "%f", maxInclusive->getMaxInclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+ delete maxInclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
}
@@ -127,31 +123,28 @@
MaxExclusive* maxExclusive = getMaxExclusive();
if (maxExclusive->isSet())
- {
if ( *value >= static_cast<float>(maxExclusive->getMaxExclusiveAsDouble()) )
{
AxisString exceptionMessage =
"Value to be serialized is greater than or equal to MaxExclusive specified for this type. MaxExclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[100];
sprintf(length, "%f", maxExclusive->getMaxExclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+ delete maxExclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- }
delete maxExclusive;
- AxisChar* serializedValue = new char[80];
+ AxisChar serializedValue[80];
AxisSprintf (serializedValue, 80, "%.6g", *value);
IAnySimpleType::serialize(serializedValue);
- delete [] serializedValue;
return m_Buf;
}
Modified: webservices/axis/trunk/c/src/soap/xsd/GDay.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/GDay.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/GDay.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/GDay.cpp Wed Nov 22 02:11:36 2006
@@ -17,183 +17,181 @@
AXIS_CPP_NAMESPACE_START
- GDay::GDay()
+GDay::GDay()
+{
+}
+
+GDay::GDay(const xsd__gDay* value)
+{
+ if (value)
{
+ setNil(false);
+ serialize(value);
}
+}
- GDay::GDay(const xsd__gDay* value)
+XSDTYPE GDay::getType()
+{
+ return XSD_GDAY;
+}
+
+xsd__gDay* GDay::getGDay()
+{
+ if (isNil())
{
- if (value)
- {
- setNil(false);
- serialize(value);
- }
+ return NULL;
}
-
- XSDTYPE GDay::getType()
+ else
{
- return XSD_GDAY;
+ return deserializeGDay(m_Buf);
}
+}
- xsd__gDay* GDay::getGDay()
+void * GDay::getValue()
+{
+ return (void*) getGDay();
+}
+
+AxisChar* GDay::serialize(const xsd__gDay* value) throw (AxisSoapException)
+{
+ MinInclusive* minInclusive = getMinInclusive();
+ if (minInclusive->isSet())
{
- if (isNil())
+ struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
+ if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- return NULL;
+ AxisString exceptionMessage =
+ "Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
+ exceptionMessage += asctime(&minInclusiveAsStructTM);
+ exceptionMessage += ", Value = ";
+ exceptionMessage += asctime(value);
+ exceptionMessage += ".";
+
+ delete minInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- else
+ }
+ delete minInclusive;
+
+ MinExclusive* minExclusive = getMinExclusive();
+ if (minExclusive->isSet())
+ {
+ struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
+ if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- return deserializeGDay(m_Buf);
+ 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 += ".";
+
+ delete minExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
}
+ delete minExclusive;
- void * GDay::getValue()
+ MaxInclusive* maxInclusive = getMaxInclusive();
+ if (maxInclusive->isSet())
{
- return (void*) getGDay();
+ 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 += ".";
+
+ delete maxInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
}
+ delete maxInclusive;
- AxisChar* GDay::serialize(const xsd__gDay* 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 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 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 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
- }
- delete maxExclusive;
-
- AxisString serializedValue = "";
- AxisChar* valueAsString = new AxisChar[80];
- strftime (valueAsString, 80, "---%d", value);
- serializedValue += valueAsString;
- delete [] valueAsString;
-
- // Calculate local timezone offset
- time_t now = time(NULL);
- struct tm *temp = gmtime(&now);
- struct tm utcTime;
- memcpy(&utcTime, temp, sizeof(struct tm));
- temp = localtime(&now);
- struct tm localTime;
- memcpy(&localTime, temp, sizeof(struct tm));
-
- long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
- + (utcTime.tm_yday * 60 * 24)
- + (utcTime.tm_hour * 60)
- + utcTime.tm_min;
-
- long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
- + (localTime.tm_yday * 60 * 24)
- + (localTime.tm_hour * 60)
- + localTime.tm_min;
-
- int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
-
- if (timeOffsetInMinutes == 0)
+ MaxExclusive* maxExclusive = getMaxExclusive();
+ if (maxExclusive->isSet())
+ {
+ struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
+ if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- serializedValue += "Z";
+ 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 += ".";
+
+ delete maxExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- else
+ }
+ delete maxExclusive;
+
+ AxisString serializedValue = "";
+ AxisChar valueAsString[80];
+ strftime (valueAsString, 80, "---%d", value);
+ serializedValue += valueAsString;
+
+ // Calculate local timezone offset
+ time_t now = time(NULL);
+ struct tm *temp = gmtime(&now);
+ struct tm utcTime;
+ memcpy(&utcTime, temp, sizeof(struct tm));
+ temp = localtime(&now);
+ struct tm localTime;
+ memcpy(&localTime, temp, sizeof(struct tm));
+
+ long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
+ + (utcTime.tm_yday * 60 * 24)
+ + (utcTime.tm_hour * 60)
+ + utcTime.tm_min;
+
+ long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
+ + (localTime.tm_yday * 60 * 24)
+ + (localTime.tm_hour * 60)
+ + localTime.tm_min;
+
+ int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
+
+ if (timeOffsetInMinutes == 0)
+ serializedValue += "Z";
+ else
+ {
+ struct tm timeOffset;
+ timeOffset.tm_year = 0;
+ timeOffset.tm_yday = 0;
+ timeOffset.tm_sec = 0;
+ timeOffset.tm_min = timeOffsetInMinutes % 60;
+ timeOffsetInMinutes -= timeOffset.tm_min;
+ timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
+
+ if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
{
- struct tm timeOffset;
- timeOffset.tm_year = 0;
- timeOffset.tm_yday = 0;
- timeOffset.tm_sec = 0;
- timeOffset.tm_min = timeOffsetInMinutes % 60;
- timeOffsetInMinutes -= timeOffset.tm_min;
- timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
-
- if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
- {
- serializedValue += "-";
- timeOffset.tm_hour *= -1;
- timeOffset.tm_min *= -1;
- }
- else
- {
- serializedValue += "+";
- }
-
- AxisChar * offSetString = new AxisChar[6];
- sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
+ serializedValue += "-";
+ timeOffset.tm_hour *= -1;
+ timeOffset.tm_min *= -1;
+ }
+ else
+ serializedValue += "+";
+
+ AxisChar offSetString[6];
+ sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
serializedValue += offSetString;
- delete [] offSetString;
}
IAnySimpleType::serialize(serializedValue.c_str());
return m_Buf;
}
- xsd__gDay* GDay::deserializeGDay(const AxisChar* valueAsChar) throw (AxisSoapException)
- {
+xsd__gDay* GDay::deserializeGDay(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
struct tm value;
struct tm *pTm;
AxisChar *cUtc;
@@ -201,32 +199,32 @@
AxisChar *cTemp2;
// Calculate local timezone offset
- time_t now = time(NULL);
- struct tm *temp = gmtime(&now);
- struct tm utcTime;
- memcpy(&utcTime, temp, sizeof(struct tm));
- temp = localtime(&now);
- struct tm localTime;
- memcpy(&localTime, temp, sizeof(struct tm));
-
- long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
- + (utcTime.tm_yday * 60 * 60 * 24)
- + (utcTime.tm_hour * 60 * 60)
- + (utcTime.tm_min * 60);
-
- long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
- + (localTime.tm_yday * 60 * 60 * 24)
- + (localTime.tm_hour * 60 * 60)
- + (localTime.tm_min * 60);
-
- time_t d = utcTimeInSeconds - localTimeInSeconds;
-
- /* 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_mday) != 1)
+ time_t now = time(NULL);
+ struct tm *temp = gmtime(&now);
+ struct tm utcTime;
+ memcpy(&utcTime, temp, sizeof(struct tm));
+ temp = localtime(&now);
+ struct tm localTime;
+ memcpy(&localTime, temp, sizeof(struct tm));
+
+ long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
+ + (utcTime.tm_yday * 60 * 60 * 24)
+ + (utcTime.tm_hour * 60 * 60)
+ + (utcTime.tm_min * 60);
+
+ long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
+ + (localTime.tm_yday * 60 * 60 * 24)
+ + (localTime.tm_hour * 60 * 60)
+ + (localTime.tm_min * 60);
+
+ time_t d = utcTimeInSeconds - localTimeInSeconds;
+
+ /* 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_mday) != 1)
{
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
}
@@ -243,77 +241,73 @@
#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)
+ /* 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)
{
- time_t timeInSecs = mktime (&value);
- if (timeInSecs == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- pTm = localtime (&timeInSecs);
- memcpy (&value, pTm, sizeof (tm));
- time_t t = mktime (&value);
- if (t == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- t = labs (t - d);
- pTm = localtime (&t);
- }
- 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
-
- int hours = 0;
- int mins = 0;
- if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
- {
- throw 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- t = labs (t - d);
- pTm = localtime (&t);
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ pTm = localtime (&timeInSecs);
+ memcpy (&value, pTm, sizeof (tm));
+ time_t t = mktime (&value);
+ if (t == -1)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ t = labs (t - d);
+ pTm = localtime (&t);
+ }
+ else if (cTemp2 != NULL)
+ {
+ cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
+ if (cUtc == NULL)
+ {
+ cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
}
- /*if the zone is not represented in the date */
+ time_t timeInSecs = mktime (&value);
+ if (timeInSecs == -1)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+
+ int hours = 0;
+ int mins = 0;
+ if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
+ {
+ throw 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ t = labs (t - d);
+ pTm = localtime (&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)
{
- /*else it is assumed that the sent time is localtime */
- time_t timeInSecs = mktime (&value);
- if (timeInSecs == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- pTm = localtime (&timeInSecs);
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
}
+ pTm = localtime (&timeInSecs);
+ }
- pTm->tm_year -= 70; // Take off the 70 offset we added initially
+ pTm->tm_year -= 70; // Take off the 70 offset we added initially
xsd__gDay * returnValue = new struct tm;
memcpy (returnValue, pTm, sizeof (tm));
Modified: webservices/axis/trunk/c/src/soap/xsd/GMonth.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/GMonth.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/GMonth.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/GMonth.cpp Wed Nov 22 02:11:36 2006
@@ -17,185 +17,187 @@
AXIS_CPP_NAMESPACE_START
- GMonth::GMonth()
+GMonth::GMonth()
+{
+}
+
+GMonth::GMonth(const xsd__gMonth* value)
+{
+ if (value)
{
+ setNil(false);
+ serialize(value);
}
+}
- GMonth::GMonth(const xsd__gMonth* value)
+XSDTYPE GMonth::getType()
+{
+ return XSD_GMONTH;
+}
+
+xsd__gMonth* GMonth::getGMonth()
+{
+ if (isNil())
{
- if (value)
- {
- setNil(false);
- serialize(value);
- }
+ return NULL;
}
-
- XSDTYPE GMonth::getType()
+ else
{
- return XSD_GMONTH;
+ return deserializeGMonth(m_Buf);
}
+}
- xsd__gMonth* GMonth::getGMonth()
+void * GMonth::getValue()
+{
+ return (void*) getGMonth();
+}
+
+AxisChar* GMonth::serialize(const xsd__gMonth* value) throw (AxisSoapException)
+{
+ MinInclusive* minInclusive = getMinInclusive();
+ if (minInclusive->isSet())
{
- if (isNil())
+ struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
+ if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- return NULL;
+ AxisString exceptionMessage =
+ "Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
+ exceptionMessage += asctime(&minInclusiveAsStructTM);
+ exceptionMessage += ", Value = ";
+ exceptionMessage += asctime(value);
+ exceptionMessage += ".";
+
+ delete minInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- else
+ }
+ delete minInclusive;
+
+ MinExclusive* minExclusive = getMinExclusive();
+ if (minExclusive->isSet())
+ {
+ struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
+ if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- return deserializeGMonth(m_Buf);
+ 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 += ".";
+
+ delete minExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
}
+ delete minExclusive;
- void * GMonth::getValue()
+ MaxInclusive* maxInclusive = getMaxInclusive();
+ if (maxInclusive->isSet())
{
- return (void*) getGMonth();
+ 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 += ".";
+
+ delete maxInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
}
+ delete maxInclusive;
- AxisChar* GMonth::serialize(const xsd__gMonth* 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 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 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 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
- }
- delete maxExclusive;
-
- AxisString serializedValue = "";
- AxisChar* valueAsString = new AxisChar[80];
- strftime (valueAsString, 80, "--%m--", value);
- serializedValue += valueAsString;
- delete [] valueAsString;
-
- // Calculate local timezone offset
- time_t now = time(NULL);
- struct tm *temp = gmtime(&now);
- struct tm utcTime;
- memcpy(&utcTime, temp, sizeof(struct tm));
- temp = localtime(&now);
- struct tm localTime;
- memcpy(&localTime, temp, sizeof(struct tm));
-
- long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
- + (utcTime.tm_yday * 60 * 24)
- + (utcTime.tm_hour * 60)
- + utcTime.tm_min;
-
- long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
- + (localTime.tm_yday * 60 * 24)
- + (localTime.tm_hour * 60)
- + localTime.tm_min;
+ 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 += ".";
+
+ delete maxExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxExclusive;
+
+ AxisString serializedValue = "";
+ AxisChar valueAsString[80];
+ strftime (valueAsString, 80, "--%m--", value);
+ serializedValue += valueAsString;
+
+ // Calculate local timezone offset
+ time_t now = time(NULL);
+ struct tm *temp = gmtime(&now);
+ struct tm utcTime;
+ memcpy(&utcTime, temp, sizeof(struct tm));
+ temp = localtime(&now);
+ struct tm localTime;
+ memcpy(&localTime, temp, sizeof(struct tm));
+
+ long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
+ + (utcTime.tm_yday * 60 * 24)
+ + (utcTime.tm_hour * 60)
+ + utcTime.tm_min;
+
+ long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
+ + (localTime.tm_yday * 60 * 24)
+ + (localTime.tm_hour * 60)
+ + localTime.tm_min;
- int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
+ int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
- if (timeOffsetInMinutes == 0)
+ if (timeOffsetInMinutes == 0)
+ {
+ serializedValue += "Z";
+ }
+ else
+ {
+ struct tm timeOffset;
+ timeOffset.tm_year = 0;
+ timeOffset.tm_yday = 0;
+ timeOffset.tm_sec = 0;
+ timeOffset.tm_min = timeOffsetInMinutes % 60;
+ timeOffsetInMinutes -= timeOffset.tm_min;
+ timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
+
+ if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
{
- serializedValue += "Z";
+ serializedValue += "-";
+ timeOffset.tm_hour *= -1;
+ timeOffset.tm_min *= -1;
}
else
{
- struct tm timeOffset;
- timeOffset.tm_year = 0;
- timeOffset.tm_yday = 0;
- timeOffset.tm_sec = 0;
- timeOffset.tm_min = timeOffsetInMinutes % 60;
- timeOffsetInMinutes -= timeOffset.tm_min;
- timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
-
- if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
- {
- serializedValue += "-";
- timeOffset.tm_hour *= -1;
- timeOffset.tm_min *= -1;
- }
- else
- {
- serializedValue += "+";
- }
-
- AxisChar * offSetString = new AxisChar[6];
- sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
- serializedValue += offSetString;
- delete [] offSetString;
+ serializedValue += "+";
}
+
+ AxisChar offSetString[6];
+ sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
+ serializedValue += offSetString;
+ }
IAnySimpleType::serialize(serializedValue.c_str());
return m_Buf;
- }
+}
- xsd__gMonth* GMonth::deserializeGMonth(const AxisChar* valueAsChar) throw (AxisSoapException)
- {
+xsd__gMonth* GMonth::deserializeGMonth(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
struct tm value;
struct tm *pTm;
AxisChar *cUtc;
@@ -203,32 +205,32 @@
AxisChar *cTemp2;
// Calculate local timezone offset
- time_t now = time(NULL);
- struct tm *temp = gmtime(&now);
- struct tm utcTime;
- memcpy(&utcTime, temp, sizeof(struct tm));
- temp = localtime(&now);
- struct tm localTime;
- memcpy(&localTime, temp, sizeof(struct tm));
-
- long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
- + (utcTime.tm_yday * 60 * 60 * 24)
- + (utcTime.tm_hour * 60 * 60)
- + (utcTime.tm_min * 60);
-
- long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
- + (localTime.tm_yday * 60 * 60 * 24)
- + (localTime.tm_hour * 60 * 60)
- + (localTime.tm_min * 60);
-
- time_t d = utcTimeInSeconds - localTimeInSeconds;
-
- /* dismantle m_sValue to get tm value;
- * XSD_DATETIME format is
- * CCYY(-)MMZ OR
- * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
- */
- if (sscanf (valueAsChar, "--%d--",
+ time_t now = time(NULL);
+ struct tm *temp = gmtime(&now);
+ struct tm utcTime;
+ memcpy(&utcTime, temp, sizeof(struct tm));
+ temp = localtime(&now);
+ struct tm localTime;
+ memcpy(&localTime, temp, sizeof(struct tm));
+
+ long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
+ + (utcTime.tm_yday * 60 * 60 * 24)
+ + (utcTime.tm_hour * 60 * 60)
+ + (utcTime.tm_min * 60);
+
+ long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
+ + (localTime.tm_yday * 60 * 60 * 24)
+ + (localTime.tm_hour * 60 * 60)
+ + (localTime.tm_min * 60);
+
+ time_t d = utcTimeInSeconds - localTimeInSeconds;
+
+ /* 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
@@ -247,77 +249,77 @@
#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)
+ /* 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)
{
- time_t timeInSecs = mktime (&value);
- if (timeInSecs == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- pTm = localtime (&timeInSecs);
- memcpy (&value, pTm, sizeof (tm));
- time_t t = mktime (&value);
- if (t == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- t = labs (t - d);
- pTm = localtime (&t);
- }
- 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
-
- int hours = 0;
- int mins = 0;
- if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
- {
- throw 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- t = labs (t - d);
- pTm = localtime (&t);
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ pTm = localtime (&timeInSecs);
+ memcpy (&value, pTm, sizeof (tm));
+ time_t t = mktime (&value);
+ if (t == -1)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ t = labs (t - d);
+ pTm = localtime (&t);
+ }
+ 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+
+ int hours = 0;
+ int mins = 0;
+ if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+
+ int secs = hours * 60 * 60 + mins * 60;
+ if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
+ {
+ timeInSecs -= secs;
}
- /*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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- pTm = localtime (&timeInSecs);
+ timeInSecs += secs;
}
- pTm->tm_year -= 70; // Take off the 70 offset we added initially
+ pTm = localtime (&timeInSecs);
+ memcpy (&value, pTm, sizeof (tm));
+ time_t t = mktime (&value);
+ if (t == -1)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ t = labs (t - d);
+ pTm = localtime (&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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ pTm = localtime (&timeInSecs);
+ }
+
+ pTm->tm_year -= 70; // Take off the 70 offset we added initially
xsd__gMonth * returnValue = new xsd__gMonth;
memcpy (returnValue, pTm, sizeof (tm));
Modified: webservices/axis/trunk/c/src/soap/xsd/GMonthDay.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/GMonthDay.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/GMonthDay.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/GMonthDay.cpp Wed Nov 22 02:11:36 2006
@@ -17,184 +17,186 @@
AXIS_CPP_NAMESPACE_START
- GMonthDay::GMonthDay()
+GMonthDay::GMonthDay()
+{
+}
+
+GMonthDay::GMonthDay(const xsd__gMonthDay* value)
+{
+ if (value)
{
+ setNil(false);
+ serialize(value);
}
+}
- GMonthDay::GMonthDay(const xsd__gMonthDay* value)
+XSDTYPE GMonthDay::getType()
+{
+ return XSD_GMONTHDAY;
+}
+
+xsd__gMonthDay* GMonthDay::getGMonthDay()
+{
+ if(isNil())
{
- if (value)
- {
- setNil(false);
- serialize(value);
- }
+ return NULL;
}
-
- XSDTYPE GMonthDay::getType()
+ else
{
- return XSD_GMONTHDAY;
+ return deserializeGMonthDay(m_Buf);
}
+}
- xsd__gMonthDay* GMonthDay::getGMonthDay()
+void * GMonthDay::getValue()
+{
+ return (void*) getGMonthDay();
+}
+
+AxisChar* GMonthDay::serialize(const xsd__gMonthDay* value) throw (AxisSoapException)
+{
+ MinInclusive* minInclusive = getMinInclusive();
+ if (minInclusive->isSet())
{
- if(isNil())
+ struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
+ if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- return NULL;
+ AxisString exceptionMessage =
+ "Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
+ exceptionMessage += asctime(&minInclusiveAsStructTM);
+ exceptionMessage += ", Value = ";
+ exceptionMessage += asctime(value);
+ exceptionMessage += ".";
+
+ delete minInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
- else
+ }
+ delete minInclusive;
+
+ MinExclusive* minExclusive = getMinExclusive();
+ if (minExclusive->isSet())
+ {
+ struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
+ if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
{
- return deserializeGMonthDay(m_Buf);
+ 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 += ".";
+
+ delete minExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
}
}
+ delete minExclusive;
- void * GMonthDay::getValue()
+ MaxInclusive* maxInclusive = getMaxInclusive();
+ if (maxInclusive->isSet())
{
- return (void*) getGMonthDay();
+ 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 += ".";
+
+ delete maxInclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
}
+ delete maxInclusive;
- AxisChar* GMonthDay::serialize(const xsd__gMonthDay* 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 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 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 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
- const_cast<AxisChar*>(exceptionMessage.c_str()));
- }
- }
- delete maxExclusive;
-
- AxisString serializedValue = "";
- AxisChar* valueAsString = new AxisChar[80];
- strftime (valueAsString, 80, "--%m-%d", value);
- serializedValue += valueAsString;
- delete [] valueAsString;
-
- // Calculate local timezone offset
- time_t now = time(NULL);
- struct tm *temp = gmtime(&now);
- struct tm utcTime;
- memcpy(&utcTime, temp, sizeof(struct tm));
- temp = localtime(&now);
- struct tm localTime;
- memcpy(&localTime, temp, sizeof(struct tm));
-
- long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
- + (utcTime.tm_yday * 60 * 24)
- + (utcTime.tm_hour * 60)
- + utcTime.tm_min;
-
- long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
- + (localTime.tm_yday * 60 * 24)
- + (localTime.tm_hour * 60)
- + localTime.tm_min;
+ 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 += ".";
+
+ delete maxExclusive;
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxExclusive;
+
+ AxisString serializedValue = "";
+ AxisChar valueAsString[80];
+ strftime (valueAsString, 80, "--%m-%d", value);
+ serializedValue += valueAsString;
+
+ // Calculate local timezone offset
+ time_t now = time(NULL);
+ struct tm *temp = gmtime(&now);
+ struct tm utcTime;
+ memcpy(&utcTime, temp, sizeof(struct tm));
+ temp = localtime(&now);
+ struct tm localTime;
+ memcpy(&localTime, temp, sizeof(struct tm));
+
+ long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
+ + (utcTime.tm_yday * 60 * 24)
+ + (utcTime.tm_hour * 60)
+ + utcTime.tm_min;
+
+ long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
+ + (localTime.tm_yday * 60 * 24)
+ + (localTime.tm_hour * 60)
+ + localTime.tm_min;
- int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
+ int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
- if (timeOffsetInMinutes == 0)
+ if (timeOffsetInMinutes == 0)
+ {
+ serializedValue += "Z";
+ }
+ else
+ {
+ struct tm timeOffset;
+ timeOffset.tm_year = 0;
+ timeOffset.tm_yday = 0;
+ timeOffset.tm_sec = 0;
+ timeOffset.tm_min = timeOffsetInMinutes % 60;
+ timeOffsetInMinutes -= timeOffset.tm_min;
+ timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
+
+ if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
{
- serializedValue += "Z";
+ serializedValue += "-";
+ timeOffset.tm_hour *= -1;
+ timeOffset.tm_min *= -1;
}
else
{
- struct tm timeOffset;
- timeOffset.tm_year = 0;
- timeOffset.tm_yday = 0;
- timeOffset.tm_sec = 0;
- timeOffset.tm_min = timeOffsetInMinutes % 60;
- timeOffsetInMinutes -= timeOffset.tm_min;
- timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
-
- if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
- {
- serializedValue += "-";
- timeOffset.tm_hour *= -1;
- timeOffset.tm_min *= -1;
- }
- else
- {
- serializedValue += "+";
- }
-
- AxisChar * offSetString = new AxisChar[6];
- sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
- serializedValue += offSetString;
- delete [] offSetString;
+ serializedValue += "+";
}
+
+ AxisChar offSetString[6];
+ sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
+ serializedValue += offSetString;
+ }
IAnySimpleType::serialize(serializedValue.c_str());
return m_Buf;
- }
+}
- xsd__gMonthDay* GMonthDay::deserializeGMonthDay(const AxisChar* valueAsChar) throw (AxisSoapException)
- {
+xsd__gMonthDay* GMonthDay::deserializeGMonthDay(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
struct tm value;
struct tm *pTm;
AxisChar *cUtc;
@@ -202,32 +204,32 @@
AxisChar *cTemp2;
// Calculate local timezone offset
- time_t now = time(NULL);
- struct tm *temp = gmtime(&now);
- struct tm utcTime;
- memcpy(&utcTime, temp, sizeof(struct tm));
- temp = localtime(&now);
- struct tm localTime;
- memcpy(&localTime, temp, sizeof(struct tm));
-
- long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
- + (utcTime.tm_yday * 60 * 60 * 24)
- + (utcTime.tm_hour * 60 * 60)
- + (utcTime.tm_min * 60);
-
- long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
- + (localTime.tm_yday * 60 * 60 * 24)
- + (localTime.tm_hour * 60 * 60)
- + (localTime.tm_min * 60);
-
- time_t d = utcTimeInSeconds - localTimeInSeconds;
-
- /* 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,
+ time_t now = time(NULL);
+ struct tm *temp = gmtime(&now);
+ struct tm utcTime;
+ memcpy(&utcTime, temp, sizeof(struct tm));
+ temp = localtime(&now);
+ struct tm localTime;
+ memcpy(&localTime, temp, sizeof(struct tm));
+
+ long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
+ + (utcTime.tm_yday * 60 * 60 * 24)
+ + (utcTime.tm_hour * 60 * 60)
+ + (utcTime.tm_min * 60);
+
+ long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
+ + (localTime.tm_yday * 60 * 60 * 24)
+ + (localTime.tm_hour * 60 * 60)
+ + (localTime.tm_min * 60);
+
+ time_t d = utcTimeInSeconds - localTimeInSeconds;
+
+ /* 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
@@ -245,77 +247,77 @@
#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)
+ /* 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)
{
- time_t timeInSecs = mktime (&value);
- if (timeInSecs == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- pTm = localtime (&timeInSecs);
- memcpy (&value, pTm, sizeof (tm));
- time_t t = mktime (&value);
- if (t == -1)
- {
- throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- t = labs (t - d);
- pTm = localtime (&t);
- }
- 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
-
- int hours = 0;
- int mins = 0;
- if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
- {
- throw 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- t = labs (t - d);
- pTm = localtime (&t);
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ pTm = localtime (&timeInSecs);
+ memcpy (&value, pTm, sizeof (tm));
+ time_t t = mktime (&value);
+ if (t == -1)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ t = labs (t - d);
+ pTm = localtime (&t);
+ }
+ 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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+
+ int hours = 0;
+ int mins = 0;
+ if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+
+ int secs = hours * 60 * 60 + mins * 60;
+ if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
+ {
+ timeInSecs -= secs;
}
- /*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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
- }
- pTm = localtime (&timeInSecs);
+ timeInSecs += secs;
}
+
+ pTm = localtime (&timeInSecs);
+ memcpy (&value, pTm, sizeof (tm));
+ time_t t = mktime (&value);
+ if (t == -1)
+ {
+ throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ t = labs (t - d);
+ pTm = localtime (&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 AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ }
+ pTm = localtime (&timeInSecs);
+ }
- pTm->tm_year -= 70; // Take off the 70 offset we added initially
+ pTm->tm_year -= 70; // Take off the 70 offset we added initially
xsd__gMonthDay * returnValue = new xsd__gMonthDay;
memcpy (returnValue, pTm, sizeof (tm));
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org