#include <e32std.h>
Link against:
euser.lib
class TLex16;
Description
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.
Members
Defined in TLex16
:
Assign(const TDesC16 &)
Assigns a string to this object from a descriptor.
Assign(const TLex16 &)
Assigns a string to this object from another TLex16 object.
Assign(const TUint16 *)
Assigns a string to this object from another string.
BoundedVal(TInt32 &,TInt)
Parses the string to extract a 32-bit signed integer, and checks that it is with...
BoundedVal(TInt64 &,TRadix,const TInt64 &)
Parses the string to extract a 64-bit signed integer, using the specified radix,...
BoundedVal(TInt64 &,const TInt64 &)
Parses the string to extract a 64-bit signed integer, and checks that it is with...
BoundedVal(TUint32 &,TRadix,TUint)
Parses the string to extract a 32-bit unsigned integer, using the specified radi...
Eos()const
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.
Inc(TInt)
Increments the next character position by aNumber.
Mark()
Sets the TLex16's next character position to its extraction mark.
Mark(TLexMark16 &)const
Sets the supplied extraction mark to the TLex16's next character position.
MarkedOffset()const
Gets the offset of the extraction mark from the start of the string.
MarkedOffset(const TLexMark16)const
Gets the offset of the specified extraction mark from the start of the string.
MarkedToken()const
Extracts the marked token.
MarkedToken(const TLexMark16)const
Extracts the token, starting at the specified mark
NextToken()
Strips any white space and extracts the next token.
Offset()const
Gets the offset of the next character position from the start of the string.
Peek()const
Shows the next character to be returned by TLex16::Get().
Remainder()const
Gets a descriptor containing all the text from the next character position to th...
RemainderFromMark()const
Gets a descriptor containing all the text from the extraction mark to the end of...
RemainderFromMark(const TLexMark16)const
Gets a descriptor containing all the text from the specified extraction mark to ...
SkipAndMark(TInt)
Moves the next character position a specified number of characters.
SkipAndMark(TInt,TLexMark16 &)
Moves the next character position a specified number of characters and copies it...
SkipCharacters()
Moves the next character position to the next white space (space or separator).
SkipSpace()
Moves the next character position past any white space (space or separator).
SkipSpaceAndMark()
Moves the next character position past any white space and copies it to the TLex...
SkipSpaceAndMark(TLexMark16 &)
Moves the next character position past any white space and copies it to the spec...
TLex16()
Default cosntructor.
TLex16(const TDesC16 &)
Constructs the object with a descriptor.
TLex16(const TUint16 *)
Constructs the object with a pointer to a string.
TokenLength()const
Gets the length of the token.
TokenLength(const TLexMark16)const
Gets the length of the token starting at the specified extraction mark.
UnGet()
Decrements the next character position, allowing the previously "got" ...
UnGetToMark()
Sets the next character position to the current extraction mark position.
UnGetToMark(const TLexMark16)
Sets the next character position to the supplied extraction mark position.
Val(TInt &)
Parses the string to extract a signed integer.
Val(TInt16 &)
Parses the string to extract a signed 16-bit integer.
Val(TInt32 &)
Parses the string to extract a signed 32-bit integer.
Val(TInt32 &,TInt)
Val(TInt64 &)
Parses the string to extract a signed 64-bit integer.
Val(TInt64 &,TRadix)
Parses the string to extract a 64-bit integer (treated as unsigned), using the s...
Val(TInt64 &,TRadix,const TInt64 &)
Val(TInt64 &,const TInt64 &)
Val(TInt8 &)
Parses the string to extract a signed 8-bit integer.
Val(TReal32 &)
Val(TReal32 &,TChar)
Val(TReal64 &)
Val(TReal64 &,TChar)
Val(TUint &,TRadix)
Parses the string to extract an unsigned integer, using the specified radix.
Val(TUint16 &,TRadix)
Parses the string to extract a 16-bit unsigned integer, using the specified radi...
Val(TUint32 &,TRadix)
Parses the string to extract a 32-bit unsigned integer, using the specified radi...
Val(TUint32 &,TRadix,TUint)
Val(TUint8 &,TRadix)
Parses the string to extract an 8-bit unsigned integer, using the specified radi...
operator=(const TDesC16 &)
Allows descriptors to be assigned to a TLex16.
operator=(const TUint16 *)
Allows strings to be assigned to a TLex16.
See also:
Construction and destruction
IMPORT_C TLex16();
Description
Default cosntructor.
Constructs a TLex16, initialising its members to NULL.
inline TLex16(const TUint16 *aString);
Description
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.
|
|
inline TLex16(const TDesC16 &aDes);
Description
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.
|
|
operator=(const TUint16 *)
inline TLex16& operator=(const TUint16 *aString);
Description
Allows strings to be assigned to a TLex16.
Parameters
const TUint16 *aString |
String to be assigned to the TLex16.
|
|
Return value
operator=(const TDesC16 &)
inline TLex16& operator=(const TDesC16 &aDes);
Description
Allows descriptors to be assigned to a TLex16.
Parameters
const TDesC16 &aDes |
Descriptor to be assigned to the TLex16.
|
|
Return value
inline TBool Eos() const;
Description
Tests whether the next character position is at the end of the string.
Return value
TBool
|
True if at end of string, false otherwise.
|
|
inline void Mark();
Description
Sets the TLex16's next character position to its extraction mark.
inline void Mark(TLexMark16 &aMark) const;
Description
Sets the supplied extraction mark to the TLex16's next character position.
Parameters
TLexMark16 &aMark |
On return, set to the next character position.
|
|
IMPORT_C void Inc();
Description
Increments to the next character position.
Panic codes
USER |
65, if the increment puts the next character position before the start or beyond the end of the string.
|
|
IMPORT_C void Inc(TInt aNumber);
Description
Increments the next character position by aNumber.
Parameters
TInt aNumber |
The number of characters to increment the next character position by.
|
|
Panic codes
USER |
65, if the increment puts the next character position before the start or beyond the end of the string.
|
|
IMPORT_C TChar Get();
Description
Gets the next character in the string and increments the next character position.
Return value
TChar
|
Next character to be read. 0 if at the end of the string.
|
|
IMPORT_C TChar Peek() const;
Description
Shows the next character to be returned by TLex16::Get()
.
Return value
TChar
|
Character to be returned by the next call to TLex16::Get() . 0 if at the end of the string.
|
|
See also:
TLex16::Get()
Gets the next character in the string and increments the next character position...
IMPORT_C void UnGet();
Description
Decrements the next character position, allowing the previously "got" character to be re-read.
Panic codes
USER |
64, if the previous character is before the start of the string.
|
|
inline void UnGetToMark();
Description
Sets the next character position to the current extraction mark position.
Panic codes
USER |
68, if the specified mark is before the start or beyond the end of the string.
|
|
UnGetToMark(const TLexMark16)
IMPORT_C void UnGetToMark(const TLexMark16 aMark);
Description
Sets the next character position to the supplied extraction mark position.
Parameters
const TLexMark16 aMark |
Mark to copy to the next character position.
|
|
Panic codes
USER |
68, if the extraction mark is before the start or beyond the end of the string.
|
|
IMPORT_C void SkipSpace();
Description
Moves the next character position past any white space (space or separator).
Stops if at the end of string.
inline void SkipAndMark(TInt aNumber);
Description
Moves the next character position a specified number of characters.
Parameters
TInt aNumber |
Number of characters to skip.
|
|
Panic codes
USER |
68, if the skip moves the next character position either to before the start or beyond the end of the string.
|
|
SkipAndMark(TInt,TLexMark16 &)
IMPORT_C void SkipAndMark(TInt aNumber, TLexMark16 &aMark);
Description
Moves the next character position a specified number of characters and copies it to the specified extraction mark.
Parameters
TInt aNumber |
Number of characters to skip.
|
TLexMark16 &aMark |
On return, set to the next character position.
|
|
Panic codes
USER |
66, if the skip moves the next character position either to before the start or beyond the end of the string.
|
|
SkipSpaceAndMark(TLexMark16 &)
IMPORT_C void SkipSpaceAndMark(TLexMark16 &aMark);
Description
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.
|
|
inline void SkipSpaceAndMark();
Description
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.
IMPORT_C void SkipCharacters();
Description
Moves the next character position to the next white space (space or separator).
Stops if at the end of the string.
inline TInt TokenLength() const;
Description
Gets the length of the token.
This is the difference between the next character position and the extraction mark.
Return value
TInt
|
Length of the token.
|
|
TokenLength(const TLexMark16)const
IMPORT_C TInt TokenLength(const TLexMark16 aMark) const;
Description
Gets the length of the token starting at the specified extraction mark.
Parameters
const TLexMark16 aMark |
Extraction mark indicating the start of the token.
|
|
Return value
TInt
|
Length of the token.
|
|
Panic codes
USER |
68, if the specified mark is before the start or beyond the end of the string.
|
|
IMPORT_C TPtrC16 MarkedToken() const;
Description
Extracts the marked token.
Note that the function assumes that the current extraction mark is valid.
Return value
Panic codes
USER |
68, if the specified mark is before the start or beyond the end of the string.
|
|
MarkedToken(const TLexMark16)const
IMPORT_C TPtrC16 MarkedToken(const TLexMark16 aMark) const;
Description
Extracts the token, starting at the specified mark
Parameters
const TLexMark16 aMark |
Extraction mark indicating the start of the token.
|
|
Return value
Panic codes
USER |
68, if the specified mark is before the start or beyond the end of the string.
|
|
IMPORT_C TPtrC16 NextToken();
Description
Strips any white space and extracts the next token.
Return value
IMPORT_C TPtrC16 Remainder() const;
Description
Gets a descriptor containing all the text from the next character position to the end of the string.
Return value
TPtrC16
|
Text from the next character position onwards.
|
|
Panic codes
USER |
17, if the value of (next character position - extraction mark) is negative.
|
|
IMPORT_C TPtrC16 RemainderFromMark() const;
Description
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.
Return value
TPtrC16
|
Text from the extraction mark onwards.
|
|
RemainderFromMark(const TLexMark16)const
IMPORT_C TPtrC16 RemainderFromMark(const TLexMark16 aMark) const;
Description
Gets a descriptor containing all the text from the specified extraction mark to the end of the string.
Parameters
const TLexMark16 aMark |
Extraction mark indicating where remaining text starts.
|
|
Return value
TPtrC16
|
Text from the specified extraction mark onwards.
|
|
Panic codes
USER |
17, if the value of (next character position - extraction mark) is negative.
|
USER |
68, if the specified mark is before the start or beyond the end of the string.
|
|
IMPORT_C TInt Offset() const;
Description
Gets the offset of the next character position from the start of the string.
Return value
TInt
|
Offset of next character position.
|
|
inline TInt MarkedOffset() const;
Description
Gets the offset of the extraction mark from the start of the string.
Return value
TInt
|
The offset of the extraction mark.
|
|
MarkedOffset(const TLexMark16)const
IMPORT_C TInt MarkedOffset(const TLexMark16 aMark) const;
Description
Gets the offset of the specified extraction mark from the start of the string.
Parameters
Return value
TInt
|
The offset of the extraction mark.
|
|
Panic codes
USER |
68, if the specified mark is before the start or beyond the end of the string.
|
|
IMPORT_C TInt Val(TInt8 &aVal);
Description
Parses the string to extract a signed 8-bit integer.
Parameters
TInt8 &aVal |
On return, contains the extracted integer.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TInt16 &aVal);
Description
Parses the string to extract a signed 16-bit integer.
Parameters
TInt16 &aVal |
On return, contains the extracted integer.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TInt32 &aVal);
Description
Parses the string to extract a signed 32-bit integer.
Parameters
TInt32 &aVal |
On return, contains the extracted integer.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TInt64 &aVal);
Description
Parses the string to extract a signed 64-bit integer.
Parameters
TInt64 &aVal |
On return, contains the extracted integer.
|
|
Return value
TInt
|
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.
|
|
inline TInt Val(TInt &aVal);
Description
Parses the string to extract a signed integer.
Parameters
TInt &aVal |
On return, contains the extracted integer.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TUint8 &aVal, TRadix aRadix);
Description
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.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TUint16 &aVal, TRadix aRadix);
Description
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.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TUint32 &aVal, TRadix aRadix);
Description
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.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TInt64 &aVal, TRadix aRadix);
Description
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.
|
|
Return value
TInt
|
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.
|
|
inline TInt Val(TUint &aVal, TRadix aRadix=EDecimal);
Description
Parses the string to extract an unsigned integer, using the specified radix.
Parameters
TUint &aVal |
On return, contains the extracted integer.
|
TRadix aRadix |
The radix to use when converting the number. The default radix for this function overload is decimal.
|
|
Return value
TInt
|
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.
|
|
BoundedVal(TInt32 &,TInt)
IMPORT_C TInt BoundedVal(TInt32 &aVal, TInt aLimit);
Description
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.
|
|
Return value
TInt
|
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.
|
|
BoundedVal(TInt64 &,const TInt64 &)
IMPORT_C TInt BoundedVal(TInt64 &aVal, const TInt64 &aLimit);
Description
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.
|
|
Return value
TInt
|
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.
|
|
BoundedVal(TUint32 &,TRadix,TUint)
IMPORT_C TInt BoundedVal(TUint32 &aVal, TRadix aRadix, TUint aLimit);
Description
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.
|
|
Return value
TInt
|
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.
|
|
BoundedVal(TInt64 &,TRadix,const TInt64 &)
IMPORT_C TInt BoundedVal(TInt64 &aVal, TRadix aRadix, const TInt64 &aLimit);
Description
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.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Val(TReal32 &aVal);
Description
Parameters
Return value
IMPORT_C TInt Val(TReal32 &aVal, TChar aPoint);
Description
Parameters
Return value
IMPORT_C TInt Val(TReal64 &aVal);
Description
Parameters
Return value
IMPORT_C TInt Val(TReal64 &aVal, TChar aPoint);
Description
Parameters
Return value
inline void Assign(const TLex16 &aLex);
Description
Assigns a string to this object from another TLex16 object.
Parameters
const TLex16 &aLex |
The object to be assigned.
|
|
IMPORT_C void Assign(const TUint16 *aString);
Description
Assigns a string to this object from another string.
Parameters
const TUint16 *aString |
A pointer to a string to be assigned.
|
|
IMPORT_C void Assign(const TDesC16 &aDes);
Description
Assigns a string to this object from a descriptor.
Parameters
const TDesC16 &aDes |
The descriptor to be assigned.
|
|
Interface status: |
deprecated |
Use BoundedVal(TInt32& aVal,TInt aLimit) |
inline TInt Val(TInt32 &aVal, TInt aLimit);
Description
Parameters
Return value
Val(TInt64 &,const TInt64 &)
Interface status: |
deprecated |
Use BoundedVal(TInt64& aVal,const TInt64& aLimit) |
inline TInt Val(TInt64 &aVal, const TInt64 &aLimit);
Description
Parameters
Return value
Val(TUint32 &,TRadix,TUint)
Interface status: |
deprecated |
Use BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit) |
inline TInt Val(TUint32 &aVal, TRadix aRadix, TUint aLimit);
Description
Parameters
Return value
Val(TInt64 &,TRadix,const TInt64 &)
Interface status: |
deprecated |
Use BoundedVal(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) |
inline TInt Val(TInt64 &aVal, TRadix aRadix, const TInt64 &aLimit);
Description
Parameters
Return value