TDelimitedParserBase16 Class Reference

#include <delimitedparser16.h>

class TDelimitedParserBase16
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)

Detailed Description

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_CTDelimitedParserBase16()[protected]

Constructor.

Since
6.0

Member Function 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().
Return Value
A boolean of value ETrue if there is a back delimiter, or EFalse if there is no back delimiter.

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.
Return Value
A error value of KErrNotFound if the current segment is the initial segment. The value KErrNone if the data has been parsed to the previous segment.

Des ( )

IMPORT_C const TDesC16 &Des()const

Retrieves the descriptor reference with the data

Since
6.0
Return Value
A const 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().
Return Value
A boolean value of ETrue if the end of the data has been reached, or EFalse if there are more segements to parse.

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().
Return Value
A boolean of value ETrue if there is a front delimiter, or EFalse if there is no front delimiter.

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
aSegmentThis is an output argument that is set to the current segment.
Return Value
A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a 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.
Return Value
A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a current segment.

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
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
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
aSegmentThis is an output argument that is set to the current segment.
Return Value
A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a 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
aRemainderThis is an output argument that is set to the remaining data.
Return Value
An error value of KErrNotFound if there is no remaining data, or value of KErrNone if there is 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
aDelimiterThe delimiting character.