#include <QtCrypto>
Collaboration diagram for QCA::BigInteger:
Public Member Functions | |
BigInteger () | |
BigInteger (int n) | |
BigInteger (const char *c) | |
BigInteger (const QString &s) | |
BigInteger (const QCA::SecureArray &a) | |
BigInteger (const BigInteger &from) | |
BigInteger & | operator= (const BigInteger &from) |
BigInteger & | operator= (const QString &s) |
BigInteger & | operator+= (const BigInteger &b) |
BigInteger & | operator-= (const BigInteger &b) |
QCA::SecureArray | toArray () const |
void | fromArray (const QCA::SecureArray &a) |
QString | toString () const |
bool | fromString (const QString &s) |
int | compare (const BigInteger &n) const |
bool | operator== (const BigInteger &other) const |
bool | operator!= (const BigInteger &other) const |
bool | operator<= (const BigInteger &other) const |
bool | operator>= (const BigInteger &other) const |
bool | operator< (const BigInteger &other) const |
bool | operator> (const BigInteger &other) const |
Related Functions | |
(Note that these are not member functions.) | |
QCA_EXPORT QTextStream & | operator<< (QTextStream &stream, const BigInteger &b) |
BigInteger provides arbitrary precision integers.
if ( BigInteger("3499543804349") == BigInteger("38493290803248") + BigInteger( 343 ) ) { // do something }
|
Constructor. Creates a new BigInteger, initialised to zero. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
BigInteger b ( "9890343" ); |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Assignment operator.
BigInteger a; // a is zero BigInteger b( 500 ); a = b; // a is now 500 |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Increment in place operator.
BigInteger a; // a is zero BigInteger b( 500 ); a += b; // a is now 500 a += b; // a is now 1000 |
|
Decrement in place operator.
BigInteger a; // a is zero BigInteger b( 500 ); a -= b; // a is now -500 a -= b; // a is now -1000 |
|
Output BigInteger as a byte array, useful for storage or transmission. The format is a binary integer in sign-extended network-byte-order.
|
|
Assign from an array. The input is expected to be a binary integer in sign-extended network-byte-order.
|
|
Convert BigInteger to a QString.
QString aString; BigInteger aBiggishInteger( 5878990 ); aString = aBiggishInteger.toString(); // aString is now "5878990" |
|
Assign from a QString.
|
|
Compare this value with another BigInteger. Normally it is more readable to use one of the operator overloads, so you don't need to use this method directly.
BigInteger a( "400" ); BigInteger b( "-400" ); BigInteger c( " 200 " ); int result; result = a.compare( b ); // return positive 400 > -400 result = a.compare( c ); // return positive, 400 > 200 result = b.compare( c ); // return negative, -400 < 200 |
|
Equality operator. Returns true if the two BigInteger values are the same, including having the same sign. |
|
Inequality operator. Returns true if the two BigInteger values are different in magnitude, sign or both. |
|
Less than or equal operator. Returns true if the BigInteger value on the left hand side is equal to or less than the BigInteger value on the right hand side. |
|
Greater than or equal operator. Returns true if the BigInteger value on the left hand side is equal to or greater than the BigInteger value on the right hand side. |
|
Less than operator. Returns true if the BigInteger value on the left hand side is less than the BigInteger value on the right hand side. |
|
Greater than operator. Returns true if the BigInteger value on the left hand side is greater than the BigInteger value on the right hand side. |
|
Stream operator.
|