00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef XML_BIGDECIMAL_HPP
00022 #define XML_BIGDECIMAL_HPP
00023 
00024 #include <xercesc/util/XMLNumber.hpp>
00025 #include <xercesc/util/XMLString.hpp>
00026 #include <xercesc/util/PlatformUtils.hpp>
00027 
00028 XERCES_CPP_NAMESPACE_BEGIN
00029 
00030 class  XMLBigDecimal : public XMLNumber
00031 {
00032 public:
00033 
00046     XMLBigDecimal
00047     (
00048         const XMLCh* const strValue
00049         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00050     );
00051 
00052     ~XMLBigDecimal();
00053 
00054     static int            compareValues(const XMLBigDecimal* const lValue
00055                                       , const XMLBigDecimal* const rValue
00056                                       , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00057 
00058     static XMLCh* getCanonicalRepresentation
00059                   (
00060                    const XMLCh*         const rawData
00061                  ,       MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager
00062                   );
00063 
00064     static void  parseDecimal
00065                 ( 
00066                    const XMLCh* const toParse
00067                 ,        XMLCh* const retBuffer
00068                 ,        int&         sign
00069                 ,        int&         totalDigits
00070                 ,        int&         fractDigits
00071                 ,        MemoryManager* const manager
00072                 );
00073 
00074     static void  parseDecimal
00075                 ( 
00076                    const XMLCh*         const toParse
00077                 ,        MemoryManager* const manager
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     const XMLCh*          getValue() const;
00094 
00095     unsigned int          getScale() const;
00096 
00097     unsigned int          getTotalDigit() const;
00098 
00099     inline XMLCh*         getIntVal() const;
00100 
00109      int toCompare(const XMLBigDecimal& other) const;
00110 
00111     
00112 
00113 
00114 
00115 
00116     void setDecimalValue(const XMLCh* const strValue);
00117 
00118     MemoryManager* getMemoryManager() const;
00119 
00120     
00121 
00122 
00123     DECL_XSERIALIZABLE(XMLBigDecimal)
00124 
00125     XMLBigDecimal(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00126 
00127 private:
00128 
00129     void  cleanUp();
00130     
00131     
00132     
00133     
00134     XMLBigDecimal(const XMLBigDecimal& other);
00135     XMLBigDecimal& operator=(const XMLBigDecimal& other);        
00136     
00137     
00138     
00139     
00140     
00141     
00142     
00143     
00144     
00145     
00146     
00147     
00148     
00149     
00150     
00151     
00152     
00153     
00154     
00155     
00156     
00157     
00158     
00159     
00160     int            fSign;
00161     unsigned int   fTotalDigits;
00162     unsigned int   fScale;
00163     unsigned int   fRawDataLen;
00164     XMLCh*         fRawData;
00165     XMLCh*         fIntVal;
00166     MemoryManager* fMemoryManager;
00167 
00168 };
00169 
00170 inline int XMLBigDecimal::getSign() const
00171 {
00172     return fSign;
00173 }
00174 
00175 inline const XMLCh* XMLBigDecimal::getValue() const
00176 {
00177     return fIntVal;
00178 }
00179 
00180 inline unsigned int XMLBigDecimal::getScale() const
00181 {
00182     return fScale;
00183 }
00184 
00185 inline unsigned int XMLBigDecimal::getTotalDigit() const
00186 {
00187     return fTotalDigits;
00188 }
00189 
00190 inline XMLCh*  XMLBigDecimal::getRawData() const
00191 {
00192     return fRawData;
00193 }
00194 
00195 inline const XMLCh*  XMLBigDecimal::getFormattedString() const
00196 {
00197     return fRawData;
00198 }
00199 
00200 inline MemoryManager* XMLBigDecimal::getMemoryManager() const
00201 {
00202     return fMemoryManager;
00203 }
00204 
00205 inline XMLCh*  XMLBigDecimal::getIntVal() const
00206 {
00207     return fIntVal;
00208 }
00209 
00210 
00211 
00212 
00213 inline XMLCh*  XMLBigDecimal::toString() const
00214 {
00215     
00216     return XMLString::replicate(fRawData);
00217 }
00218 
00219 XERCES_CPP_NAMESPACE_END
00220 
00221 #endif