00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef XML_ABSTRACT_DOUBLE_FLOAT_HPP
00022 #define XML_ABSTRACT_DOUBLE_FLOAT_HPP
00023 
00024 #include <xercesc/util/XMLNumber.hpp>
00025 #include <xercesc/util/PlatformUtils.hpp>
00026 
00027 XERCES_CPP_NAMESPACE_BEGIN
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 class  XMLAbstractDoubleFloat : public XMLNumber
00060 {
00061 public:
00062 
00063     enum LiteralType
00064     {
00065         NegINF,
00066         PosINF,
00067         NaN,
00068         SpecialTypeNum,
00069         Normal
00070     };
00071 
00072     virtual ~XMLAbstractDoubleFloat();
00073 
00074     static XMLCh* getCanonicalRepresentation
00075                         (
00076                           const XMLCh*         const rawData
00077                         ,       MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager
00078                         );
00079 
00085     virtual XMLCh*        toString() const;
00086     
00087     virtual XMLCh*        getRawData() const;
00088 
00089     virtual const XMLCh*  getFormattedString() const;
00090 
00091     virtual int           getSign() const;
00092 
00093     MemoryManager*        getMemoryManager() const;
00094 
00095     inline  bool          isDataConverted()  const;
00096 
00097     inline  bool          isDataOverflowed()  const;
00098 
00099     inline  double        getValue() const;
00100 
00101     inline  LiteralType   getType() const;
00102 
00103     
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111     static void            normalizeDecimalPoint(char* const toNormal);
00112 
00113     
00114 
00115 
00116     DECL_XSERIALIZABLE(XMLAbstractDoubleFloat)
00117 
00118 protected:
00119 
00120     
00121     
00122     
00123     XMLAbstractDoubleFloat(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00124 
00125     void                  init(const XMLCh* const strValue);
00126 
00140     static int            compareValues(const XMLAbstractDoubleFloat* const lValue
00141                                       , const XMLAbstractDoubleFloat* const rValue
00142                                       , MemoryManager* const manager);
00143 
00144     
00145     
00146     
00147     virtual void          checkBoundary(char* const strValue) = 0;
00148 
00149     void
00150     convert(char* const strValue);
00151 
00152 private:
00153     
00154     
00155     
00156     
00157     
00158     
00159     XMLAbstractDoubleFloat(const XMLAbstractDoubleFloat& toCopy);
00160     XMLAbstractDoubleFloat& operator=(const XMLAbstractDoubleFloat& toAssign);
00161 
00162     void                  normalizeZero(XMLCh* const);
00163 
00164     inline bool           isSpecialValue() const;
00165 
00166     static int            compareSpecial(const XMLAbstractDoubleFloat* const specialValue                                       
00167                                        , MemoryManager* const manager);
00168 
00169     void                  formatString();
00170 
00171 protected:
00172     double                  fValue;
00173     LiteralType             fType;
00174     bool                    fDataConverted;
00175     bool                    fDataOverflowed;
00176 
00177 private:
00178     int                     fSign;
00179     XMLCh*                  fRawData;
00180 
00181     
00182     
00183     
00184     
00185     
00186     
00187     
00188     
00189     XMLCh*                  fFormattedString;
00190     MemoryManager*          fMemoryManager;
00191 
00192 };
00193 
00194 inline bool XMLAbstractDoubleFloat::isSpecialValue() const
00195 {
00196     return (fType < SpecialTypeNum);
00197 }
00198 
00199 inline MemoryManager* XMLAbstractDoubleFloat::getMemoryManager() const
00200 {
00201     return fMemoryManager;
00202 }
00203 
00204 inline bool XMLAbstractDoubleFloat::isDataConverted() const
00205 {
00206     return fDataConverted;
00207 }
00208 
00209 inline bool XMLAbstractDoubleFloat::isDataOverflowed() const
00210 {
00211     return fDataOverflowed;
00212 }
00213 
00214 inline double XMLAbstractDoubleFloat::getValue() const
00215 {
00216     return fValue;
00217 }
00218 
00219 inline  XMLAbstractDoubleFloat::LiteralType   XMLAbstractDoubleFloat::getType() const
00220 {
00221     return fType;
00222 }
00223 
00224 XERCES_CPP_NAMESPACE_END
00225 
00226 #endif