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
00086 XMLBigInteger
00087 (
00088 const XMLCh* const strValue
00089 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00090 );
00091 ~XMLBigInteger();
00092
00093 XMLBigInteger(const XMLBigInteger& toCopy);
00094
00095 static void parseBigInteger(const XMLCh* const toConvert
00096 , XMLCh* const retBuffer
00097 , int& signValue);
00098
00099 static int compareValues(const XMLBigInteger* const lValue
00100 ,const XMLBigInteger* const rValue);
00101
00102
00103 void multiply(const unsigned int byteToShift);
00104
00105 void divide(const unsigned int byteToShift);
00106
00107 int getTotalDigit() const;
00108
00117 inline XMLCh* toString() const;
00118
00124 inline XMLCh* getRawData() const;
00125
00136 bool operator==(const XMLBigInteger& toCompare) const;
00137
00142 int getSign() const;
00143
00144 int intValue() const;
00145
00146 private:
00147
00148 void setSign(int);
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 int fSign;
00172 XMLCh* fMagnitude;
00173 XMLCh* fRawData;
00174 MemoryManager* fMemoryManager;
00175 };
00176
00177 inline int XMLBigInteger::getSign() const
00178 {
00179 return fSign;
00180 }
00181
00182 inline int XMLBigInteger::getTotalDigit() const
00183 {
00184 return ((getSign() ==0) ? 0 : XMLString::stringLen(fMagnitude));
00185 }
00186
00187 inline bool XMLBigInteger::operator==(const XMLBigInteger& toCompare) const
00188 {
00189 return ( compareValues(this, &toCompare) ==0 ? true : false);
00190 }
00191
00192 inline void XMLBigInteger::setSign(int newSign)
00193 {
00194 fSign = newSign;
00195 }
00196
00197 inline XMLCh* XMLBigInteger::getRawData() const
00198 {
00199 return fRawData;
00200 }
00201
00202
00203
00204
00205 inline XMLCh* XMLBigInteger::toString() const
00206 {
00207
00208 return XMLString::replicate(fRawData);
00209 }
00210
00211 XERCES_CPP_NAMESPACE_END
00212
00213 #endif