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 #ifndef XML_BIGINTEGER_HPP
00062 #define XML_BIGINTEGER_HPP
00063
00064 #include <xercesc/util/XMemory.hpp>
00065 #include <xercesc/util/XMLString.hpp>
00066
00067 XERCES_CPP_NAMESPACE_BEGIN
00068
00069 class XMLBigInteger : public XMemory
00070 {
00071 public:
00072
00084 XMLBigInteger
00085 (
00086 const XMLCh* const strValue
00087 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00088 );
00089 ~XMLBigInteger();
00090
00091 XMLBigInteger(const XMLBigInteger& toCopy);
00092
00093 static void parseBigInteger(const XMLCh* const toConvert
00094 , XMLCh* const retBuffer
00095 , int& signValue);
00096
00097 static int compareValues(const XMLBigInteger* const lValue
00098 ,const XMLBigInteger* const rValue);
00099
00100
00101 void multiply(const unsigned int byteToShift);
00102
00103 void divide(const unsigned int byteToShift);
00104
00105 int getTotalDigit() const;
00106
00115 inline XMLCh* toString() const;
00116
00122 inline XMLCh* getRawData() const;
00123
00134 bool operator==(const XMLBigInteger& toCompare) const;
00135
00140 int getSign() const;
00141
00142 int intValue() const;
00143
00144 private:
00145
00146 void setSign(int);
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 int fSign;
00170 XMLCh* fMagnitude;
00171 XMLCh* fRawData;
00172 MemoryManager* fMemoryManager;
00173 };
00174
00175 inline int XMLBigInteger::getSign() const
00176 {
00177 return fSign;
00178 }
00179
00180 inline int XMLBigInteger::getTotalDigit() const
00181 {
00182 return ((getSign() ==0) ? 0 : XMLString::stringLen(fMagnitude));
00183 }
00184
00185 inline bool XMLBigInteger::operator==(const XMLBigInteger& toCompare) const
00186 {
00187 return ( compareValues(this, &toCompare) ==0 ? true : false);
00188 }
00189
00190 inline void XMLBigInteger::setSign(int newSign)
00191 {
00192 fSign = newSign;
00193 }
00194
00195 inline XMLCh* XMLBigInteger::getRawData() const
00196 {
00197 return fRawData;
00198 }
00199
00200
00201
00202
00203 inline XMLCh* XMLBigInteger::toString() const
00204 {
00205
00206 return XMLString::replicate(fRawData);
00207 }
00208
00209 XERCES_CPP_NAMESPACE_END
00210
00211 #endif