#include <delimitedparser16.h>
class TDelimitedParserBase16 |
Public Member Functions | |
---|---|
IMPORT_C TBool | BackDelimiter() |
IMPORT_C TInt | Dec() |
IMPORT_C const TDesC16 & | Des() |
IMPORT_C TBool | Eos() |
IMPORT_C TBool | FrontDelimiter() |
IMPORT_C TInt | GetNext(TPtrC16 &) |
IMPORT_C TInt | Inc() |
IMPORT_C TInt | Peek(TPtrC16 &) |
IMPORT_C TInt | Remainder(TPtrC16 &) |
IMPORT_C void | Reset() |
Protected Member Functions | |
---|---|
TDelimitedParserBase16() | |
IMPORT_C void | Parse(const TDesC16 &) |
IMPORT_C void | ParseReverse(const TDesC16 &) |
IMPORT_C void | SetDelimiter(TChar) |
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.
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.
Returns: A boolean of value ETrue if there is a back delimiter, or EFalse if there is no back delimiter.
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.
Returns: 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.
IMPORT_C const TDesC16 & | Des | ( | ) | const |
Retrieves the descriptor reference with the data
Returns: A const 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.
Returns: A boolean value of ETrue if the end of the data has been reached, or EFalse if there are more segements to parse.
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.
Returns: A boolean of value ETrue if there is a front delimiter, or EFalse if there is no front delimiter.
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.
Parameter | Description |
---|---|
aSegment | This is an output argument that is set to the current segment. |
Returns: A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a 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.
Returns: A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a current segment.
IMPORT_C void | Parse | ( | const TDesC16 & | 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.
Parameter | Description |
---|---|
aData | A descriptor containing the data. |
IMPORT_C void | ParseReverse | ( | const TDesC16 & | 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.
Parameter | Description |
---|---|
aData | A descriptor containing the data. |
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.
Parameter | Description |
---|---|
aSegment | This is an output argument that is set to the current segment. |
Returns: A error value of KErrNotFound if there is no current segment. The value KErrNone if there is a current segment.
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.
Parameter | Description |
---|---|
aRemainder | This is an output argument that is set to the remaining data. |
Returns: An error value of KErrNotFound if there is no remaining data, or value of KErrNone if there is 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.
Parameter | Description |
---|---|
aDelimiter | The delimiting character. |