Symbian
 Developer Library

DEVELOPER LIBRARY

[Index] [Glossary] [Previous] [Next]



Location: DelimitedParser8.h
Link against: InetProtUtil.lib

Class TDelimitedParserBase8

class TDelimitedParserBase8;

Support

Supported from 7.0

Description

Implements the functionality for parsing 8-bit data that is divided into segments, each delimited by a single character.

The data to be parsed is neither owned nor modified by this class. The class provides the functionality to retrieve pointers to successive segments, either starting at the beginning of the data and working forwards, or starting at the end of the data, and working backwards.

The class cannot be instantiated, and must be derived from. Derived classes must ensure that they set up the data to be parsed by calling Parse() or ParseReverse(), and that they set the delimiting character by calling SetDelimiter() before invoking any of the parsing functionality. Failure to do this will cause panics to be raised.

Defined in TDelimitedParserBase8:
BackDelimiter(), Dec(), Des(), DoParse(), Eos(), FindNextSegment(), FindPrevSegment(), FrontDelimiter(), GetNext(), Inc(), Parse(), ParseReverse(), Peek(), Remainder(), SetDelimiter(), TDelimitedParserBase8(), iCurrentSegment, iDataDes, iDelimiter, iMode, iNextSegmentPos


Construction


TDelimitedParserBase8()

protected: TDelimitedParserBase8();

Description

Constructor.

[Top]


Member Functions


GetNext()

TInt GetNext(TPtrC8& aSegment) const;

Description

Sets the pointer descriptor to represent the current segment, and updates internal pointers to point to the next segment.

Parameters

TPtrC8& aSegment

On return, a pointer descriptor representing the current segment. If there are no more segments, this reference is unchanged.

Return value

TInt

KErrNone, if there is a current segment; KErrNotFound, if there are no more segments.

Panic codes

DELIM-PARSER -5005

if the data has not been parsed.

DELIM-PARSER -5004

if the delimiter has not been set.


Peek()

TInt Peek(TPtrC8& aSegment) const;

Description

Sets the pointer descriptor to represent the current segment.

Note that internal pointers are not updated, which means that repeated calls to this function always gives the same result.

Parameters

TPtrC8& aSegment

On return, a pointer descriptor representing the current segment. If there are no more segments, this reference is unchanged.

Return value

TInt

KErrNone, if there is a current segment; KErrNotFound, if there are no more segments.

Panic codes

DELIM-PARSER -5005

if the data has not been parsed.

DELIM-PARSER -5004

if the delimiter has not been set.


Inc()

TInt Inc() const;

Description

Updates internal pointers to point to the next segment.

Return value

TInt

KErrNone, if there is a current segment; KErrNotFound, if there are no more segments.

Panic codes

DELIM-PARSER -5005

if the data has not been parsed.

DELIM-PARSER -5004

if the delimiter has not been set.


Dec()

TInt Dec() const;

Description

Updates internal pointers to point to the previous segment.

Return value

TInt

KErrNone, if there is a previous segment; KErrNotFound, if there is no previous segment.

Panic codes

DELIM-PARSER -5005

if the data has not been parsed.

DELIM-PARSER -5004

if the delimiter has not been set.


Eos()

TBool Eos() const;

Description

Tests whether there are any more segments.

Return value

TBool

True, if there are more segments; false, otherwise.

Panic codes

DELIM-PARSER -5005

if the data has not been parsed.

DELIM-PARSER -5004

if the delimiter has not been set.


FrontDelimiter()

TBool FrontDelimiter() const;

Description

Tests whether there is a delimiter at the start (left hand side) of the data.

Return value

TBool

True, if there is a front delimiter; false, otherwise.

Panic codes

DELIM-PARSER -5004

if the delimiter has not been set.


BackDelimiter()

TBool BackDelimiter() const;

Description

Tests whether there is a delimiter at the end (right hand side) of the data.

Return value

TBool

True, if there is a front delimiter; false, otherwise.

Panic codes

DELIM-PARSER -5004

if the delimiter has not been set.


Des()

const TDesC8& Des() const;

Description

Gets a descriptor reference to the data.

Return value

const TDesC8&

A const descriptor reference to the data.


Remainder()

TInt Remainder(TPtrC8& aRemainder) const;

Description

Sets the pointer descriptor to represent the remaining data, including the current segment.

Note that internal pointers are not updated, which means that repeated calls to this function always gives the same result.

Parameters

TPtrC8& aSegment

On return, a pointer descriptor representing the remaining data. If there are no more segments, this reference is unchanged.

Return value

TInt

KErrNone, if there is a current segment; KErrNotFound, if there are no more segments.

Panic codes

DELIM-PARSER -5005

if the data has not been parsed.

DELIM-PARSER -5004

if the delimiter has not been set.


Parse()

protected: void Parse(const TDesC8& aData);

Description

Prepares the object for parsing in the forward (left to right) direction.

Internal pointers are set to point to the first segment.

Parameters

const TDesC8& aData

The data to be parsed.

Panic codes

DELIM-PARSER -5004

if the delimiter has not been set.


ParseReverse()

protected: void ParseReverse(const TDesC8& aData);

Description

Prepares the object for parsing in the backwards (right to left) direction.

Internal pointers are set to point to the last segment.

Parameters

const TDesC8& aData

The data to be parsed.

Panic codes

DELIM-PARSER -5004

if the delimiter has not been set.


SetDelimiter()

protected: void SetDelimiter(TChar aDelimiter);

Description

Sets the delimiting character.

Parameters

TChar aDelimiter

The delimiting character

[Top]


Internal members


DoParse()

private: void DoParse(const TDesC8& aData);

Description

This is internal and is not intended for use.


FindNextSegment()

private: TInt FindNextSegment(TInt aStartPos) const;

Description

This is internal and is not intended for use.


FindPrevSegment()

private: TInt FindPrevSegment(TInt aStartPos) const;

Description

This is internal and is not intended for use.


iDataDes

private: TPtrC8 iDataDes;

Description

This is internal and is not intended for use.


iCurrentSegment

private: TPtrC8 iCurrentSegment;

Description

This is internal and is not intended for use.


iNextSegmentPos

private: TInt iNextSegmentPos;

Description

This is internal and is not intended for use.


iMode

private: TDelimitedDataParseMode iMode;

Description

This is internal and is not intended for use.


iDelimiter

private: TInt iDelimiter;

Description

This is internal and is not intended for use.