TLex16 Class Reference
Provides general string-parsing functions suitable for numeric format conversions and syntactical-element parsing.
The class is the 16-bit variant for Unicode strings and 16-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 |
---|
| TLex16() |
| TLex16(const TUint16 *) |
| TLex16(const TDesC16 &) |
void | Assign(const TLex16 &) |
IMPORT_C void | Assign(const TUint16 *) |
IMPORT_C void | Assign(const TDesC16 &) |
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() |
void | Mark(TLexMark16 &) |
TInt
| MarkedOffset() |
IMPORT_C TInt | MarkedOffset(const TLexMark16) |
IMPORT_C TPtrC16 | MarkedToken() |
IMPORT_C TPtrC16 | MarkedToken(const TLexMark16) |
IMPORT_C TPtrC16 | NextToken() |
IMPORT_C TInt | Offset() |
IMPORT_C TChar | Peek() |
IMPORT_C TPtrC16 | Remainder() |
IMPORT_C TPtrC16 | RemainderFromMark() |
IMPORT_C TPtrC16 | RemainderFromMark(const TLexMark16) |
void | SkipAndMark(TInt) |
IMPORT_C void | SkipAndMark(TInt, TLexMark16 &) |
IMPORT_C void | SkipCharacters() |
IMPORT_C void | SkipSpace() |
IMPORT_C void | SkipSpaceAndMark(TLexMark16 &) |
void | SkipSpaceAndMark() |
TInt
| TokenLength() |
IMPORT_C TInt | TokenLength(const TLexMark16) |
IMPORT_C void | UnGet() |
void | UnGetToMark() |
IMPORT_C void | UnGetToMark(const TLexMark16) |
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 &) |
TLex16 & | operator=(const TUint16 *) |
TLex16 & | operator=(const TDesC16 &) |
Constructor & Destructor Documentation
TLex16()
Default cosntructor.
Constructs a TLex16, initialising its members to NULL.
TLex16(const TUint16 *)
TLex16 | ( | const TUint16 * | 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 TUint16 * aString | String to be assigned. |
TLex16(const TDesC16 &)
TLex16 | ( | const TDesC16 & | 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 TDesC16 & aDes | Descriptor to be assigned by reference. |
Member Functions Documentation
Assign(const TLex16 &)
void | Assign | ( | const TLex16 & | aLex | ) | [inline] |
Assigns a string to this object from another TLex16 object.
Parameters
const TLex16 & aLex | The object to be assigned. |
Assign(const TUint16 *)
IMPORT_C void | Assign | ( | const TUint16 * | aString | ) | |
Assigns a string to this object from another string.
Parameters
const TUint16 * aString | A pointer to a string to be assigned. |
Assign(const TDesC16 &)
IMPORT_C void | Assign | ( | const TDesC16 & | aDes | ) | |
Assigns a string to this object from a descriptor.
Parameters
const TDesC16 & aDes | The descriptor to be assigned. |
BoundedVal(TInt32 &, TInt)
Parses the string to extract a 32-bit signed integer, and checks that it is within the specified limit.
Parameters
TInt32 & aVal | On return, contains the extracted integer. |
TInt aLimit | The upper limit. |
BoundedVal(TInt64 &, const TInt64 &)
Parses the string to extract a 64-bit signed integer, and checks that it is within the specified limit.
Parameters
TInt64 & aVal | On return, contains the extracted integer. |
const TInt64 & aLimit | The upper limit. |
BoundedVal(TUint32 &, TRadix, TUint)
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.
Parameters
TUint32 & aVal | On return, contains the extracted integer. |
TRadix aRadix | The radix to use when converting the number. |
TUint aLimit | The upper limit. |
BoundedVal(TInt64 &, TRadix, const TInt64 &)
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.
Parameters
TInt64 & aVal | On return, contains the extracted integer. |
TRadix aRadix | The radix to use when converting the number. |
const TInt64 & aLimit | The upper limit. |
Eos()
TBool
| Eos | ( | ) | const [inline] |
Tests whether the next character position is at the end of the string.
Get()
Gets the next character in the string and increments the next character position.
Inc()
Increments to the next character position.
-
panic
- USER 65, if the increment puts the next character position before the start or beyond the end of the string.
Inc(TInt)
IMPORT_C void | Inc | ( | TInt | aNumber | ) | |
Increments the next character position by aNumber.
-
panic
- USER 65, if the increment puts the next character position before the start or beyond the end of the string.
Parameters
TInt aNumber | The number of characters to increment the next character position by. |
Mark()
Sets the TLex16's next character position to its extraction mark.
Mark(TLexMark16 &)
Sets the supplied extraction mark to the TLex16's next character position.
Parameters
TLexMark16 & aMark | On return, set to the next character position. |
MarkedOffset()
TInt
| MarkedOffset | ( | ) | const [inline] |
Gets the offset of the extraction mark from the start of the string.
MarkedOffset(const TLexMark16)
Gets the offset of the specified extraction mark from the start of the string.
-
panic
- USER 68, if the specified mark is before the start or beyond the end of the string.
MarkedToken()
Extracts the marked token.
Note that the function assumes that the current extraction mark is valid.
-
panic
- USER 68, if the specified mark is before the start or beyond the end of the string.
MarkedToken(const TLexMark16)
Extracts the token, starting at the specified mark
-
panic
- USER 68, if the specified mark is before the start or beyond the end of the string.
Parameters
const TLexMark16 aMark | Extraction mark indicating the start of the token. |
NextToken()
Strips any white space and extracts the next token.
Offset()
IMPORT_C TInt | Offset | ( | ) | const |
Gets the offset of the next character position from the start of the string.
Peek()
IMPORT_C TChar | Peek | ( | ) | const |
Remainder()
Gets a descriptor containing all the text from the next character position to the end of the string.
-
panic
- USER 17, if the value of (next character position - extraction mark) is negative.
RemainderFromMark()
IMPORT_C TPtrC16 | RemainderFromMark | ( | ) | const |
Gets a descriptor containing all the text from the extraction mark to the end of the string.
The function assumes that the current extraction mark is valid.
RemainderFromMark(const TLexMark16)
Gets a descriptor containing all the text from the specified extraction mark to the end of the string.
-
panic
- USER 17, if the value of (next character position - extraction mark) is negative.
-
panic
- USER 68, if the specified mark is before the start or beyond the end of the string.
Parameters
const TLexMark16 aMark | Extraction mark indicating where remaining text starts. |
Scndig(TInt &, TInt &, TUint64 &)
SkipAndMark(TInt)
void | SkipAndMark | ( | TInt | aNumber | ) | [inline] |
Moves the next character position a specified number of characters.
-
panic
- USER 68, if the skip moves the next character position either to before the start or beyond the end of the string.
Parameters
TInt aNumber | Number of characters to skip. |
SkipAndMark(TInt, TLexMark16 &)
Moves the next character position a specified number of characters and copies it to the specified extraction mark.
-
panic
- USER 66, if the skip moves the next character position either to before the start or beyond the end of the string.
Parameters
TInt aNumber | Number of characters to skip. |
TLexMark16 & aMark | On return, set to the next character position. |
SkipCharacters()
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.
SkipSpace()
Moves the next character position past any white space (space or separator).
Stops if at the end of string.
SkipSpaceAndMark(TLexMark16 &)
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.
Parameters
TLexMark16 & aMark | On return, contains a reference to the next character position. |
SkipSpaceAndMark()
void | SkipSpaceAndMark | ( | ) | [inline] |
Moves the next character position past any white space and copies it to the TLex16's extraction mark.
Stops if at the end of the string.
TokenLength()
TInt
| TokenLength | ( | ) | const [inline] |
Gets the length of the token.
This is the difference between the next character position and the extraction mark.
TokenLength(const TLexMark16)
Gets the length of the token starting at the specified extraction mark.
-
panic
- USER 68, if the specified mark is before the start or beyond the end of the string.
Parameters
const TLexMark16 aMark | Extraction mark indicating the start of the token. |
UnGet()
Decrements the next character position, allowing the previously "got" character to be re-read.
-
panic
- USER 64, if the previous character is before the start of the string.
UnGetToMark()
void | UnGetToMark | ( | ) | [inline] |
Sets the next character position to the current extraction mark position.
-
panic
- USER 68, if the specified mark is before the start or beyond the end of the string.
UnGetToMark(const TLexMark16)
Sets the next character position to the supplied extraction mark position.
-
panic
- USER 68, if the extraction mark is before the start or beyond the end of the string.
Parameters
const TLexMark16 aMark | Mark to copy to the next character position. |
Val(TInt8 &)
Parses the string to extract a signed 8-bit integer.
Parameters
TInt8 & aVal | On return, contains the extracted integer. |
Val(TInt16 &)
Parses the string to extract a signed 16-bit integer.
Parameters
TInt16 & aVal | On return, contains the extracted integer. |
Val(TInt32 &)
Parses the string to extract a signed 32-bit integer.
Parameters
TInt32 & aVal | On return, contains the extracted integer. |
Val(TInt64 &)
Parses the string to extract a signed 64-bit integer.
Parameters
TInt64 & aVal | On return, contains the extracted integer. |
Val(TInt &)
Parses the string to extract a signed integer.
Parameters
TInt & aVal | On return, contains the extracted integer. |
Val(TUint8 &, TRadix)
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.
Parameters
TUint8 & aVal | On return, contains the extracted integer. |
TRadix aRadix | The radix to use when converting the number. |
Val(TUint16 &, TRadix)
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.
Parameters
TUint16 & aVal | On return, contains the extracted integer. |
TRadix aRadix | The radix to use when converting the number. |
Val(TUint32 &, TRadix)
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.
Parameters
TUint32 & aVal | On return, contains the extracted integer. |
TRadix aRadix | The radix to use when converting the number. |
Val(TInt64 &, TRadix)
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.
Parameters
TInt64 & aVal | On return, contains the extracted integer. |
TRadix aRadix | The radix to use when converting the number. |
Val(TUint &, TRadix)
Parses the string to extract an unsigned integer, using the specified radix.
Parameters
TUint & aVal | On return, contains the extracted integer. |
TRadix aRadix = EDecimal | The radix to use when converting the number. The default radix for this function overload is decimal. |
Val(TInt64 &, const TInt64 &)
Val(TUint32 &, TRadix, TUint)
Val(TInt64 &, TRadix, const TInt64 &)
ValidateMark(const TLexMark16)
void | ValidateMark | ( | const TLexMark16 | aMark | ) | const [private] |
operator=(const TUint16 *)
Allows strings to be assigned to a TLex16.
Parameters
const TUint16 * aString | String to be assigned to the TLex16. |
operator=(const TDesC16 &)
Allows descriptors to be assigned to a TLex16.
Parameters
const TDesC16 & aDes | Descriptor to be assigned to the TLex16. |
Member Data Documentation
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.