You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/01/26 10:55:55 UTC
cvs commit: ws-axis/c/src/soap/xsd/constraints FractionDigits.cpp FractionDigits.hpp TotalDigits.cpp TotalDigits.hpp
dicka 2005/01/26 01:55:55
Modified: c/src/platforms/aix PlatformSpecificAIX.hpp
c/src/platforms/os400 PlatformSpecificOS400.hpp
c/src/platforms/unix PlatformSpecificUnix.hpp
c/src/platforms/windows PlatformSpecificWindows.hpp
c/src/soap Makefile.am
c/src/soap/xsd Decimal.cpp Decimal.hpp Integer.cpp
Integer.hpp NonNegativeInteger.cpp
NonPositiveInteger.cpp
c/vc AxisClientDLL.dsp AxisServerDLL.dsp
Added: c/src/soap/xsd/constraints FractionDigits.cpp
FractionDigits.hpp TotalDigits.cpp TotalDigits.hpp
Log:
Adding constraint validation/processing to XSD SOAP objects. Addition of TotalDigits and FractionDigits constraints.
Submitted by: Adrian Dick
Revision Changes Path
1.11 +1 -0 ws-axis/c/src/platforms/aix/PlatformSpecificAIX.hpp
Index: PlatformSpecificAIX.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/platforms/aix/PlatformSpecificAIX.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PlatformSpecificAIX.hpp 21 Jan 2005 17:17:27 -0000 1.10
+++ PlatformSpecificAIX.hpp 26 Jan 2005 09:55:54 -0000 1.11
@@ -103,6 +103,7 @@
* Format string to be used in printf for 64bit integers
*/
#define PRINTF_LONGLONG_FORMAT_SPECIFIER "%lld"
+#define PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS "lld"
#endif
1.13 +1 -0 ws-axis/c/src/platforms/os400/PlatformSpecificOS400.hpp
Index: PlatformSpecificOS400.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/platforms/os400/PlatformSpecificOS400.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PlatformSpecificOS400.hpp 21 Jan 2005 17:17:40 -0000 1.12
+++ PlatformSpecificOS400.hpp 26 Jan 2005 09:55:54 -0000 1.13
@@ -94,6 +94,7 @@
* Format string to be used in printf for 64bit integers
*/
#define PRINTF_LONGLONG_FORMAT_SPECIFIER "%lld"
+#define PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS "lld"
#endif
1.15 +1 -0 ws-axis/c/src/platforms/unix/PlatformSpecificUnix.hpp
Index: PlatformSpecificUnix.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/platforms/unix/PlatformSpecificUnix.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- PlatformSpecificUnix.hpp 21 Jan 2005 17:17:55 -0000 1.14
+++ PlatformSpecificUnix.hpp 26 Jan 2005 09:55:54 -0000 1.15
@@ -101,6 +101,7 @@
* Format string to be used in printf for 64bit integers
*/
#define PRINTF_LONGLONG_FORMAT_SPECIFIER "%lld"
+#define PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS "lld"
#endif
1.14 +1 -0 ws-axis/c/src/platforms/windows/PlatformSpecificWindows.hpp
Index: PlatformSpecificWindows.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/platforms/windows/PlatformSpecificWindows.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PlatformSpecificWindows.hpp 21 Jan 2005 17:18:10 -0000 1.13
+++ PlatformSpecificWindows.hpp 26 Jan 2005 09:55:54 -0000 1.14
@@ -95,6 +95,7 @@
* Format string to be used in printf for 64bit integers
*/
#define PRINTF_LONGLONG_FORMAT_SPECIFIER "%I64d"
+#define PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS "I64d"
std::string* getPlatformErrorMessage(long errorNumber);
1.35 +3 -1 ws-axis/c/src/soap/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/Makefile.am,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- Makefile.am 25 Jan 2005 18:08:29 -0000 1.34
+++ Makefile.am 26 Jan 2005 09:55:54 -0000 1.35
@@ -75,7 +75,9 @@
xsd/constraints/MinInclusive.cpp \
xsd/constraints/MinExclusive.cpp \
xsd/constraints/MaxInclusive.cpp \
- xsd/constraints/MaxExclusive.cpp
+ xsd/constraints/MaxExclusive.cpp \
+ xsd/constraints/TotalDigits.cpp \
+ xsd/constraints/FractionDigits.cpp
libsoap_la_LIBADD = $(LDFLAGS)
INCLUDES = -I../../include
1.10 +40 -2 ws-axis/c/src/soap/xsd/Decimal.cpp
Index: Decimal.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Decimal.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Decimal.cpp 25 Jan 2005 11:26:38 -0000 1.9
+++ Decimal.cpp 26 Jan 2005 09:55:54 -0000 1.10
@@ -118,8 +118,36 @@
delete maxExclusive;
- AxisChar* serializedValue = new char[80];
- AxisSprintf (serializedValue, 80, "%f", *value);
+ AxisString formatSpecifier = "%";
+
+ int valueSize = 80;
+ TotalDigits* totalDigits = getTotalDigits();
+ if (totalDigits->isSet())
+ {
+ valueSize = totalDigits->getTotalDigits() + 1;
+ AxisChar* digits = new char[10];
+ AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
+ formatSpecifier += digits;
+ delete [] digits;
+ }
+ delete totalDigits;
+
+ FractionDigits* fractionDigits = getFractionDigits();
+ if (fractionDigits->isSet())
+ {
+ formatSpecifier += ".";
+ AxisChar* digits = new char[10];
+ AxisSprintf (digits, 10, "%i", fractionDigits->getFractionDigits());
+ formatSpecifier += digits;
+ delete [] digits;
+ }
+ delete fractionDigits;
+
+ formatSpecifier += "f";
+
+ AxisChar* serializedValue = new char[valueSize];
+ AxisSprintf (serializedValue, valueSize, formatSpecifier.c_str(), *value);
+
IAnySimpleType::serialize(serializedValue);
delete [] serializedValue;
@@ -166,4 +194,14 @@
return new MaxExclusive();
}
+TotalDigits* Decimal::getTotalDigits()
+{
+ return new TotalDigits();
+}
+
+FractionDigits* Decimal::getFractionDigits()
+{
+ return new FractionDigits();
+}
+
AXIS_CPP_NAMESPACE_END
1.8 +16 -0 ws-axis/c/src/soap/xsd/Decimal.hpp
Index: Decimal.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Decimal.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Decimal.hpp 24 Jan 2005 17:21:26 -0000 1.7
+++ Decimal.hpp 26 Jan 2005 09:55:54 -0000 1.8
@@ -27,6 +27,8 @@
#include "constraints/MinExclusive.hpp"
#include "constraints/MaxInclusive.hpp"
#include "constraints/MaxExclusive.hpp"
+#include "constraints/TotalDigits.hpp"
+#include "constraints/FractionDigits.hpp"
AXIS_CPP_NAMESPACE_START
@@ -109,6 +111,20 @@
*/
WhiteSpace* getWhiteSpace();
+ /**
+ * Creates a TotalDigits object. For the Decimal type this is undefined,
+ * so an unset TotalDigits object is created.
+ * @return TotalDigits object
+ */
+ TotalDigits* getTotalDigits();
+
+ /**
+ * Creates a FractionDigits object. For the Decimal type this is undefined,
+ * so an unset FractionDigits object is created.
+ * @return FractionDigits object
+ */
+ FractionDigits* getFractionDigits();
+
private:
double* m_Decimal;
};
1.7 +24 -3 ws-axis/c/src/soap/xsd/Integer.cpp
Index: Integer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Integer.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Integer.cpp 25 Jan 2005 11:26:38 -0000 1.6
+++ Integer.cpp 26 Jan 2005 09:55:54 -0000 1.7
@@ -112,10 +112,26 @@
}
}
delete maxExclusive;
+
+ AxisString formatSpecifier = "%";
+
+ int valueSize = 80;
+ TotalDigits* totalDigits = getTotalDigits();
+ if (totalDigits->isSet())
+ {
+ valueSize = totalDigits->getTotalDigits() + 1;
+ AxisChar* digits = new char[10];
+ AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
+ formatSpecifier += digits;
+ delete [] digits;
+ }
+ delete totalDigits;
+
+ formatSpecifier += PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS;
+
+ AxisChar* serializedValue = new char[valueSize];
+ AxisSprintf (serializedValue, valueSize, formatSpecifier.c_str(), *value);
- AxisChar* serializedValue = new char[80];
- AxisSprintf (serializedValue, 80, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
-
IAnySimpleType::serialize(serializedValue);
delete [] serializedValue;
return m_Buf;
@@ -136,4 +152,9 @@
return m_Integer;
}
+FractionDigits* Integer::getFractionDigits()
+{
+ return new FractionDigits(0);
+}
+
AXIS_CPP_NAMESPACE_END
1.5 +8 -1 ws-axis/c/src/soap/xsd/Integer.hpp
Index: Integer.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Integer.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Integer.hpp 24 Jan 2005 15:41:24 -0000 1.4
+++ Integer.hpp 26 Jan 2005 09:55:54 -0000 1.5
@@ -23,7 +23,6 @@
#define _INTEGER_HPP____OF_AXIS_INCLUDED_
#include "Decimal.hpp"
-#include "constraints/MinInclusive.hpp"
#include "../../platforms/PlatformAutoSense.hpp"
AXIS_CPP_NAMESPACE_START
@@ -71,6 +70,14 @@
*/
LONGLONG* deserializeInteger(const AxisChar* valueAsChar) throw (AxisSoapException);
+protected:
+
+ /**
+ * Creates a FractionDigits object. For the Integer type this is defined as 0.
+ * @return FractionDigits object
+ */
+ FractionDigits* getFractionDigits();
+
private:
LONGLONG* m_Integer;
};
1.7 +18 -2 ws-axis/c/src/soap/xsd/NonNegativeInteger.cpp
Index: NonNegativeInteger.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NonNegativeInteger.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NonNegativeInteger.cpp 25 Jan 2005 14:25:24 -0000 1.6
+++ NonNegativeInteger.cpp 26 Jan 2005 09:55:54 -0000 1.7
@@ -112,9 +112,25 @@
}
}
delete maxExclusive;
+
+ AxisString formatSpecifier = "%";
- AxisChar* serializedValue = new char[80];
- AxisSprintf (serializedValue, 80, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
+ int valueSize = 80;
+ TotalDigits* totalDigits = getTotalDigits();
+ if (totalDigits->isSet())
+ {
+ valueSize = totalDigits->getTotalDigits() + 1;
+ AxisChar* digits = new char[10];
+ AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
+ formatSpecifier += digits;
+ delete [] digits;
+ }
+ delete totalDigits;
+
+ formatSpecifier += PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS;
+
+ AxisChar* serializedValue = new char[valueSize];
+ AxisSprintf (serializedValue, valueSize, formatSpecifier.c_str(), *value);
IAnySimpleType::serialize(serializedValue);
delete [] serializedValue;
1.2 +17 -2 ws-axis/c/src/soap/xsd/NonPositiveInteger.cpp
Index: NonPositiveInteger.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NonPositiveInteger.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NonPositiveInteger.cpp 25 Jan 2005 16:18:15 -0000 1.1
+++ NonPositiveInteger.cpp 26 Jan 2005 09:55:54 -0000 1.2
@@ -112,10 +112,25 @@
}
}
delete maxExclusive;
+
+ AxisString formatSpecifier = "%";
+
+ int valueSize = 80;
+ TotalDigits* totalDigits = getTotalDigits();
+ if (totalDigits->isSet())
+ {
+ valueSize = totalDigits->getTotalDigits() + 1;
+ AxisChar* digits = new char[10];
+ AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
+ formatSpecifier += digits;
+ delete [] digits;
+ }
+ delete totalDigits;
+ formatSpecifier += PRINTF_LONGLONG_FORMAT_SPECIFIER_CHARS;
- AxisChar* serializedValue = new char[80];
- AxisSprintf (serializedValue, 80, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
+ AxisChar* serializedValue = new char[valueSize];
+ AxisSprintf (serializedValue, valueSize, formatSpecifier.c_str(), *value);
if(*value != 0)
{
1.45 +8 -0 ws-axis/c/vc/AxisClientDLL.dsp
Index: AxisClientDLL.dsp
===================================================================
RCS file: /home/cvs/ws-axis/c/vc/AxisClientDLL.dsp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- AxisClientDLL.dsp 25 Jan 2005 18:08:29 -0000 1.44
+++ AxisClientDLL.dsp 26 Jan 2005 09:55:55 -0000 1.45
@@ -254,6 +254,10 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\constraints\FractionDigits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\soap\xsd\GDay.cpp
# End Source File
# Begin Source File
@@ -518,6 +522,10 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\constraints\TotalDigits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\common\TypeMapping.cpp
# End Source File
# Begin Source File
1.44 +8 -0 ws-axis/c/vc/AxisServerDLL.dsp
Index: AxisServerDLL.dsp
===================================================================
RCS file: /home/cvs/ws-axis/c/vc/AxisServerDLL.dsp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- AxisServerDLL.dsp 25 Jan 2005 18:08:30 -0000 1.43
+++ AxisServerDLL.dsp 26 Jan 2005 09:55:55 -0000 1.44
@@ -250,6 +250,10 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\constraints\FractionDigits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\soap\xsd\GDay.cpp
# End Source File
# Begin Source File
@@ -514,6 +518,10 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\constraints\TotalDigits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\common\TypeMapping.cpp
# End Source File
# Begin Source File
1.1 ws-axis/c/src/soap/xsd/constraints/FractionDigits.cpp
Index: FractionDigits.cpp
===================================================================
#include "FractionDigits.hpp"
AXIS_CPP_NAMESPACE_START
FractionDigits::FractionDigits():m_FractionDigits(0)
{
m_isSet = false;
}
FractionDigits::FractionDigits(int fractionDigits)
{
m_FractionDigits = fractionDigits;
m_isSet = true;
}
int FractionDigits::getFractionDigits()
{
return m_FractionDigits;
}
AXIS_CPP_NAMESPACE_END
1.1 ws-axis/c/src/soap/xsd/constraints/FractionDigits.hpp
Index: FractionDigits.hpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file FractionDigits.hpp
*/
#if !defined(_FRACTIONDIGITS_HPP____OF_AXIS_INCLUDED_)
#define _FRACTIONDIGITS_HPP____OF_AXIS_INCLUDED_
#include "IConstrainingFacet.hpp"
AXIS_CPP_NAMESPACE_START
/**
* @class FractionDigits
*
* @author Adrian Dick (adrian.dick@uk.ibm.com)
*
*/
class FractionDigits : public IConstrainingFacet {
public:
FractionDigits();
FractionDigits(int fractionDigits);
int getFractionDigits();
private:
int m_FractionDigits;
};
AXIS_CPP_NAMESPACE_END
#endif
1.1 ws-axis/c/src/soap/xsd/constraints/TotalDigits.cpp
Index: TotalDigits.cpp
===================================================================
#include "TotalDigits.hpp"
AXIS_CPP_NAMESPACE_START
TotalDigits::TotalDigits():m_TotalDigits(0)
{
m_isSet = false;
}
TotalDigits::TotalDigits(int totalDigits)
{
m_TotalDigits = totalDigits;
m_isSet = true;
}
int TotalDigits::getTotalDigits()
{
return m_TotalDigits;
}
AXIS_CPP_NAMESPACE_END
1.1 ws-axis/c/src/soap/xsd/constraints/TotalDigits.hpp
Index: TotalDigits.hpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file TotalDigits.hpp
*/
#if !defined(_TOTALDIGITS_HPP____OF_AXIS_INCLUDED_)
#define _TOTALDIGITS_HPP____OF_AXIS_INCLUDED_
#include "IConstrainingFacet.hpp"
AXIS_CPP_NAMESPACE_START
/**
* @class TotalDigits
*
* @author Adrian Dick (adrian.dick@uk.ibm.com)
*
*/
class TotalDigits : public IConstrainingFacet {
public:
TotalDigits();
TotalDigits(int totalDigits);
int getTotalDigits();
private:
int m_TotalDigits;
};
AXIS_CPP_NAMESPACE_END
#endif