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 
00079 
00080 
00081 
00082 
00083 #ifndef XML_DOUBLE_HPP
00084 #define XML_DOUBLE_HPP
00085 
00086 #include <util/XercesDefs.hpp>
00087 #include <util/XMLNumber.hpp>
00088 #include <util/XMLBigDecimal.hpp>
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 class  XMLDouble : public XMLNumber
00106 {
00107 public:
00108 
00118 
00119     enum LiteralType
00120     {
00121         NegINF,
00122         NegZero,
00123         PosZero,
00124         PosINF,
00125         NaN,
00126         SpecialTypeNum = 5,
00127         Normal
00128     };
00129 
00130     XMLDouble(const XMLCh* const strValue);
00131 
00132     ~XMLDouble();
00133 
00134     XMLDouble(const XMLDouble& toCopy);
00135    
00136     virtual XMLCh*        toString() const;
00137 
00138     virtual int           getSign() const;
00139 
00150     bool operator==(const XMLDouble& toCompare) const;
00151 
00152     static int            compareValues(const XMLDouble* const lValue
00153                                       , const XMLDouble* const rValue);
00154 
00155     
00156     
00157     
00158     static void reinitXMLDouble();   
00159 
00160 private:
00161 
00162     void                  init(const XMLCh* const strValue);
00163 
00164     void                  checkBoundary(const XMLCh* const strValue);
00165 
00166     void                  cleanUp();
00167 
00168     bool                  isSpecialValue() const;
00169 
00170     static int            compareSpecial(const XMLDouble* const specialValue
00171                                        , const XMLDouble* const normalValue);
00172 
00173     static bool           isInitialized;
00174 
00175     
00176     
00177     
00178     
00179     
00180     
00181     
00182     
00183     
00184     
00185     
00186     
00187     
00188 
00189     XMLBigDecimal*          fMantissa;
00190     XMLBigInteger*          fExponent;   
00191     LiteralType             fType;
00192 };
00193 
00194 inline int XMLDouble::getSign() const
00195 {
00196     return fMantissa->getSign();
00197 }
00198 
00199 inline bool XMLDouble::operator==(const XMLDouble& toCompare) const
00200 {
00201     return ( XMLDouble::compareValues(this, &toCompare) == 0 ? true : false);
00202 }
00203 
00204 inline bool XMLDouble::isSpecialValue() const
00205 {
00206     return (fType < SpecialTypeNum);
00207 }
00208 
00209 inline void XMLDouble::cleanUp()
00210 {
00211     if (fMantissa)
00212         delete fMantissa;
00213 
00214     if (fExponent)
00215         delete fExponent;
00216 }
00217 
00218 inline XMLDouble::~XMLDouble()
00219 {
00220     cleanUp();
00221 }
00222 
00223 #endif