#include <QtCrypto>

Public Member Functions | |
| BigInteger (const BigInteger &from) | |
| BigInteger (const QCA::SecureArray &a) | |
| BigInteger (const QString &s) | |
| BigInteger (const char *c) | |
| BigInteger (int n) | |
| BigInteger () | |
| int | compare (const BigInteger &n) const |
| void | fromArray (const QCA::SecureArray &a) |
| bool | fromString (const QString &s) |
| bool | operator!= (const BigInteger &other) const |
| BigInteger & | operator%= (const BigInteger &b) |
| BigInteger & | operator*= (const BigInteger &b) |
| BigInteger & | operator+= (const BigInteger &b) |
| BigInteger & | operator-= (const BigInteger &b) |
| BigInteger & | operator/= (const BigInteger &b) |
| bool | operator< (const BigInteger &other) const |
| bool | operator<= (const BigInteger &other) const |
| BigInteger & | operator= (const QString &s) |
| BigInteger & | operator= (const BigInteger &from) |
| bool | operator== (const BigInteger &other) const |
| bool | operator> (const BigInteger &other) const |
| bool | operator>= (const BigInteger &other) const |
| QCA::SecureArray | toArray () const |
| QString | toString () 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 }
| QCA::BigInteger::BigInteger | ( | ) |
Constructor.
Creates a new BigInteger, initialised to zero.
| QCA::BigInteger::BigInteger | ( | int | n | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| n | an alternative integer initialisation value. |
| QCA::BigInteger::BigInteger | ( | const char * | c | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| c | an alternative initialisation value, encoded as a character array |
BigInteger b ( "9890343" );
| QCA::BigInteger::BigInteger | ( | const QString & | s | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| s | an alternative initialisation value, encoded as a string |
| QCA::BigInteger::BigInteger | ( | const QCA::SecureArray & | a | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| a | an alternative initialisation value, encoded as SecureArray |
| QCA::BigInteger::BigInteger | ( | const BigInteger & | from | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| from | an alternative initialisation value, encoded as a BigInteger |
| int QCA::BigInteger::compare | ( | const BigInteger & | n | ) | const |
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.
| n | the BigInteger to compare with |
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
| void QCA::BigInteger::fromArray | ( | const QCA::SecureArray & | a | ) |
Assign from an array.
The input is expected to be a binary integer in sign-extended network-byte-order.
| a | a SecureArray that represents an integer |
| bool QCA::BigInteger::fromString | ( | const QString & | s | ) |
| bool QCA::BigInteger::operator!= | ( | const BigInteger & | other | ) | const [inline] |
Inequality operator.
Returns true if the two BigInteger values are different in magnitude, sign or both.
| other | the BigInteger to compare to |
| BigInteger& QCA::BigInteger::operator%= | ( | const BigInteger & | b | ) |
Modulo in place operator.
| b | the amount to divide by |
| BigInteger& QCA::BigInteger::operator*= | ( | const BigInteger & | b | ) |
Multiply in place operator.
| b | the amount to multiply by |
| BigInteger& QCA::BigInteger::operator+= | ( | const BigInteger & | b | ) |
Increment in place operator.
| b | the amount to increment by |
BigInteger a; // a is zero BigInteger b( 500 ); a += b; // a is now 500 a += b; // a is now 1000
| BigInteger& QCA::BigInteger::operator-= | ( | const BigInteger & | b | ) |
Decrement in place operator.
| b | the amount to decrement by |
BigInteger a; // a is zero BigInteger b( 500 ); a -= b; // a is now -500 a -= b; // a is now -1000
| BigInteger& QCA::BigInteger::operator/= | ( | const BigInteger & | b | ) |
Divide in place operator.
| b | the amount to divide by |
| bool QCA::BigInteger::operator< | ( | const BigInteger & | other | ) | const [inline] |
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.
| other | the BigInteger to compare to |
| bool QCA::BigInteger::operator<= | ( | const BigInteger & | other | ) | const [inline] |
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.
| other | the BigInteger to compare to |
| BigInteger& QCA::BigInteger::operator= | ( | const QString & | s | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| s | the QString containing an integer representation |
| BigInteger& QCA::BigInteger::operator= | ( | const BigInteger & | from | ) |
Assignment operator.
| from | the BigInteger to copy from |
BigInteger a; // a is zero BigInteger b( 500 ); a = b; // a is now 500
| bool QCA::BigInteger::operator== | ( | const BigInteger & | other | ) | const [inline] |
Equality operator.
Returns true if the two BigInteger values are the same, including having the same sign.
| other | the BigInteger to compare to |
| bool QCA::BigInteger::operator> | ( | const BigInteger & | other | ) | const [inline] |
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.
| other | the BigInteger to compare to |
| bool QCA::BigInteger::operator>= | ( | const BigInteger & | other | ) | const [inline] |
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.
| other | the BigInteger to compare to |
| QCA::SecureArray QCA::BigInteger::toArray | ( | ) | const |
Output BigInteger as a byte array, useful for storage or transmission.
The format is a binary integer in sign-extended network-byte-order.
| QString QCA::BigInteger::toString | ( | ) | const |
Convert BigInteger to a QString.
QString aString; BigInteger aBiggishInteger( 5878990 ); aString = aBiggishInteger.toString(); // aString is now "5878990"
| QCA_EXPORT QTextStream & operator<< | ( | QTextStream & | stream, | |
| const BigInteger & | b | |||
| ) | [related] |
Stream operator.
| stream | the stream to write to | |
| b | the integer to write to the stream |
1.5.5