Base class for stream readers. More...
#include <GUIStreamReader.h>
Public Member Functions | |
virtual | ~CGUIStreamReader () |
virtual CGUIStreamReader * | Clone () const =0 |
virtual void | DeleteCommentTag (const eC_Char *pcTag=NULL)=0 |
virtual void | DeleteCommentTag (const eC_String &kTag)=0 |
eC_UInt | GetCurLine () const |
FileAlignment_t | GetFileAlignment () const |
FileEndianess_t | GetFileEndianess () const |
virtual const eC_String & | GetFileSuffix () const |
FileType_t | GetFileType () const |
eC_String | GetLastReadTag () const |
virtual AnimationHandle_t | ReadAnimationChainID (const eC_Char *pcTag=NULL) |
virtual void | ReadBinary (eC_TArray< eC_UByte > &aData, const eC_Char *pcTag=NULL)=0 |
virtual eC_Bool | ReadBool (const eC_Char *pcTag=NULL)=0 |
virtual eC_Byte | ReadByte (const eC_Char *pcTag=NULL)=0 |
virtual ColorValue_t | ReadColor (const eC_Char *pcTag=NULL)=0 |
virtual DataPoolResource_t | ReadDataPoolID (const eC_Char *pcTag=NULL) |
virtual eC_Float | ReadFloat (const eC_Char *pcTag=NULL)=0 |
virtual FontResource_t | ReadFontID (const eC_Char *pcTag=NULL) |
virtual GeneralResource_t | ReadGeneralResourceID (const eC_Char *pcTag=NULL) |
virtual eC_UInt | ReadHex (const eC_Char *pcTag=NULL)=0 |
virtual ImageResource_t | ReadImageID (const eC_Char *pcTag=NULL) |
virtual eC_Int | ReadInt (const eC_Char *pcTag=NULL)=0 |
virtual ObjectHandle_t | ReadObjectID (const eC_Char *pcTag=NULL) |
virtual GlobalProperty_t | ReadPropertyID (const eC_Char *pcTag=NULL) |
virtual eC_Short | ReadShort (const eC_Char *pcTag=NULL)=0 |
virtual SoundResource_t | ReadSoundID (const eC_Char *pcTag=NULL) |
virtual eC_Int | ReadStreamingFileHeader ()=0 |
virtual eC_String | ReadString (const eC_Char *pcTag=NULL)=0 |
virtual TextResource_t | ReadTextID (const eC_Char *pcTag=NULL) |
virtual eC_UByte | ReadUByte (const eC_Char *pcTag=NULL)=0 |
virtual eC_UInt | ReadUInt (const eC_Char *pcTag=NULL)=0 |
virtual eC_UShort | ReadUShort (const eC_Char *pcTag=NULL)=0 |
void | ResetStreamingFile () |
void | SetStreamingFile (eC_File *pkStreamingFile) |
Static Public Member Functions | |
static void | CreateInstance () |
static void | DeleteInstance () |
static CGUIStreamReader & | GetInstance () |
Protected Member Functions | |
CGUIStreamReader (FileType_t eFileType, FileEndianess_t eFileEndianess, FileAlignment_t eFileAlignment) | |
void | ResizeReadBuffer (eC_Bool bReset) |
Base class for stream readers.
Stream readers are used to read GUI definitions from files. This abstract base class defines the interfaces for handling streaming files and reading values from them.
Each instance of a stream reader operates on one file at a time. A file can be set by calling SetStreamingFile().
After setting a file, the various read methods can be called. Each of them expects a 'tag' which can be a descriptive text string or something else. Implementations can use these tags in whatever way they want, for instance for error checking. They may also choose to ignore the tags. However, a CGUIStreamReader implementation in general is expected to be able to read what its counterpart CGUIStreamWriter implementation wrote. Each of the methods returns the value read from the file.
The stream reader offers the method GetCurLine() which returns an internal line number. Implementations are expected to increase the counter in a meaningful way that allows for printing debug messages that point users to errors in their streaming files.
Additionally the StreamReader can return the last read tag which can be used to e.g. check for corrupted elements and skip until the end of these.
For each of the Read... methods declared in this class there is an additional macro, for instance READ_INT for the method ReadInt(). Streaming code should use these macros instead of direct method calls.
|
virtual |
Destructor.
Removes this object from stream reader stack.
|
protected |
Constructs a stream reader. Initially, no file is set. The line number is initialized to 1. This reader will be pushed on top of the reader stack.
eFileType | initial file type |
eFileEndianess | initial file endianess |
eFileAlignment | initial file alignment |
|
pure virtual |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
static |
Create Instance
|
pure virtual |
Reads over (removes) a tag from the current streaming file without reading a value.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads over (removes) a tag from the current streaming file without reading a value.
kTag | descriptive tag. |
Implemented in CGUIStreamReaderXML, and CGUIStreamReaderBinary.
|
static |
Delete Instance
|
inline |
Returns the current line in the streaming file.
|
inline |
Gets the alignment of the file
|
inline |
Gets the endianess of the file
|
virtual |
Returns the file suffix which is associated with this reader's file format. This can be an empty string, if e.g. the reader works with formats which are unrelated to files.
Reimplemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inline |
Gets the type of the file
|
static |
|
inline |
Gets the last read Tag
|
inlinevirtual |
Reads an animation chain handle from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads binary stream. Array will be retrieved from stream in raw mode.
pcTag | Optional descriptive tag. | |
[out] | aData | Array the read data will be set to. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads a boolean value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads a signed byte value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads a color from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inlinevirtual |
Reads a DataPool ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads a float value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inlinevirtual |
Reads a font ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
inlinevirtual |
Reads a general resource ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads a hexadecimal integer value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inlinevirtual |
Reads an image ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads a signed integer value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inlinevirtual |
Reads an object handle from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
inlinevirtual |
Reads a Property ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads a short value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inlinevirtual |
Reads a sound ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads the file header of a streaming file
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads a string from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
inlinevirtual |
Reads a text ID from the current streaming file. The call is directly forwarded to ReadInt().
pcTag | Optional descriptive tag. |
|
pure virtual |
Reads an unsigned byte value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads an unsigned integer value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
|
pure virtual |
Reads an unsigned short value from the current streaming file.
pcTag | Optional descriptive tag. |
Implemented in CGUIStreamReaderBinary, and CGUIStreamReaderXML.
void CGUIStreamReader::ResetStreamingFile | ( | ) |
Removes the streaming file. This method must be called whenever a file is no longer used and is closed by another instance. This method resets the line number and the internal pointer, ensuring that further read operations do not use invalid file pointers.
|
protected |
The local read buffer will be resized by power-of-2 or reset to initial size of 128 Bytes.
bReset | Set this flag true initializes a new, empty buffer with initial size. False increments the current array size and preserves content. |
void CGUIStreamReader::SetStreamingFile | ( | eC_File * | pkStreamingFile | ) |
Sets the file to read from. When the file is no longer needed, call ResetStreamingFile(). Always sets the streaming file mode to eC_File::FS_BIGENDIAN.
pkStreamingFile | The streaming file. Subsequent read method calls operate on this file. |