class CLineReader : public CBase |
Line reader for a vCalendar or vCard parser.
Reads in a line at a time for the parser.
Also allows the first character of the next line to be checked to see if it is a space, which can indicate that the line is wrapped. This enables the reading of multi-line property values.
Used by CVersitParser to internalise streams.
Public Member Functions | |
---|---|
~CLineReader () | |
IMPORT_C TBool | AppendLineIfSpaceNextL () |
IMPORT_C TInt | AppendSpaceL () |
IMPORT_C TBool | IsSpaceNextL () |
IMPORT_C CLineReader * | NewL ( RReadStream &) |
void | ReadBase64ValueL ( TInt ) |
IMPORT_C TInt | ReadLineL ( TInt , TInt &) |
void | SetPlugIn ( MVersitPlugIn *) |
void | SetSkipWhiteSpaceAtStart ( TBool ) |
Protected Member Functions | |
---|---|
CLineReader ( RReadStream &) | |
IMPORT_C void | ConstructL () |
IMPORT_C void | ExpandBufferL ( TInt ) |
IMPORT_C TUint8 | ReadChar ( TInt &) |
Private Member Functions | |
---|---|
TInt | ReadLineL ( HBufC8 *&, TInt , TInt &) |
IMPORT_C void | Reserved () |
Public Member Enumerations | |
---|---|
enum | anonymous { EInitialLineSize = 96, EExpandSize = 16 } |
enum | anonymous { ELineHasContent = 0, ELineIsWhiteSpace = 1, ELineIsCRLFOnly = 2, ELineHasColon } |
Public Attributes | |
---|---|
TPtr8 | iBufPtr |
RReadStream * | iReadStream |
Protected Attributes | |
---|---|
TInt | iFirstCharNextLine |
HBufC8 * | iLineBuf |
Private Attributes | |
---|---|
CLineReaderExtension * | iExtension |
MVersitPlugIn * | iPlugIn |
TBool | iSkipWhiteSpaceAtStart |
CLineReader | ( | RReadStream & | aStream | ) | [protected, inline] |
RReadStream & aStream |
IMPORT_C | ~CLineReader | ( | ) |
Frees all resources owned by the line reader prior to its destruction.
IMPORT_C TBool | AppendLineIfSpaceNextL | ( | ) |
Checks the first character of the next line and, if it is a white space, reads the next line into the buffer (pointed to by iBufPtr).
The line is appended to the buffer rather than overwriting data already in the buffer.
A plug-in option can determine that no space is to be written to the buffer between the lines. By default, a space will be written.
Used by the Versit parser while it is reading multi-line property values.
IMPORT_C TInt | AppendSpaceL | ( | ) |
Appends a space to the end of the buffer (pointed to by iBufPtr).
The buffer will be expanded if necessary.
This is called by AppendLineIfSpaceNextL() to create a space in the buffer between the lines being read (as long as there is no plug-in option to to indicate there should be no space).
IMPORT_C void | ExpandBufferL | ( | TInt | aCurrentSize | ) | [protected] |
TInt aCurrentSize |
IMPORT_C TBool | IsSpaceNextL | ( | ) |
Checks to see if the first character of the next line is white space.
This function should not be called more than once without a line being read in.
Used by the Versit parser while it is reading multi-line property values.
IMPORT_C CLineReader * | NewL | ( | RReadStream & | aStream | ) | [static] |
Constructs and returns a CLineReader .
RReadStream & aStream | The stream to read the lines from. |
void | ReadBase64ValueL | ( | TInt | aPopValueStart | ) |
Read base64 multiple lines
This should be only called when parsing multi-line base64 data, and the interface MVersitPlugInExtensionBase64Ending::BlankLineAndLeadingSpaceNotRequired returns ETrue
If the character ':' is not contained in the current line,we know it is base64 value.It is therefore appended to iBufPtr. Otherwise we know it is a new property which will be held in CLineReaderExtension::iLineBase64Value temporarily until the next propery is to be parsed.
TInt aPopValueStart | The position in the iLineBuffer where base64 value starts |
IMPORT_C TInt | ReadLineL | ( | TInt | aPos, |
TInt & | aErr | |||
) | [virtual] |
Reads in a line from the stream.
The line is stored in a buffer pointed to by iBufPtr. Data from the stream is appended to the buffer, starting at buffer position aPos, until the next 'CRLF' ("/r/n") is reached. The line feed and carriage return are not added to the buffer. Using only linefeeds LF() as the line delimiters is also supported.
The buffer will be expanded if necessary to fit the line into it.
If the end of stream is reached, aErr will contain KErrEof upon return.
It would be normal to set aPos to the start of the buffer unless reading a multi-line value.
TInt | ReadLineL | ( | HBufC8 *& | aHBuf, |
TInt | aPos, | |||
TInt & | aErr | |||
) | [private] |
Reads in a line from the stream.
The line is stored in a buffer pointed to by aHBuf. Data from the stream is appended to the buffer, starting at buffer position aPos, until the next 'CRLF' ("/r/n") is reached. The line feed and carriage return are not added to the buffer. Using only linefeeds LF() as the line delimiters is also supported.
The buffer will be expanded if necessary to fit the line into it.
If the end of stream is reached, aErr will contain KErrEof upon return.
It would be normal to set aPos to the start of the buffer unless reading a multi-line value.
HBufC8 *& aHBuf | |
TInt aPos | The position in the buffer pointed to by aHBuf at which to begin appending data to the buffer. Allows lines to be appended to the buffer when reading multi-line values. |
TInt & aErr | On return, this will be KErrEof if the end of the stream is reached and KErrNone otherwise. |
void | SetPlugIn | ( | MVersitPlugIn * | aPlugIn | ) | [inline] |
Sets the plug-in.
Allows implemented functions of the MVersitPlugIn class to be used in specifying options for adding and deleting spaces to/from the buffer.
Specifically, the plug-in is used to determine whether an additional space should be added when appending a line to the buffer (by default a space will be added), and whether the white space at the start of a line should form part of the data (by default it will not form part of the data).
Using a plug-in is optional.
MVersitPlugIn * aPlugIn | A pointer to an MVersitPlugIn instance. |
void | SetSkipWhiteSpaceAtStart | ( | TBool | aDoSkip | ) | [inline] |
TBool aDoSkip |
Defines the initial line size of, and the size of expansions to, the buffer which stores the line being read.
EInitialLineSize = 96 |
The initial size of the buffer (pointed to by iBuf). |
EExpandSize = 16 |
The size by which the buffer (pointed to by iBuf) is expanded when it has run out of room. |
Defines values which describe the content of a line that has been read.
This is the return value from the function ReadLine().
ELineHasContent = 0 |
The line has content (not white space). |
ELineIsWhiteSpace = 1 |
The line has white space only. |
ELineIsCRLFOnly = 2 |
The line has no content, and so is just a carriage return and line feed ("/r/n"). |
ELineHasColon |
The line has a colon This is only used internally. When the line has a colon, ReadLineL will return ELineHasContent for the sake of backwards compatibility. |
TPtr8 | iBufPtr |
A pointer to a buffer which stores data read from the stream.
Its size on construction is EInitialLineSize, and it is expanded by EExpandSize when necessary.
A copy of this value should not be stored, since the buffer location may change if the buffer is expanded.
Data in the buffer is not lost when the buffer is expanded, but is copied to the new location.
RReadStream * | iReadStream |
A pointer to an RReadStream object, the ReadUint8L() function of which is used to read single characters from the stream.
This is passed into the NewL() function upon construction.
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.