00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #ifndef XML_FLOAT_HPP
00079 #define XML_FLOAT_HPP
00080
00081 #include <util/XercesDefs.hpp>
00082 #include <util/XMLNumber.hpp>
00083 #include <util/XMLBigDecimal.hpp>
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 class XMLFloat : public XMLNumber
00101 {
00102 public:
00103
00113
00114 enum LiteralType
00115 {
00116 NegINF,
00117 NegZero,
00118 PosZero,
00119 PosINF,
00120 NaN,
00121 SpecialTypeNum = 5,
00122 Normal
00123 };
00124
00125 XMLFloat(const XMLCh* const strValue);
00126
00127 ~XMLFloat();
00128
00129 XMLFloat(const XMLFloat& toCopy);
00130
00131 virtual XMLCh* toString() const;
00132
00133 virtual int getSign() const;
00134
00145 bool operator==(const XMLFloat& toCompare) const;
00146
00147 static int compareValues(const XMLFloat* const lValue
00148 , const XMLFloat* const rValue);
00149
00150
00151
00152
00153 static void reinitXMLFloat();
00154
00155 private:
00156
00157 void init(const XMLCh* const strValue);
00158
00159 void checkBoundary(const XMLCh* const strValue);
00160
00161 void cleanUp();
00162
00163 bool isSpecialValue() const;
00164
00165 static int compareSpecial(const XMLFloat* const specialValue
00166 , const XMLFloat* const normalValue);
00167
00168 static bool isInitialized;
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 XMLBigDecimal* fMantissa;
00185 XMLBigInteger* fExponent;
00186 LiteralType fType;
00187 };
00188
00189 inline bool XMLFloat::operator==(const XMLFloat& toCompare) const
00190 {
00191 return ( XMLFloat::compareValues(this, &toCompare) == 0 ? true : false);
00192 }
00193
00194 inline bool XMLFloat::isSpecialValue() const
00195 {
00196 return (fType < SpecialTypeNum);
00197 }
00198
00199 inline void XMLFloat::cleanUp()
00200 {
00201 if (fMantissa)
00202 delete fMantissa;
00203
00204 if (fExponent)
00205 delete fExponent;
00206 }
00207
00208 inline int XMLFloat::getSign() const
00209 {
00210 return fMantissa->getSign();
00211 }
00212
00213 inline XMLFloat::~XMLFloat()
00214 {
00215 cleanUp();
00216 }
00217
00218 #endif