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
Public Member Functions
IMPORT_C TBoolBackDelimiter()
IMPORT_C TIntDec()
IMPORT_C const TDesC16 &Des()
IMPORT_C TBoolEos()
IMPORT_C TBoolFrontDelimiter()
IMPORT_C TIntGetNext(TPtrC16 &)
IMPORT_C TIntInc()
IMPORT_C TIntPeek(TPtrC16 &)
IMPORT_C TIntRemainder(TPtrC16 &)
IMPORT_C voidReset()
Protected Member Functions
TDelimitedParserBase16()
IMPORT_C voidParse(const TDesC16 &)
IMPORT_C voidParseReverse(const TDesC16 &)
IMPORT_C voidSetDelimiter(TChar)
Private Member Functions
voidDoParse(const TDesC16 &)
TInt FindNextSegment(TInt)
TInt FindPrevSegment(TInt)
Private Attributes
TPtrC16 iCurrentSegment
TPtrC16 iDataDes
TInt iDelimiter
TDelimitedDataParseMode iMode
TInt iNextSegmentPos

Constructor & Destructor Documentation

TDelimitedParserBase16()

IMPORT_CTDelimitedParserBase16()[protected]

Constructor.

Since
6.0

Member Functions Documentation

BackDelimiter()

IMPORT_C TBoolBackDelimiter()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 TIntDec()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 &)

voidDoParse(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 & aDataA descriptor reference with the data.

Eos()

IMPORT_C TBoolEos()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(TIntaStartPos)const [private]

Finds the next segment from the given start position.

Since
6.0

Parameters

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

FindPrevSegment(TInt)

TInt FindPrevSegment(TIntaStartPos)const [private]

Finds the previous segment from the given start position.

Since
6.0

Parameters

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

FrontDelimiter()

IMPORT_C TBoolFrontDelimiter()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 TIntGetNext(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 & aSegmentThis is an output argument that is set to the current segment.

Inc()

IMPORT_C TIntInc()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 voidParse(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 & aDataA descriptor containing the data.

ParseReverse(const TDesC16 &)

IMPORT_C voidParseReverse(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 & aDataA descriptor containing the data.

Peek(TPtrC16 &)

IMPORT_C TIntPeek(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 & aSegmentThis is an output argument that is set to the current segment.

Remainder(TPtrC16 &)

IMPORT_C TIntRemainder(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 & aRemainderThis is an output argument that is set to the remaining data.

Reset()

IMPORT_C voidReset()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 voidSetDelimiter(TCharaDelimiter)[protected]

Sets the delimiting character.

Since
6.0
Post-condition
The delimiting character is set.

Parameters

TChar aDelimiterThe 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.