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.
Public Member Functions | |
---|---|
TLex8 () | |
TLex8 (const TUint8 *) | |
TLex8 (const TDesC8 &) | |
void | Assign (const TLex8 &) |
IMPORT_C void | Assign (const TUint8 *) |
IMPORT_C void | Assign (const TDesC8 &) |
IMPORT_C TInt | BoundedVal ( TInt32 &, TInt ) |
IMPORT_C TInt | BoundedVal ( TInt64 &, const TInt64 &) |
IMPORT_C TInt | BoundedVal ( TUint32 &, TRadix , TUint ) |
IMPORT_C TInt | BoundedVal ( TInt64 &, TRadix , const TInt64 &) |
TBool | Eos () |
IMPORT_C TChar | Get () |
IMPORT_C void | Inc () |
IMPORT_C void | Inc ( TInt ) |
void | Mark ( TLexMark8 &) |
void | Mark () |
TInt | MarkedOffset () |
IMPORT_C TInt | MarkedOffset (const TLexMark8 ) |
IMPORT_C TPtrC8 | MarkedToken () |
IMPORT_C TPtrC8 | MarkedToken (const TLexMark8 ) |
IMPORT_C TPtrC8 | NextToken () |
IMPORT_C TInt | Offset () |
IMPORT_C TChar | Peek () |
IMPORT_C TPtrC8 | Remainder () |
IMPORT_C TPtrC8 | RemainderFromMark () |
IMPORT_C TPtrC8 | RemainderFromMark (const TLexMark8 ) |
void | SkipAndMark ( TInt ) |
IMPORT_C void | SkipAndMark ( TInt , TLexMark8 &) |
IMPORT_C void | SkipCharacters () |
IMPORT_C void | SkipSpace () |
void | SkipSpaceAndMark () |
IMPORT_C void | SkipSpaceAndMark ( TLexMark8 &) |
TInt | TokenLength () |
IMPORT_C TInt | TokenLength (const TLexMark8 ) |
IMPORT_C void | UnGet () |
void | UnGetToMark () |
IMPORT_C void | UnGetToMark (const TLexMark8 ) |
IMPORT_C TInt | Val ( TInt8 &) |
IMPORT_C TInt | Val ( TInt16 &) |
IMPORT_C TInt | Val ( TInt32 &) |
IMPORT_C TInt | Val ( TInt64 &) |
TInt | Val ( TInt &) |
IMPORT_C TInt | Val ( TUint8 &, TRadix ) |
IMPORT_C TInt | Val ( TUint16 &, TRadix ) |
IMPORT_C TInt | Val ( TUint32 &, TRadix ) |
IMPORT_C TInt | Val ( TInt64 &, TRadix ) |
TInt | Val ( TUint &, TRadix ) |
IMPORT_C TInt | Val ( TReal32 &) |
IMPORT_C TInt | Val ( TReal32 &, TChar ) |
IMPORT_C TInt | Val ( TReal64 &) |
IMPORT_C TInt | Val ( 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 | |
---|---|
void | Scndig ( TInt &, TInt &, TUint64 &) |
void | ScndigAfterPoint ( TInt &, TUint64 &) |
void | ValidateMark (const TLexMark8 ) |
Private Attributes | |
---|---|
__DECLARE_TEST | |
const TUint8 * | iBuf |
const TUint8 * | iEnd |
TLexMark8 | iMark |
const TUint8 * | iNext |
IMPORT_C | TLex8 | ( | ) |
Default constructor.
Constructs a TLex8 , initialising its members to NULL.
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.
const TUint8 * aString | String to be assigned. |
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.
const TDesC8 & aDes | Descriptor to be assigned by reference. |
void | Assign | ( | const TLex8 & | aLex | ) | [inline] |
Assigns a string to this object from another TLex8 object.
const TLex8 & aLex | The object to be assigned. |
IMPORT_C void | Assign | ( | const TUint8 * | aString | ) |
Assigns a string to this object from another string.
const TUint8 * aString | A pointer to a string to be assigned. |
IMPORT_C void | Assign | ( | const TDesC8 & | aDes | ) |
Assigns a string to this object from a descriptor.
const TDesC8 & aDes | The descriptor to be assigned. |
IMPORT_C TInt | BoundedVal | ( | TInt32 & | aVal, |
TInt | aLimit | |||
) |
Parses the string to extract a 32-bit signed integer, and checks that it is within the specified limit.
IMPORT_C TInt | BoundedVal | ( | TInt64 & | aVal, |
const TInt64 & | aLimit | |||
) |
Parses the string to extract a 64-bit signed integer, and checks that it is within the specified limit.
IMPORT_C TInt | BoundedVal | ( | TUint32 & | aVal, |
TRadix | aRadix, | |||
TUint | aLimit | |||
) |
Parses the string to extract a 32-bit unsigned integer, using the specified radix, and checks that it is within the specified limit.
The specified radix is one of binary, octal, decimal, or hexadecimal.
IMPORT_C TInt | BoundedVal | ( | TInt64 & | aVal, |
TRadix | aRadix, | |||
const TInt64 & | aLimit | |||
) |
Parses the string to extract a 64-bit signed integer, using the specified radix, and checks that it is within the specified limit.
The specified radix is one of binary, octal, decimal, or hexadecimal.
TBool | Eos | ( | ) | const [inline] |
Tests whether the next character position is at the end of the string.
IMPORT_C TChar | Get | ( | ) |
Gets the next character in the string, and increments the next character position.
IMPORT_C void | Inc | ( | ) |
Increments to the next character position.
IMPORT_C void | Inc | ( | TInt | aNumber | ) |
Increments the next character position by aNumber.
TInt aNumber | The number of characters to increment the next character position by. |
void | Mark | ( | TLexMark8 & | aMark | ) | const [inline] |
Sets the supplied extraction mark to the TLex8's next character position.
TLexMark8 & aMark | On return, this is set to the next character position. |
TInt | MarkedOffset | ( | ) | const [inline] |
Gets the offset of the extraction mark from the start of the string.
IMPORT_C TInt | MarkedOffset | ( | const TLexMark8 | aMark | ) | const |
Gets the offset of the specified extraction mark from the start of the string.
const TLexMark8 aMark | Extraction mark. |
IMPORT_C TPtrC8 | MarkedToken | ( | ) | const |
Extracts the marked token.
Note that the function assumes that the current extraction mark is valid.
IMPORT_C TPtrC8 | MarkedToken | ( | const TLexMark8 | aMark | ) | const |
Extracts the token, starting at the specified mark
const TLexMark8 aMark | Extraction mark indicating the start of the token. |
IMPORT_C TInt | Offset | ( | ) | const |
Gets the offset of the next character position from the start of the string.
IMPORT_C TPtrC8 | Remainder | ( | ) | const |
Gets a descriptor containing all the text from the next character position to the end of the string.
IMPORT_C TPtrC8 | RemainderFromMark | ( | ) | const |
Gets a descriptor containing all the text from the current extraction mark to the end of the string.
The function assumes that the current extraction mark is valid.
IMPORT_C TPtrC8 | RemainderFromMark | ( | const TLexMark8 | aMark | ) | const |
Gets a descriptor containing all the text from the specified extraction mark to the end of the string.
const TLexMark8 aMark | Extraction mark indicating where remaining text starts. |
void | SkipAndMark | ( | TInt | aNumber | ) | [inline] |
Moves the next character position a specified number of characters.
TInt aNumber | Number of characters to skip. |
IMPORT_C void | SkipAndMark | ( | TInt | aNumber, |
TLexMark8 & | aMark | |||
) |
Moves the next character position a specified number of characters and copies it to the specified extraction mark.
IMPORT_C void | SkipCharacters | ( | ) |
Moves the next character position to the next white space (space or separator).
Stops if at the end of the string.
IMPORT_C void | SkipSpace | ( | ) |
Moves the next character position past any white space (space or separator).
Stops if at the end of string.
void | SkipSpaceAndMark | ( | ) | [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.
IMPORT_C void | SkipSpaceAndMark | ( | TLexMark8 & | aMark | ) |
Moves the next character position past any white space and copies it to the specified extraction mark.
Stops if at the end of the string.
TLexMark8 & aMark | On return, contains a reference to the next character position. |
TInt | TokenLength | ( | ) | const [inline] |
Gets the length of the token.
This is the difference between the next character position and the extraction mark.
IMPORT_C TInt | TokenLength | ( | const TLexMark8 | aMark | ) | const |
Gets the length of the token starting at the specified extraction mark.
const TLexMark8 aMark | Extraction mark indicating the start of the token. |
IMPORT_C void | UnGet | ( | ) |
Decrements the next character position, allowing a previously "got" character to be re-read.
void | UnGetToMark | ( | ) | [inline] |
Sets the next character position to the current extraction mark position.
IMPORT_C void | UnGetToMark | ( | const TLexMark8 | aMark | ) |
Sets the next character position to the supplied extraction mark position.
const TLexMark8 aMark | Mark to copy to the next character position. |
IMPORT_C TInt | Val | ( | TInt8 & | aVal | ) |
Parses the string to extract a signed 8-bit integer.
TInt8 & aVal | On return, contains the extracted integer. |
IMPORT_C TInt | Val | ( | TInt16 & | aVal | ) |
Parses the string to extract a signed 16-bit integer.
TInt16 & aVal | On return, contains the extracted integer. |
IMPORT_C TInt | Val | ( | TInt32 & | aVal | ) |
Parses the string to extract a signed 32-bit integer.
TInt32 & aVal | On return, contains the extracted integer. |
IMPORT_C TInt | Val | ( | TInt64 & | aVal | ) |
Parses the string to extract a signed 64-bit integer.
TInt64 & aVal | On return, contains the extracted integer. |
TInt | Val | ( | TInt & | aVal | ) | [inline] |
Parses the string to extract a signed integer.
TInt & aVal | On return, contains the extracted integer. |
IMPORT_C TInt | Val | ( | TUint8 & | aVal, |
TRadix | aRadix | |||
) |
Parses the string to extract an 8-bit unsigned integer, using the specified radix.
The specified radix is one of binary, octal, decimal, or hexadecimal.
IMPORT_C TInt | Val | ( | TUint16 & | aVal, |
TRadix | aRadix | |||
) |
Parses the string to extract a 16-bit unsigned integer, using the specified radix.
The specified radix is one of binary, octal, decimal, or hexadecimal.
IMPORT_C TInt | Val | ( | TUint32 & | aVal, |
TRadix | aRadix | |||
) |
Parses the string to extract a 32-bit unsigned integer, using the specified radix.
The specified radix is one of binary, octal, decimal, or hexadecimal.
IMPORT_C TInt | Val | ( | TInt64 & | aVal, |
TRadix | aRadix | |||
) |
Parses the string to extract a 64-bit integer (treated as unsigned), using the specified radix.
The specified radix is one of binary, octal, decimal, or hexadecimal.
TInt | Val | ( | TUint & | aVal, |
TRadix | aRadix = EDecimal | |||
) | [inline] |
Parses the string to extract an unsigned integer, using the specified radix.
TInt | Val | ( | TInt64 & | aVal, |
TRadix | aRadix, | |||
const TInt64 & | aLimit | |||
) | [inline] |
void | ValidateMark | ( | const TLexMark8 | aMark | ) | const [private] |
const TLexMark8 aMark |
TLex8 & | operator= | ( | const TUint8 * | aString | ) | [inline] |
Allows strings to be assigned to a TLex8 .
const TUint8 * aString | String to be assigned to the TLex8. |
TLex8 & | operator= | ( | const TDesC8 & | aDes | ) | [inline] |
Allows descriptors to be assigned to a TLex8 .
const TDesC8 & aDes | Descriptor to be assigned to the TLex8. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.