Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: DelimitedParser8.h
Link against: inetprotutil.lib

Class TDelimitedParserBase8

class TDelimitedParserBase8;

Description

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.

Members

Defined in TDelimitedParserBase8:
BackDelimiter(), Dec(), Des(), Eos(), FrontDelimiter(), GetNext(), Inc(), Parse(), ParseReverse(), Peek(), Remainder(), SetDelimiter(), TDelimitedParserBase8()


Construction and destruction


TDelimitedParserBase8()

protected: IMPORT_C TDelimitedParserBase8();

Description

Constructor.

[Top]


Member functions


GetNext()

IMPORT_C TInt GetNext(TPtrC8 &aSegment) const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

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

Post-Condition

The current segment is updated to the next one.

Parameters

TPtrC8 &aSegment

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

Return value

TInt

A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a current segment.


Inc()

IMPORT_C TInt Inc() const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

Parses to the next segment.

Post-Condition

The current segment is updated to the next one.

Return value

TInt

A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a current segment.


Dec()

IMPORT_C TInt Dec() const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

Parses back to the previous segment.

Post-Condition

If the parse was successful then the current segment is updated to the previous one. Otherwise there is no change.

Return value

TInt

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.


Peek()

IMPORT_C TInt Peek(TPtrC8 &aSegment) const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

Retrieves the current segment.

Parameters

TPtrC8 &aSegment

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

Return value

TInt

A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a current segment.


Eos()

IMPORT_C TBool Eos() const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

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

Return value

TBool

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 TBool FrontDelimiter() const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

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

Return value

TBool

A boolean of value ETrue if there is a front delimiter, or EFalse if there is no front delimiter.


BackDelimiter()

IMPORT_C TBool BackDelimiter() const;

Pre-Condition

The string must have been initially parsed by Parse() or ParseReverse().

Description

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

Return value

TBool

A boolean of value ETrue if there is a back delimiter, or EFalse if there is no back delimiter.


Des()

IMPORT_C const TDesC8 &Des() const;

Description

Retrieves the descriptor reference with the data

Return value

const TDesC8 &

A const descriptor reference with the data.


Remainder()

IMPORT_C TInt Remainder(TPtrC8 &aRemainder) const;

Pre-Condition

The data must have been initially parsed by Parse() or ParseReverse().

Description

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

Parameters

TPtrC8 &aRemainder

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

Return value

TInt

An error value of KErrNotFound if there is no remaining data, or value of KErrNone if there is remaining data.


Parse()

protected: IMPORT_C void Parse(const TDesC8 &aData);

Pre-Condition

The delimiter must have been set.

Description

This parses the data into segments from left to right.

Post-Condition

The current segment is the leftmost segment and the direction of parsing is set from left to right (EDelimitedDataFroward).

Parameters

const TDesC8 &aData

A descriptor containing the data.


ParseReverse()

protected: IMPORT_C void ParseReverse(const TDesC8 &aData);

Pre-Condition

The delimiter must have been set.

Description

This parses the data into segments from lright to left.

Post-Condition

The current segment is the leftmost segment and the direction of parsing is set from right to left (EDelimitedDataReverse).

Parameters

const TDesC8 &aData

A descriptor containing the data.


SetDelimiter()

protected: IMPORT_C void SetDelimiter(TChar aDelimiter);

Description

Sets the delimiting character.

Post-Condition

The delimiting character is set.

Parameters

TChar aDelimiter

The delimiting character.