TInteger Class Reference

class TInteger

Abstract base class defining the interface for handling and manipulating big integers.

TInteger is capable of representing both negative and positive integers with an absolute value of less than 2^32^(2^32). To create an integer look at RInteger. TInteger defines an interface for the RInteger implementation - it is not intended that TIntegers be copied or assigned from other TIntegers. On EKA1 platforms, this is possible, but it should be avoided.

RInteger

Public Member Functions
IMPORT_C TBoolBit(TUint)
IMPORT_C TUintBitCount(void)
IMPORT_C HBufC8 *BufferLC()
IMPORT_C HBufC8 *BufferWithNoTruncationLC()
IMPORT_C TUintByteCount(void)
IMPORT_C TIntConvertToLongL(void)
IMPORT_C voidCopyL(const TInteger &, TBool)
IMPORT_C voidCopyL(const TInt, TBool)
IMPORT_C RIntegerDividedByL(const TInteger &)
IMPORT_C RIntegerDividedByL(TUint)
IMPORT_C RIntegerExponentiateL(const TInteger &)
IMPORT_C RIntegerGCDL(const TInteger &)
IMPORT_C RIntegerInverseModL(const TInteger &)
TBool IsEven()
TBool IsNegative()
TBool IsOdd()
TBool IsPositive()
IMPORT_C TBoolIsPrimeL(void)
TBool IsZero()
IMPORT_C RIntegerMinusL(const TInteger &)
IMPORT_C RIntegerModularExponentiateL(const TInteger &, const TInteger &, const TInteger &)
IMPORT_C RIntegerModularMultiplyL(const TInteger &, const TInteger &, const TInteger &)
IMPORT_C RIntegerModuloL(const TInteger &)
IMPORT_C TUintModuloL(TUint)
IMPORT_C voidNegate(void)
TBool NotNegative()
TBool NotPositive()
TBool NotZero()
IMPORT_C const TInteger &One(void)
IMPORT_C RIntegerPlusL(const TInteger &)
IMPORT_C voidSet(const RInteger &)
IMPORT_C voidSetBit(TUint)
IMPORT_C TIntSignedCompare(const TInteger &)
IMPORT_C TIntSignedCompare(TInt)
IMPORT_C RIntegerSquaredL(void)
IMPORT_C RIntegerTimesL(const TInteger &)
IMPORT_C const TInteger &Two(void)
IMPORT_C TIntUnsignedCompare(const TInteger &)
IMPORT_C TUintWordCount(void)
IMPORT_C const TInteger &Zero(void)
IMPORT_C TBooloperator!()
TBool operator!=(const TInteger &)
TBool operator!=(TInt)
IMPORT_C TInteger &operator%=(const TInteger &)
IMPORT_C TInteger &operator%=(TInt)
IMPORT_C TInteger &operator*=(const TInteger &)
IMPORT_C TInteger &operator*=(TInt)
IMPORT_C TInteger &operator++()
IMPORT_C TInteger &operator+=(const TInteger &)
IMPORT_C TInteger &operator+=(TInt)
IMPORT_C TInteger &operator--()
IMPORT_C TInteger &operator-=(const TInteger &)
IMPORT_C TInteger &operator-=(TInt)
IMPORT_C TInteger &operator/=(const TInteger &)
IMPORT_C TInteger &operator/=(TInt)
TBool operator<(const TInteger &)
TBool operator<(TInt)
IMPORT_C TInteger &operator<<=(TUint)
TBool operator<=(const TInteger &)
TBool operator<=(TInt)
TBool operator==(const TInteger &)
TBool operator==(TInt)
TBool operator>(const TInteger &)
TBool operator>(TInt)
TBool operator>=(const TInteger &)
TBool operator>=(TInt)
IMPORT_C TInteger &operator>>=(TUint)
Protected Member Functions
TInteger(void)
voidCleanGrowL(TUint)
voidCleanNewL(TUint)
voidCleanResizeL(TUint)
voidConstruct(const TDesC8 &)
voidConstruct(const TInteger &)
voidConstruct(TInt)
voidConstruct(TUint)
voidConstructStack(TUint, TUint)
voidConstructStack(TUint, const TInteger &)
TInt ConvertToLong(void)
TUint ConvertToUnsignedLong(void)
voidCreateNewL(TUint)
voidDivideL(RInteger &, RInteger &, const TInteger &, const TInteger &)
voidDivideL(TUint &, RInteger &, const TInteger &, TUint)
TBool IsConvertableToLong(void)
TBool IsHeapBased(void)
TBool IsStackBased(void)
TUint Modulo(const TInteger &, TUint)
RInteger PositiveAddL(const TInteger &, const TInteger &)
voidPositiveDivide(TUint &, TInteger &, const TInteger &, TUint)
voidPositiveDivideL(RInteger &, RInteger &, const TInteger &, const TInteger &)
RInteger PositiveMultiplyL(const TInteger &, const TInteger &)
RInteger PositiveSubtractL(const TInteger &, const TInteger &)
voidPrimeRandomizeL(TUint, TRandomAttribute)
TUint *constPtr(void)
voidRandomizeL(TUint, TRandomAttribute)
voidRandomizeL(const TInteger &, const TInteger &)
voidSetHeapBased(void)
voidSetPtr(TUint *)
voidSetSign(TSign)
voidSetSize(TUint)
voidSetStackBased(void)
TSign Sign(void)
TUint Size(void)
TBool SmallPrimeRandomizeL(void)
Private Member Functions
TInteger(const TInteger &)
TInteger &operator=(const TInteger &)
Public Member Enumerations
enumTRandomAttribute { EAllBitsRandom = 0, ETopBitSet = 1, ETop2BitsSet = 2 }
Protected Member Enumerations
enumTSign { EPositive = 0, ENegative = 1 }
Protected Attributes
TUint iPtr
TUint iSize

Constructor & Destructor Documentation

TInteger(void)

IMPORT_CTInteger(void)[protected]

Parameters

void

TInteger(const TInteger &)

TInteger(const TInteger &aInteger)[private]

Parameters

const TInteger & aInteger

Member Functions Documentation

Bit(TUint)

IMPORT_C TBoolBit(TUintaBitPos)const

Parameters

TUint aBitPos

BitCount(void)

IMPORT_C TUintBitCount(void)const

Get the number of bits required to represent this RInteger.

Parameters

void

BufferLC()

IMPORT_C HBufC8 *BufferLC()const

Creates a new buffer containing the big-endian binary representation of this integer.

Note that it does not support the exporting of negative integers.

leave
KErrNegativeExportNotSupported If this instance is a negative integer.

BufferWithNoTruncationLC()

IMPORT_C HBufC8 *BufferWithNoTruncationLC()const

ByteCount(void)

IMPORT_C TUintByteCount(void)const

Gets the number of bytes required to represent this RInteger.

Parameters

void

CleanGrowL(TUint)

voidCleanGrowL(TUintaNewSize)[protected]

Parameters

TUint aNewSize

CleanNewL(TUint)

voidCleanNewL(TUintaNewSize)[protected]

Parameters

TUint aNewSize

CleanResizeL(TUint)

voidCleanResizeL(TUintaNewSize)[protected]

Parameters

TUint aNewSize

Construct(const TDesC8 &)

voidConstruct(const TDesC8 &aValue)[protected]

Parameters

const TDesC8 & aValue

Construct(const TInteger &)

voidConstruct(const TInteger &aInteger)[protected]

Parameters

const TInteger & aInteger

Construct(TInt)

voidConstruct(TIntaInteger)[protected]

Parameters

TInt aInteger

Construct(TUint)

voidConstruct(TUintaInteger)[protected]

Parameters

TUint aInteger

ConstructStack(TUint, TUint)

voidConstructStack(TUintaWords,
TUintaInteger
)[protected]

Parameters

TUint aWords
TUint aInteger

ConstructStack(TUint, const TInteger &)

voidConstructStack(TUintaWords,
const TInteger &aInteger
)[protected]

Parameters

TUint aWords
const TInteger & aInteger

ConvertToLong(void)

TInt ConvertToLong(void)const [protected]

Parameters

void

ConvertToLongL(void)

IMPORT_C TIntConvertToLongL(void)const

Parameters

void

ConvertToUnsignedLong(void)

TUint ConvertToUnsignedLong(void)const [protected, inline]

Parameters

void

CopyL(const TInteger &, TBool)

IMPORT_C voidCopyL(const TInteger &aInteger,
TBoolaAllowShrink = ETrue
)

Parameters

const TInteger & aInteger
TBool aAllowShrink = ETrue

CopyL(const TInt, TBool)

IMPORT_C voidCopyL(const TIntaInteger,
TBoolaAllowShrink = ETrue
)

Parameters

const TInt aInteger
TBool aAllowShrink = ETrue

CreateNewL(TUint)

voidCreateNewL(TUintaNewSize)[protected]

Parameters

TUint aNewSize

DivideL(RInteger &, RInteger &, const TInteger &, const TInteger &)

voidDivideL(RInteger &aRemainder,
RInteger &aQuotient,
const TInteger &aDividend,
const TInteger &aDivisor
)const [protected]

Parameters

RInteger & aRemainder
RInteger & aQuotient
const TInteger & aDividend
const TInteger & aDivisor

DivideL(TUint &, RInteger &, const TInteger &, TUint)

voidDivideL(TUint &aRemainder,
RInteger &aQoutient,
const TInteger &aDividend,
TUintaDivisor
)const [protected]

Parameters

TUint & aRemainder
RInteger & aQoutient
const TInteger & aDividend
TUint aDivisor

DividedByL(const TInteger &)

IMPORT_C RIntegerDividedByL(const TInteger &aOperand)const

Parameters

const TInteger & aOperand

DividedByL(TUint)

IMPORT_C RIntegerDividedByL(TUintaOperand)const

Parameters

TUint aOperand

ExponentiateL(const TInteger &)

IMPORT_C RIntegerExponentiateL(const TInteger &aExponent)const

Parameters

const TInteger & aExponent

GCDL(const TInteger &)

IMPORT_C RIntegerGCDL(const TInteger &aOperand)const

Parameters

const TInteger & aOperand

InverseModL(const TInteger &)

IMPORT_C RIntegerInverseModL(const TInteger &aMod)const

Parameters

const TInteger & aMod

IsConvertableToLong(void)

TBool IsConvertableToLong(void)const [protected]

Parameters

void

IsEven()

TBool IsEven()const [inline]

IsHeapBased(void)

TBool IsHeapBased(void)const [protected, inline]

Parameters

void

IsNegative()

TBool IsNegative()const [inline]

IsOdd()

TBool IsOdd()const [inline]

IsPositive()

TBool IsPositive()const [inline]

IsPrimeL(void)

IMPORT_C TBoolIsPrimeL(void)const

Parameters

void

IsStackBased(void)

TBool IsStackBased(void)const [protected, inline]

Parameters

void

IsZero()

TBool IsZero()const [inline]

MinusL(const TInteger &)

IMPORT_C RIntegerMinusL(const TInteger &aOperand)const

Parameters

const TInteger & aOperand

ModularExponentiateL(const TInteger &, const TInteger &, const TInteger &)

IMPORT_C RIntegerModularExponentiateL(const TInteger &aBase,
const TInteger &aExp,
const TInteger &aMod
)[static]

Parameters

const TInteger & aBase
const TInteger & aExp
const TInteger & aMod

ModularMultiplyL(const TInteger &, const TInteger &, const TInteger &)

IMPORT_C RIntegerModularMultiplyL(const TInteger &aA,
const TInteger &aB,
const TInteger &aModulus
)[static]

Parameters

const TInteger & aA
const TInteger & aB
const TInteger & aModulus

Modulo(const TInteger &, TUint)

TUint Modulo(const TInteger &aDividend,
TUintaDivisor
)const [protected]

Parameters

const TInteger & aDividend
TUint aDivisor

ModuloL(const TInteger &)

IMPORT_C RIntegerModuloL(const TInteger &aOperand)const

Parameters

const TInteger & aOperand

ModuloL(TUint)

IMPORT_C TUintModuloL(TUintaOperand)const

Parameters

TUint aOperand

Negate(void)

IMPORT_C voidNegate(void)

Parameters

void

NotNegative()

TBool NotNegative()const [inline]

NotPositive()

TBool NotPositive()const [inline]

NotZero()

TBool NotZero()const [inline]

One(void)

IMPORT_C const TInteger &One(void)[static]

Gets the TInteger that represents one

Parameters

void

PlusL(const TInteger &)

IMPORT_C RIntegerPlusL(const TInteger &aOperand)const

Parameters

const TInteger & aOperand

PositiveAddL(const TInteger &, const TInteger &)

RInteger PositiveAddL(const TInteger &aA,
const TInteger &aB
)const [protected]

Parameters

const TInteger & aA
const TInteger & aB

PositiveDivide(TUint &, TInteger &, const TInteger &, TUint)

voidPositiveDivide(TUint &aRemainder,
TInteger &aQoutient,
const TInteger &aDividend,
TUintaDivisor
)const [protected]

Parameters

TUint & aRemainder
TInteger & aQoutient
const TInteger & aDividend
TUint aDivisor

PositiveDivideL(RInteger &, RInteger &, const TInteger &, const TInteger &)

voidPositiveDivideL(RInteger &aRemainder,
RInteger &aQuotient,
const TInteger &aDividend,
const TInteger &aDivisor
)const [protected]

Parameters

RInteger & aRemainder
RInteger & aQuotient
const TInteger & aDividend
const TInteger & aDivisor

PositiveMultiplyL(const TInteger &, const TInteger &)

RInteger PositiveMultiplyL(const TInteger &aA,
const TInteger &aB
)const [protected]

Parameters

const TInteger & aA
const TInteger & aB

PositiveSubtractL(const TInteger &, const TInteger &)

RInteger PositiveSubtractL(const TInteger &aA,
const TInteger &aB
)const [protected]

Parameters

const TInteger & aA
const TInteger & aB

PrimeRandomizeL(TUint, TRandomAttribute)

voidPrimeRandomizeL(TUintaBits,
TRandomAttributeaAttr
)[protected]

Parameters

TUint aBits
TRandomAttribute aAttr

Ptr(void)

TUint *constPtr(void)const [protected, inline]

Parameters

void

RandomizeL(TUint, TRandomAttribute)

voidRandomizeL(TUintaBits,
TRandomAttributeaAttr
)[protected]

Parameters

TUint aBits
TRandomAttribute aAttr

RandomizeL(const TInteger &, const TInteger &)

voidRandomizeL(const TInteger &aMin,
const TInteger &aMax
)[protected]

Parameters

const TInteger & aMin
const TInteger & aMax

Set(const RInteger &)

IMPORT_C voidSet(const RInteger &aInteger)

Parameters

const RInteger & aInteger

SetBit(TUint)

IMPORT_C voidSetBit(TUintaBitPos)

Parameters

TUint aBitPos

SetHeapBased(void)

voidSetHeapBased(void)[protected, inline]

Parameters

void

SetPtr(TUint *)

voidSetPtr(TUint *aPtr)[protected, inline]

Parameters

TUint * aPtr

SetSign(TSign)

voidSetSign(TSignaSign)[protected, inline]

Parameters

TSign aSign

SetSize(TUint)

voidSetSize(TUintaSize)[protected, inline]

Parameters

TUint aSize

SetStackBased(void)

voidSetStackBased(void)[protected, inline]

Parameters

void

Sign(void)

TSign Sign(void)const [protected, inline]

Parameters

void

SignedCompare(const TInteger &)

IMPORT_C TIntSignedCompare(const TInteger &aThat)const

Parameters

const TInteger & aThat

SignedCompare(TInt)

IMPORT_C TIntSignedCompare(TIntaThat)const

Parameters

TInt aThat

Size(void)

TUint Size(void)const [protected, inline]

Parameters

void

SmallPrimeRandomizeL(void)

TBool SmallPrimeRandomizeL(void)[protected]

Parameters

void

SquaredL(void)

IMPORT_C RIntegerSquaredL(void)const

Parameters

void

TimesL(const TInteger &)

IMPORT_C RIntegerTimesL(const TInteger &aOperand)const

Parameters

const TInteger & aOperand

Two(void)

IMPORT_C const TInteger &Two(void)[static]

Gets the TInteger that represents two

Parameters

void

UnsignedCompare(const TInteger &)

IMPORT_C TIntUnsignedCompare(const TInteger &aThat)const

Parameters

const TInteger & aThat

WordCount(void)

IMPORT_C TUintWordCount(void)const

Gets the number of words required to represent this RInteger.

Parameters

void

Zero(void)

IMPORT_C const TInteger &Zero(void)[static]

Gets the TInteger that represents zero

Parameters

void

operator!()

IMPORT_C TBooloperator!()const

operator!=(const TInteger &)

TBool operator!=(const TInteger &aInteger)const [inline]

Parameters

const TInteger & aInteger

operator!=(TInt)

TBool operator!=(TIntaInteger)const [inline]

Parameters

TInt aInteger

operator%=(const TInteger &)

IMPORT_C TInteger &operator%=(const TInteger &aOperand)

Parameters

const TInteger & aOperand

operator%=(TInt)

IMPORT_C TInteger &operator%=(TIntaOperand)

Parameters

TInt aOperand

operator*=(const TInteger &)

IMPORT_C TInteger &operator*=(const TInteger &aOperand)

Parameters

const TInteger & aOperand

operator*=(TInt)

IMPORT_C TInteger &operator*=(TIntaOperand)

Parameters

TInt aOperand

operator++()

IMPORT_C TInteger &operator++()

operator+=(const TInteger &)

IMPORT_C TInteger &operator+=(const TInteger &aOperand)

Parameters

const TInteger & aOperand

operator+=(TInt)

IMPORT_C TInteger &operator+=(TIntaOperand)

Parameters

TInt aOperand

operator--()

IMPORT_C TInteger &operator--()

operator-=(const TInteger &)

IMPORT_C TInteger &operator-=(const TInteger &aOperand)

Parameters

const TInteger & aOperand

operator-=(TInt)

IMPORT_C TInteger &operator-=(TIntaOperand)

Parameters

TInt aOperand

operator/=(const TInteger &)

IMPORT_C TInteger &operator/=(const TInteger &aOperand)

Parameters

const TInteger & aOperand

operator/=(TInt)

IMPORT_C TInteger &operator/=(TIntaOperand)

Parameters

TInt aOperand

operator<(const TInteger &)

TBool operator<(const TInteger &aInteger)const [inline]

Parameters

const TInteger & aInteger

operator<(TInt)

TBool operator<(TIntaInteger)const [inline]

Parameters

TInt aInteger

operator<<=(TUint)

IMPORT_C TInteger &operator<<=(TUintaBits)

Parameters

TUint aBits

operator<=(const TInteger &)

TBool operator<=(const TInteger &aInteger)const [inline]

Parameters

const TInteger & aInteger

operator<=(TInt)

TBool operator<=(TIntaInteger)const [inline]

Parameters

TInt aInteger

operator=(const TInteger &)

TInteger &operator=(const TInteger &aInteger)[private]

Parameters

const TInteger & aInteger

operator==(const TInteger &)

TBool operator==(const TInteger &aInteger)const [inline]

Parameters

const TInteger & aInteger

operator==(TInt)

TBool operator==(TIntaInteger)const [inline]

Parameters

TInt aInteger

operator>(const TInteger &)

TBool operator>(const TInteger &aInteger)const [inline]

Parameters

const TInteger & aInteger

operator>(TInt)

TBool operator>(TIntaInteger)const [inline]

Parameters

TInt aInteger

operator>=(const TInteger &)

TBool operator>=(const TInteger &aInteger)const [inline]

Parameters

const TInteger & aInteger

operator>=(TInt)

TBool operator>=(TIntaInteger)const [inline]

Parameters

TInt aInteger

operator>>=(TUint)

IMPORT_C TInteger &operator>>=(TUintaBits)

Parameters

TUint aBits

Member Enumerations Documentation

Enum TRandomAttribute

Enumerators

EAllBitsRandom = 0
ETopBitSet = 1
ETop2BitsSet = 2

Enum TSign

Enumerators

EPositive = 0
ENegative = 1

Member Data Documentation

TUint iPtr

TUint iPtr[protected]

TUint iSize

TUint iSize[protected]