TLex8 Class Reference

class TLex8

Provides general string-parsing functions suitable for numeric format conversions and syntactical-element parsing.

The class is the 8-bit variant for non-Unicode strings and 8-bit wide characters.

An instance of this class stores a string, maintaining an extraction mark to indicate the current lexical element being analysed and a pointer to the next character to be examined.

Objects of this type are normally accessed through the build independent type TLex.

TLex

Public Member Functions
TLex8()
TLex8(const TUint8 *)
TLex8(const TDesC8 &)
voidAssign(const TLex8 &)
IMPORT_C voidAssign(const TUint8 *)
IMPORT_C voidAssign(const TDesC8 &)
IMPORT_C TIntBoundedVal(TInt32 &, TInt)
IMPORT_C TIntBoundedVal(TInt64 &, const TInt64 &)
IMPORT_C TIntBoundedVal(TUint32 &, TRadix, TUint)
IMPORT_C TIntBoundedVal(TInt64 &, TRadix, const TInt64 &)
TBool Eos()
IMPORT_C TCharGet()
IMPORT_C voidInc()
IMPORT_C voidInc(TInt)
voidMark(TLexMark8 &)
voidMark()
TInt MarkedOffset()
IMPORT_C TIntMarkedOffset(const TLexMark8)
IMPORT_C TPtrC8MarkedToken()
IMPORT_C TPtrC8MarkedToken(const TLexMark8)
IMPORT_C TPtrC8NextToken()
IMPORT_C TIntOffset()
IMPORT_C TCharPeek()
IMPORT_C TPtrC8Remainder()
IMPORT_C TPtrC8RemainderFromMark()
IMPORT_C TPtrC8RemainderFromMark(const TLexMark8)
voidSkipAndMark(TInt)
IMPORT_C voidSkipAndMark(TInt, TLexMark8 &)
IMPORT_C voidSkipCharacters()
IMPORT_C voidSkipSpace()
voidSkipSpaceAndMark()
IMPORT_C voidSkipSpaceAndMark(TLexMark8 &)
TInt TokenLength()
IMPORT_C TIntTokenLength(const TLexMark8)
IMPORT_C voidUnGet()
voidUnGetToMark()
IMPORT_C voidUnGetToMark(const TLexMark8)
IMPORT_C TIntVal(TInt8 &)
IMPORT_C TIntVal(TInt16 &)
IMPORT_C TIntVal(TInt32 &)
IMPORT_C TIntVal(TInt64 &)
TInt Val(TInt &)
IMPORT_C TIntVal(TUint8 &, TRadix)
IMPORT_C TIntVal(TUint16 &, TRadix)
IMPORT_C TIntVal(TUint32 &, TRadix)
IMPORT_C TIntVal(TInt64 &, TRadix)
TInt Val(TUint &, TRadix)
IMPORT_C TIntVal(TReal32 &)
IMPORT_C TIntVal(TReal32 &, TChar)
IMPORT_C TIntVal(TReal64 &)
IMPORT_C TIntVal(TReal64 &, TChar)
TInt Val(TRealX &)
TInt Val(TRealX &, TChar)
TInt Val(TInt32 &, TInt)
TInt Val(TInt64 &, const TInt64 &)
TInt Val(TUint32 &, TRadix, TUint)
TInt Val(TInt64 &, TRadix, const TInt64 &)
TLex8 &operator=(const TUint8 *)
TLex8 &operator=(const TDesC8 &)
Private Member Functions
voidScndig(TInt &, TInt &, TUint64 &)
voidScndigAfterPoint(TInt &, TUint64 &)
voidValidateMark(const TLexMark8)
Private Attributes
__DECLARE_TEST
const TUint8 *iBuf
const TUint8 *iEnd
TLexMark8 iMark
const TUint8 *iNext

Constructor & Destructor Documentation

TLex8()

IMPORT_CTLex8()

TLex8(const TUint8 *)

TLex8(const TUint8 *aString)[inline]

Constructs the object with a pointer to a string.

The extraction mark and next character members are initialised to point to the start of the string.

Parameters

const TUint8 * aStringString to be assigned.

TLex8(const TDesC8 &)

TLex8(const TDesC8 &aDes)[inline]

Constructs the object with a descriptor.

The extraction mark and next character members are initialised to point to the start of the string.

Parameters

const TDesC8 & aDesDescriptor to be assigned by reference.

Member Functions Documentation

Assign(const TLex8 &)

voidAssign(const TLex8 &aLex)[inline]

Assigns a string to this object from another TLex8 object.

Parameters

const TLex8 & aLexThe object to be assigned.

Assign(const TUint8 *)

IMPORT_C voidAssign(const TUint8 *aString)

Parameters

const TUint8 * aString

Assign(const TDesC8 &)

IMPORT_C voidAssign(const TDesC8 &aDes)

Parameters

const TDesC8 & aDes

BoundedVal(TInt32 &, TInt)

IMPORT_C TIntBoundedVal(TInt32 &aVal,
TIntaLimit
)

Parameters

TInt32 & aVal
TInt aLimit

BoundedVal(TInt64 &, const TInt64 &)

IMPORT_C TIntBoundedVal(TInt64 &aVal,
const TInt64 &aLimit
)

Parameters

TInt64 & aVal
const TInt64 & aLimit

BoundedVal(TUint32 &, TRadix, TUint)

IMPORT_C TIntBoundedVal(TUint32 &aVal,
TRadixaRadix,
TUintaLimit
)

Parameters

TUint32 & aVal
TRadix aRadix
TUint aLimit

BoundedVal(TInt64 &, TRadix, const TInt64 &)

IMPORT_C TIntBoundedVal(TInt64 &aVal,
TRadixaRadix,
const TInt64 &aLimit
)

Parameters

TInt64 & aVal
TRadix aRadix
const TInt64 & aLimit

Eos()

TBool Eos()const [inline]

Tests whether the next character position is at the end of the string.

True if at end of string, false otherwise.

Get()

IMPORT_C TCharGet()

Inc()

IMPORT_C voidInc()

Inc(TInt)

IMPORT_C voidInc(TIntaNumber)

Parameters

TInt aNumber

Mark(TLexMark8 &)

voidMark(TLexMark8 &aMark)const [inline]

Sets the supplied extraction mark to the TLex8's next character position.

Parameters

TLexMark8 & aMarkOn return, this is set to the next character position.

Mark()

voidMark()[inline]

Sets the TLex8's next character position to its extraction mark.

MarkedOffset()

TInt MarkedOffset()const [inline]

Gets the offset of the extraction mark from the start of the string.

The offset of the extraction mark.

MarkedOffset(const TLexMark8)

IMPORT_C TIntMarkedOffset(const TLexMark8aMark)const

Parameters

const TLexMark8 aMark

MarkedToken()

IMPORT_C TPtrC8MarkedToken()const

MarkedToken(const TLexMark8)

IMPORT_C TPtrC8MarkedToken(const TLexMark8aMark)const

Parameters

const TLexMark8 aMark

NextToken()

IMPORT_C TPtrC8NextToken()

Offset()

IMPORT_C TIntOffset()const

Peek()

IMPORT_C TCharPeek()const

Remainder()

IMPORT_C TPtrC8Remainder()const

RemainderFromMark()

IMPORT_C TPtrC8RemainderFromMark()const

RemainderFromMark(const TLexMark8)

IMPORT_C TPtrC8RemainderFromMark(const TLexMark8aMark)const

Parameters

const TLexMark8 aMark

Scndig(TInt &, TInt &, TUint64 &)

voidScndig(TInt &aSig,
TInt &aExp,
TUint64 &aDl
)[private]

Parameters

TInt & aSig
TInt & aExp
TUint64 & aDl

ScndigAfterPoint(TInt &, TUint64 &)

voidScndigAfterPoint(TInt &aSig,
TUint64 &aDl
)[private]

Parameters

TInt & aSig
TUint64 & aDl

SkipAndMark(TInt)

voidSkipAndMark(TIntaNumber)[inline]

Moves the next character position a specified number of characters.

panic

USER 61, if the skip moves the next character position either to before the start or beyond the end of the string.

Parameters

TInt aNumberNumber of characters to skip.

SkipAndMark(TInt, TLexMark8 &)

IMPORT_C voidSkipAndMark(TIntaNumber,
TLexMark8 &aMark
)

Parameters

TInt aNumber
TLexMark8 & aMark

SkipCharacters()

IMPORT_C voidSkipCharacters()

SkipSpace()

IMPORT_C voidSkipSpace()

SkipSpaceAndMark()

voidSkipSpaceAndMark()[inline]

Moves the next character position past any white space and copies it to the TLex8's extraction mark.

Stops if at the end of the string.

SkipSpaceAndMark(TLexMark8 &)

IMPORT_C voidSkipSpaceAndMark(TLexMark8 &aMark)

Parameters

TLexMark8 & aMark

TokenLength()

TInt TokenLength()const [inline]

Gets the length of the token.

This is the difference between the next character position and the extraction mark.

Length of the token.

TokenLength(const TLexMark8)

IMPORT_C TIntTokenLength(const TLexMark8aMark)const

Parameters

const TLexMark8 aMark

UnGet()

IMPORT_C voidUnGet()

UnGetToMark()

voidUnGetToMark()[inline]

Sets the next character position to the current extraction mark position.

panic

USER 63, if the extraction mark is before the start or beyond the end of the string.

UnGetToMark(const TLexMark8)

IMPORT_C voidUnGetToMark(const TLexMark8aMark)

Parameters

const TLexMark8 aMark

Val(TInt8 &)

IMPORT_C TIntVal(TInt8 &aVal)

Parameters

TInt8 & aVal

Val(TInt16 &)

IMPORT_C TIntVal(TInt16 &aVal)

Parameters

TInt16 & aVal

Val(TInt32 &)

IMPORT_C TIntVal(TInt32 &aVal)

Parameters

TInt32 & aVal

Val(TInt64 &)

IMPORT_C TIntVal(TInt64 &aVal)

Parameters

TInt64 & aVal

Val(TInt &)

TInt Val(TInt &aVal)[inline]

Parses the string to extract a signed integer.

KErrNone if successful. KErrGeneral if the next character position is initially at the end of the string or no valid characters found initially. KErrOverflow if there is sign overflow, i.e. converted value greater than limit. If error codes KErrGeneral or KErrOverflow are returned, the object's members are left unaltered.

Parameters

TInt & aValOn return, contains the extracted integer.

Val(TUint8 &, TRadix)

IMPORT_C TIntVal(TUint8 &aVal,
TRadixaRadix
)

Parameters

TUint8 & aVal
TRadix aRadix

Val(TUint16 &, TRadix)

IMPORT_C TIntVal(TUint16 &aVal,
TRadixaRadix
)

Parameters

TUint16 & aVal
TRadix aRadix

Val(TUint32 &, TRadix)

IMPORT_C TIntVal(TUint32 &aVal,
TRadixaRadix
)

Parameters

TUint32 & aVal
TRadix aRadix

Val(TInt64 &, TRadix)

IMPORT_C TIntVal(TInt64 &aVal,
TRadixaRadix
)

Parameters

TInt64 & aVal
TRadix aRadix

Val(TUint &, TRadix)

TInt Val(TUint &aVal,
TRadixaRadix = EDecimal
)[inline]

Parses the string to extract an unsigned integer, using the specified radix.

KErrNone if successful. KErrGeneral if the next character position is initially at the end of the string or no valid characters found initially. KErrOverflow if there is sign overflow, i.e. converted value greater than limit. If error codes KErrGeneral or KErrOverflow are returned, the object's members are left unaltered.

Parameters

TUint & aValOn return, contains the extracted integer.
TRadix aRadix = EDecimalThe radix to use when converting the number. The default radix for this function overload is decimal.

Val(TReal32 &)

IMPORT_C TIntVal(TReal32 &aVal)

Parameters

TReal32 & aVal

Val(TReal32 &, TChar)

IMPORT_C TIntVal(TReal32 &aVal,
TCharaPoint
)

Parameters

TReal32 & aVal
TChar aPoint

Val(TReal64 &)

IMPORT_C TIntVal(TReal64 &aVal)

Parameters

TReal64 & aVal

Val(TReal64 &, TChar)

IMPORT_C TIntVal(TReal64 &aVal,
TCharaPoint
)

Parameters

TReal64 & aVal
TChar aPoint

Val(TRealX &)

TInt Val(TRealX &aVal)

Parameters

TRealX & aVal

Val(TRealX &, TChar)

TInt Val(TRealX &aVal,
TCharaPoint
)

Parameters

TRealX & aVal
TChar aPoint

Val(TInt32 &, TInt)

TInt Val(TInt32 &aVal,
TIntaLimit
)[inline]

Parameters

TInt32 & aVal
TInt aLimit

Val(TInt64 &, const TInt64 &)

TInt Val(TInt64 &aVal,
const TInt64 &aLimit
)[inline]

Parameters

TInt64 & aVal
const TInt64 & aLimit

Val(TUint32 &, TRadix, TUint)

TInt Val(TUint32 &aVal,
TRadixaRadix,
TUintaLimit
)[inline]

Parameters

TUint32 & aVal
TRadix aRadix
TUint aLimit

Val(TInt64 &, TRadix, const TInt64 &)

TInt Val(TInt64 &aVal,
TRadixaRadix,
const TInt64 &aLimit
)[inline]

Parameters

TInt64 & aVal
TRadix aRadix
const TInt64 & aLimit

ValidateMark(const TLexMark8)

voidValidateMark(const TLexMark8aMark)const [private]

Parameters

const TLexMark8 aMark

operator=(const TUint8 *)

TLex8 &operator=(const TUint8 *aString)[inline]

Allows strings to be assigned to a TLex8.

TLex8 descriptor.

Parameters

const TUint8 * aStringString to be assigned to the TLex8.

operator=(const TDesC8 &)

TLex8 &operator=(const TDesC8 &aDes)[inline]

Allows descriptors to be assigned to a TLex8.

TLex8 descriptor.

Parameters

const TDesC8 & aDesDescriptor to be assigned to the TLex8.

Member Data Documentation

__DECLARE_TEST

__DECLARE_TEST[private]

const TUint8 * iBuf

const TUint8 *iBuf[private]

const TUint8 * iEnd

const TUint8 *iEnd[private]

TLexMark8 iMark

TLexMark8 iMark[private]

const TUint8 * iNext

const TUint8 *iNext[private]