TDelimitedParserBase16 Class Reference

class TDelimitedParserBase16

Comments : Provides non-modifying functionality for parsing data delimited by a single character. The data is delimited into segments. Uses 16-bit descriptors.

The object contains a descriptor with the data which can be parsed from left to right, or right to left. It is non-owning. The current segment can be extracted, which then parses the string for the next segment.

This is a base class and an object of this type cannot be instantiated. It should be derived. The derived class should ensure that the data iDataDes is set before calling one of the protected parsing functions. The derived class should also ensure that the delimiting character has been set.

If the data iDataDes has not been parsed, then calling any functionality that requires the data to have been parsed will result in a panic KDelimitedParserErrNotParsed. The data can only be parsed by calling one of the protected parsing functions from the derived class.

If the delimiting character iDelimiter has not been set, then calling the protected parsing functions and some of the other public functionality that requires the delimiter to be set will result in a panic KDelimitingParserErrNoDelimiter.
Since
6.0

Constructor & Destructor Documentation

TDelimitedParserBase16()

IMPORT_C TDelimitedParserBase16 ( ) [protected]

Constructor.

Since
6.0

Member Functions Documentation

BackDelimiter()

IMPORT_C TBool BackDelimiter ( ) const

Checks for a delimiter at the back (right) of the data.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .

Dec()

IMPORT_C TInt Dec ( ) const

Parses back to the previous segment.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .
Post-condition
If the parse was successful then the current segment is updated to the previous one. Otherwise there is no change.

Des()

IMPORT_C const TDesC16 & Des ( ) const

Retrieves the descriptor reference with the data

Since
6.0

DoParse(const TDesC16 &)

void DoParse ( const TDesC16 & aData ) [private]

Initialises the parsing of the data.

Since
6.0
Pre-condition
The delimiting character has been set.
Post-condition
The data descriptor is set to the input argument. The current segment refers to the initial segment of the data.

Parameters

const TDesC16 & aData A descriptor reference with the data.

Eos()

IMPORT_C TBool Eos ( ) const

Indicates whether the end of the data has been reached and there are no more segments to parse.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .

FindNextSegment(TInt)

TInt FindNextSegment ( TInt aStartPos ) const [private]

Finds the next segment from the given start position.

Since
6.0

Parameters

TInt aStartPos The position from where to start the search for the next segment.

FindPrevSegment(TInt)

TInt FindPrevSegment ( TInt aStartPos ) const [private]

Finds the previous segment from the given start position.

Since
6.0

Parameters

TInt aStartPos The position from where to start the search for the previous segment.

FrontDelimiter()

IMPORT_C TBool FrontDelimiter ( ) const

Checks for a delimiter at the front (left) of the data.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .

GetNext(TPtrC16 &)

IMPORT_C TInt GetNext ( TPtrC16 & aSegment ) const

Retrieves the current segment and then parses the data to the next one.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .
Post-condition
The current segment is updated to the next one.

Parameters

TPtrC16 & aSegment This is an output argument that is set to the current segment.

Inc()

IMPORT_C TInt Inc ( ) const

Parses to the next segment.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .
Post-condition
The current segment is updated to the next one.

Parse(const TDesC16 &)

IMPORT_C void Parse ( const TDesC16 & aData ) [protected]

This parses the data into segments from left to right.

CAUTION:

There will be a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The delimiter must have been set.
Post-condition
The current segment is the leftmost segment and the direction of parsing is set from left to right (EDelimitedDataFroward).

Parameters

const TDesC16 & aData A descriptor containing the data.

ParseReverse(const TDesC16 &)

IMPORT_C void ParseReverse ( const TDesC16 & aData ) [protected]

This parses the data into segments from lright to left.

CAUTION:

There will be a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The delimiter must have been set.
Post-condition
The current segment is the leftmost segment and the direction of parsing is set from right to left (EDelimitedDataReverse).

Parameters

const TDesC16 & aData A descriptor containing the data.

Peek(TPtrC16 &)

IMPORT_C TInt Peek ( TPtrC16 & aSegment ) const

Retrieves the current segment.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The string must have been initially parsed by Parse() or ParseReverse() .

Parameters

TPtrC16 & aSegment This is an output argument that is set to the current segment.

Remainder(TPtrC16 &)

IMPORT_C TInt Remainder ( TPtrC16 & aRemainder ) const

Gives the remainder of the data from (and including) the current segment. Any other segments that have parsed through are not included.

CAUTION:

There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.

Since
6.0
Pre-condition
The data must have been initially parsed by Parse() or ParseReverse() .

Parameters

TPtrC16 & aRemainder This is an output argument that is set to the remaining data.

Reset()

IMPORT_C void Reset ( ) const

Resets the internal pointer position to the start or end or the descriptor depending on whether the decriptor is parsing mode.

CAUTION:

There will be a KUriUtilsErrBadDelimitedParserMode panic if the data mode has not been correctly set.

SetDelimiter(TChar)

IMPORT_C void SetDelimiter ( TChar aDelimiter ) [protected]

Sets the delimiting character.

Since
6.0
Post-condition
The delimiting character is set.

Parameters

TChar aDelimiter The delimiting character.

Member Data Documentation

TPtrC16 iCurrentSegment

TPtrC16 iCurrentSegment [private]

Descriptor with the current segment.

TPtrC16 iDataDes

TPtrC16 iDataDes [private]

Descriptor with the string

TInt iDelimiter

TInt iDelimiter [private]

Delimiting character

TDelimitedDataParseMode iMode

TDelimitedDataParseMode iMode [private]

Direction of parsing.

TInt iNextSegmentPos

TInt iNextSegmentPos [private]

Position of next segment.