XMLBigDecimal.hpp

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  * 
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  * 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * $Id: XMLBigDecimal.hpp 555320 2007-07-11 16:05:13Z amassari $
00020  */
00021 
00022 #if !defined(XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP)
00023 #define XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP
00024 
00025 #include <xercesc/util/XMLNumber.hpp>
00026 #include <xercesc/util/XMLString.hpp>
00027 #include <xercesc/util/PlatformUtils.hpp>
00028 
00029 XERCES_CPP_NAMESPACE_BEGIN
00030 
00031 class XMLUTIL_EXPORT XMLBigDecimal : public XMLNumber
00032 {
00033 public:
00034 
00047     XMLBigDecimal
00048     (
00049         const XMLCh* const strValue
00050         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00051     );
00052 
00053     ~XMLBigDecimal();
00054 
00055     static int            compareValues(const XMLBigDecimal* const lValue
00056                                       , const XMLBigDecimal* const rValue
00057                                       , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00058 
00059     static XMLCh* getCanonicalRepresentation
00060                   (
00061                    const XMLCh*         const rawData
00062                  ,       MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager
00063                   );
00064 
00065     static void  parseDecimal
00066                 ( 
00067                    const XMLCh* const toParse
00068                 ,        XMLCh* const retBuffer
00069                 ,        int&         sign
00070                 ,        int&         totalDigits
00071                 ,        int&         fractDigits
00072                 ,        MemoryManager* const manager
00073                 );
00074 
00075     static void  parseDecimal
00076                 ( 
00077                    const XMLCh*         const toParse
00078                 ,        MemoryManager* const manager
00079                 );
00080 
00081     virtual XMLCh*        getRawData() const;
00082 
00083     virtual const XMLCh*  getFormattedString() const;
00084 
00085     virtual int           getSign() const;
00086 
00087     const XMLCh*          getValue() const;
00088 
00089     unsigned int          getScale() const;
00090 
00091     unsigned int          getTotalDigit() const;
00092 
00093     inline XMLCh*         getIntVal() const;
00094 
00103      int toCompare(const XMLBigDecimal& other) const;
00104 
00105     /*
00106      * Sets the value to be converted
00107      *
00108      * @param   strValue the value to convert
00109      */
00110     void setDecimalValue(const XMLCh* const strValue);
00111 
00112     MemoryManager* getMemoryManager() const;
00113 
00114     /***
00115      * Support for Serialization/De-serialization
00116      ***/
00117     DECL_XSERIALIZABLE(XMLBigDecimal)
00118 
00119     XMLBigDecimal(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00120 
00121 private:
00122 
00123     void  cleanUp();
00124     
00125     // -----------------------------------------------------------------------
00126     //  Unimplemented contstructors and operators
00127     // -----------------------------------------------------------------------       
00128     XMLBigDecimal(const XMLBigDecimal& other);
00129     XMLBigDecimal& operator=(const XMLBigDecimal& other);        
00130     
00131     // -----------------------------------------------------------------------
00132     //  Private data members
00133     //
00134     //  fSign
00135     //     sign
00136     //
00137     //  fTotalDigits
00138     //     the total number of didits 
00139     //
00140     //  fScale
00141     //     the number of digits to the right of the decimal point
00142     //
00143     //  fIntVal
00144     //     The value of this BigDecimal, w/o
00145     //         leading whitespace, leading zero
00146     //         decimal point
00147     //         trailing zero, trailing whitespace
00148     //
00149     //  fRawData
00150     //     to preserve the original string used to construct this object,
00151     //     needed for pattern matching.
00152     //
00153     // -----------------------------------------------------------------------
00154     int            fSign;
00155     unsigned int   fTotalDigits;
00156     unsigned int   fScale;
00157     XMLSize_t      fRawDataLen;
00158     XMLCh*         fRawData;
00159     XMLCh*         fIntVal;
00160     MemoryManager* fMemoryManager;
00161 
00162 };
00163 
00164 inline int XMLBigDecimal::getSign() const
00165 {
00166     return fSign;
00167 }
00168 
00169 inline const XMLCh* XMLBigDecimal::getValue() const
00170 {
00171     return fIntVal;
00172 }
00173 
00174 inline unsigned int XMLBigDecimal::getScale() const
00175 {
00176     return fScale;
00177 }
00178 
00179 inline unsigned int XMLBigDecimal::getTotalDigit() const
00180 {
00181     return fTotalDigits;
00182 }
00183 
00184 inline XMLCh*  XMLBigDecimal::getRawData() const
00185 {
00186     return fRawData;
00187 }
00188 
00189 inline const XMLCh*  XMLBigDecimal::getFormattedString() const
00190 {
00191     return fRawData;
00192 }
00193 
00194 inline MemoryManager* XMLBigDecimal::getMemoryManager() const
00195 {
00196     return fMemoryManager;
00197 }
00198 
00199 inline XMLCh*  XMLBigDecimal::getIntVal() const
00200 {
00201     return fIntVal;
00202 }
00203 
00204 XERCES_CPP_NAMESPACE_END
00205 
00206 #endif

Generated on Wed Sep 24 16:36:33 2008 for Xerces-C++ by  doxygen 1.5.4