TDelimitedParserBase8 Class Reference

class TDelimitedParserBase8

Comments : Provides non-modifying functionality for parsing data delimited by a single character. The data is delimited into segments. Uses 8-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 TDesC8 &Des()
IMPORT_C TBoolEos()
IMPORT_C TBoolFrontDelimiter()
IMPORT_C TIntGetNext(TPtrC8 &)
IMPORT_C TIntInc()
IMPORT_C TIntPeek(TPtrC8 &)
IMPORT_C TIntRemainder(TPtrC8 &)
IMPORT_C voidReset()
Protected Member Functions
TDelimitedParserBase8()
IMPORT_C voidParse(const TDesC8 &)
IMPORT_C voidParseReverse(const TDesC8 &)
IMPORT_C voidSetDelimiter(TChar)
Private Member Functions
voidDoParse(const TDesC8 &)
TInt FindNextSegment(TInt)
TInt FindPrevSegment(TInt)
Private Attributes
TPtrC8 iCurrentSegment
TPtrC8 iDataDes
TInt iDelimiter
TDelimitedDataParseMode iMode
TInt iNextSegmentPos

Constructor & Destructor Documentation

TDelimitedParserBase8()

IMPORT_CTDelimitedParserBase8()[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 TDesC8 &Des()const

Retrieves the descriptor reference with the data

Since
6.0

DoParse(const TDesC8 &)

voidDoParse(const TDesC8 &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 TDesC8 & 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(TPtrC8 &)

IMPORT_C TIntGetNext(TPtrC8 &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

TPtrC8 & 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 TDesC8 &)

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

ParseReverse(const TDesC8 &)

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

Peek(TPtrC8 &)

IMPORT_C TIntPeek(TPtrC8 &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

TPtrC8 & aSegmentThis is an output argument that is set to the current segment.

Remainder(TPtrC8 &)

IMPORT_C TIntRemainder(TPtrC8 &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

TPtrC8 & 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

TPtrC8 iCurrentSegment

TPtrC8 iCurrentSegment[private]

Descriptor with the current segment.

TPtrC8 iDataDes

TPtrC8 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.