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