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.
Public Member Functions | |
---|---|
IMPORT_C TBool | BackDelimiter () |
IMPORT_C TInt | Dec () |
IMPORT_C const TDesC8 & | Des () |
IMPORT_C TBool | Eos () |
IMPORT_C TBool | FrontDelimiter () |
IMPORT_C TInt | GetNext ( TPtrC8 &) |
IMPORT_C TInt | Inc () |
IMPORT_C TInt | Peek ( TPtrC8 &) |
IMPORT_C TInt | Remainder ( TPtrC8 &) |
IMPORT_C void | Reset () |
Protected Member Functions | |
---|---|
TDelimitedParserBase8 () | |
IMPORT_C void | Parse (const TDesC8 &) |
IMPORT_C void | ParseReverse (const TDesC8 &) |
IMPORT_C void | SetDelimiter ( TChar ) |
Private Member Functions | |
---|---|
void | DoParse (const TDesC8 &) |
TInt | FindNextSegment ( TInt ) |
TInt | FindPrevSegment ( TInt ) |
Private Attributes | |
---|---|
TPtrC8 | iCurrentSegment |
TPtrC8 | iDataDes |
TInt | iDelimiter |
TDelimitedDataParseMode | iMode |
TInt | iNextSegmentPos |
IMPORT_C TBool | BackDelimiter | ( | ) | const |
Checks for a delimiter at the back (right) of the data.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
IMPORT_C TInt | Dec | ( | ) | const |
Parses back to the previous segment.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
IMPORT_C const TDesC8 & | Des | ( | ) | const |
Retrieves the descriptor reference with the data
void | DoParse | ( | const TDesC8 & | aData | ) | [private] |
Initialises the parsing of the data.
const TDesC8 & aData | A descriptor reference with the data. |
IMPORT_C TBool | Eos | ( | ) | const |
Indicates whether the end of the data has been reached and there are no more segments to parse.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
TInt | FindNextSegment | ( | TInt | aStartPos | ) | const [private] |
Finds the next segment from the given start position.
TInt aStartPos | The position from where to start the search for the next segment. |
TInt | FindPrevSegment | ( | TInt | aStartPos | ) | const [private] |
Finds the previous segment from the given start position.
TInt aStartPos | The position from where to start the search for the previous segment. |
IMPORT_C TBool | FrontDelimiter | ( | ) | const |
Checks for a delimiter at the front (left) of the data.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
IMPORT_C TInt | GetNext | ( | TPtrC8 & | aSegment | ) | const |
Retrieves the current segment and then parses the data to the next one.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
TPtrC8 & aSegment | This is an output argument that is set to the current segment. |
IMPORT_C TInt | Inc | ( | ) | const |
Parses to the next segment.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
IMPORT_C void | Parse | ( | const TDesC8 & | aData | ) | [protected] |
This parses the data into segments from left to right.
There will be a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
const TDesC8 & aData | A descriptor containing the data. |
IMPORT_C void | ParseReverse | ( | const TDesC8 & | aData | ) | [protected] |
This parses the data into segments from lright to left.
There will be a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
const TDesC8 & aData | A descriptor containing the data. |
IMPORT_C TInt | Peek | ( | TPtrC8 & | aSegment | ) | const |
Retrieves the current segment.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
TPtrC8 & aSegment | This is an output argument that is set to the current segment. |
IMPORT_C TInt | Remainder | ( | 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.
There will be a KDelimitedParserErrNotParsed panic if the data has not been parsed, and a KDelimitedParserErrNoDelimiter panic if the delimiter has not been set.
TPtrC8 & aRemainder | This is an output argument that is set to the remaining data. |
IMPORT_C void | Reset | ( | ) | const |
Resets the internal pointer position to the start or end or the descriptor depending on whether the decriptor is parsing mode.
There will be a KUriUtilsErrBadDelimitedParserMode panic if the data mode has not been correctly set.
IMPORT_C void | SetDelimiter | ( | TChar | aDelimiter | ) | [protected] |
Sets the delimiting character.
TChar aDelimiter | The delimiting character. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.