Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIStreamReader.h
Go to the documentation of this file.
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifdef GUILIANI_STREAM_GUI
11
12#ifndef GUISTREAMREADER__H_
13#define GUISTREAMREADER__H_
14
19#include "eC_Types.h"
20#include "eC_String.h"
21
22#include "eC_TArrayStack.h"
23
24#include "GUICommonTypes.h"
25
27#include "GUIImageResource.h"
28#include "GUITextResource.h"
29#include "GUIFontResource.h"
30#include "GUISoundResource.h"
31#include "GUIGeneralResource.h"
32#include "GUIDataPoolResource.h"
33#include "GUIPropertyResource.h"
34#include "GUIColorResource.h"
36#include "GUIStreamTypes.h"
37
39#define READ_BOOL(x) ReadBool(x)
41#define READ_UBYTE(x) ReadUByte(x)
43#define READ_SBYTE(x) ReadSByte(x)
45#define READ_SHORT(x) ReadShort(x)
47#define READ_USHORT(x) ReadUShort(x)
49#define READ_INT(x) ReadInt(x)
51#define READ_UINT(x) ReadUInt(x)
53#define READ_HEX(x) ReadHex(x)
55#define READ_COLOR(x) ReadColor(x)
57#define READ_FLOAT(x) ReadFloat(x)
59#define READ_STRING(x) ReadString(x)
61#define READ_BINARY(a, x) ReadBinary(a, x)
63#define DELETE_COMMENT_TAG(x) DeleteCommentTag(x)
65#define READ_OBJECTID(x) ReadObjectID(x)
67#define READ_IMAGEID(x) ReadImageID(x)
69#define READ_TEXTID(x) ReadTextID(x)
71#define READ_FONTID(x) ReadFontID(x)
73#define READ_SOUNDID(x) ReadSoundID(x)
75#define READ_GENRESID(x) ReadGeneralResourceID(x)
77#define READ_DATAPOOLID(x) ReadDataPoolID(x)
79#define READ_PROPERTYID(x) ReadPropertyID(x)
81#define READ_UUID(x) ReadUUID(x)
82
84#define GETINPUTSTREAM CGUIStreamReader::GetInstance()
85
86class eC_File;
87
89#define BUFFER_LENGTH 1024
90
92
129{
130public:
133 static void CreateInstance();
134
137 static void DeleteInstance();
138
144
147
149 virtual CGUIStreamReader* Clone() const = 0;
150
155 virtual const eC_String& GetFileSuffix() const;
156
163 void SetStreamingFile(eC_File* pkStreamingFile);
164
171
176 virtual eC_UByte ReadUByte(const eC_Char* pcTag = NULL) = 0;
177
182 virtual eC_Byte ReadByte(const eC_Char* pcTag = NULL) = 0;
183
188 virtual eC_UInt ReadUInt(const eC_Char* pcTag = NULL) = 0;
189
194 virtual eC_Int ReadInt(const eC_Char* pcTag = NULL) = 0;
195
200 virtual eC_UInt ReadHex(const eC_Char* pcTag = NULL) = 0;
201
206 virtual ColorValue_t ReadColor(const eC_Char* pcTag = NULL) = 0;
207
212 virtual eC_Float ReadFloat(const eC_Char* pcTag = NULL) = 0;
213
218 virtual eC_String ReadString(const eC_Char* pcTag = NULL) = 0;
219
224 virtual eC_UShort ReadUShort(const eC_Char* pcTag = NULL) = 0;
225
230 virtual eC_Short ReadShort(const eC_Char* pcTag = NULL) = 0;
231
236 virtual eC_Bool ReadBool(const eC_Char* pcTag = NULL) = 0;
237
242 virtual void ReadBinary(eC_TArray<eC_UByte>& aData, const eC_Char* pcTag = NULL) = 0;
243
249 virtual ObjectHandle_t ReadObjectID(const eC_Char* pcTag = NULL)
250 {
251 return static_cast<ObjectHandle_t>(READ_INT(pcTag));
252 }
253
259 virtual ImageResource_t ReadImageID(const eC_Char* pcTag = NULL)
260 {
261 return static_cast<ImageResource_t>(READ_INT(pcTag));
262 }
263
269 virtual TextResource_t ReadTextID(const eC_Char* pcTag = NULL)
270 {
271 return static_cast<TextResource_t>(READ_INT(pcTag));
272 }
273
279 virtual FontResource_t ReadFontID(const eC_Char* pcTag = NULL)
280 {
281 return static_cast<FontResource_t>(READ_INT(pcTag));
282 }
283
289 virtual SoundResource_t ReadSoundID(const eC_Char* pcTag = NULL)
290 {
291 return static_cast<SoundResource_t>(READ_INT(pcTag));
292 }
293
301 virtual GeneralResource_t ReadGeneralResourceID(const eC_Char* pcTag = NULL)
302 {
303 return static_cast<GeneralResource_t>(READ_INT(pcTag));
304 }
305
311 virtual DataPoolResource_t ReadDataPoolID(const eC_Char* pcTag = NULL)
312 {
313 return static_cast<DataPoolResource_t>(READ_INT(pcTag));
314 }
315
321 virtual GlobalProperty_t ReadPropertyID(const eC_Char* pcTag = NULL)
322 {
323 return static_cast<GlobalProperty_t>(READ_INT(pcTag));
324 }
325
331 virtual AnimationHandle_t ReadAnimationChainID(const eC_Char* pcTag = NULL)
332 {
333 return static_cast<AnimationHandle_t>(READ_INT(pcTag));
334 }
335
340 virtual UUID_t ReadUUID(const eC_Char* pcTag = NULL)
341 {
342 return UUID_t();
343 }
344
348 eC_UInt GetCurLine() const
349 {
350 return m_uiCurLine;
351 }
352
357 virtual void DeleteCommentTag(const eC_Char* pcTag = NULL) = 0;
358
363 virtual void DeleteCommentTag(const eC_String &kTag) = 0;
364
368 virtual eC_Int ReadStreamingFileHeader() = 0;
369
373 FileEndianess_t GetFileEndianess() const
374 {
375 return m_eFileEndianess;
376 }
377
381 FileType_t GetFileType() const
382 {
383 return m_eFileType;
384 }
385
389 FileAlignment_t GetFileAlignment() const
390 {
391 return m_eFileAlignment;
392 }
393
397 eC_String GetLastReadTag() const
398 {
399 return m_kLastReadTag;
400 }
401
402protected:
410 CGUIStreamReader(FileType_t eFileType, FileEndianess_t eFileEndianess, FileAlignment_t eFileAlignment);
411
418 void ResizeReadBuffer (eC_Bool bReset);
419
420protected:
423
425 eC_TArray<eC_Char> m_aReadBuffer;
426
428 eC_UInt m_uiCurLine;
429
431 FileType_t m_eFileType;
432
434 FileEndianess_t m_eFileEndianess;
435
437 FileAlignment_t m_eFileAlignment;
438
440 eC_String m_kLastReadTag;
441
442private:
445 CGUIStreamReader(const CGUIStreamReader& kSource);
446
449 CGUIStreamReader& operator=(const CGUIStreamReader& kSource);
450};
451
452#endif
453#endif
Helper Macros in Guiliani
AnimationHandle_t
List of animation resource ids.
Definition: GUIAnimationResource.h:49
Helper Macros in Guiliani
Helper Macros in Guiliani
DataPoolResource_t
List of data pool resource ids.
Definition: GUIDataPoolResource.h:35
Helper Macros in Guiliani
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
Helper Macros in Guiliani
GeneralResource_t
List of general resource ids.
Definition: GUIGeneralResource.h:52
Helper Macros in Guiliani
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
Helper Macros in Guiliani
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
Helper Macros in Guiliani
GlobalProperty_t
List of property resource ids.
Definition: GUIPropertyResource.h:67
Helper Macros in Guiliani
SoundResource_t
List of sound resource ids.
Definition: GUISoundResource.h:48
#define READ_INT(x)
Helper macro that should be used instead of calling CGUIStreamReader::ReadInt().
Definition: GUIStreamReader.h:49
Helper Macros in Guiliani
TextResource_t
List of text resource ids.
Definition: GUITextResource.h:40
Base class for stream readers.
Definition: GUIStreamReader.h:129
virtual TextResource_t ReadTextID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:269
void ResizeReadBuffer(eC_Bool bReset)
eC_String GetLastReadTag() const
Definition: GUIStreamReader.h:397
eC_File * m_pkCurrentInputFile
Pointer to the current streaming file. All reading operations will be performed on this file.
Definition: GUIStreamReader.h:422
virtual FontResource_t ReadFontID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:279
eC_UInt GetCurLine() const
Definition: GUIStreamReader.h:348
eC_UInt m_uiCurLine
Line number in current streaming file.
Definition: GUIStreamReader.h:428
virtual const eC_String & GetFileSuffix() const
void SetStreamingFile(eC_File *pkStreamingFile)
virtual eC_Int ReadStreamingFileHeader()=0
virtual void DeleteCommentTag(const eC_String &kTag)=0
virtual eC_Short ReadShort(const eC_Char *pcTag=NULL)=0
virtual UUID_t ReadUUID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:340
FileEndianess_t m_eFileEndianess
Endianess of the file.
Definition: GUIStreamReader.h:434
static void CreateInstance()
virtual eC_Byte ReadByte(const eC_Char *pcTag=NULL)=0
eC_TArray< eC_Char > m_aReadBuffer
Dynamic array to hold currently read tag content.
Definition: GUIStreamReader.h:425
virtual ColorValue_t ReadColor(const eC_Char *pcTag=NULL)=0
virtual eC_UInt ReadHex(const eC_Char *pcTag=NULL)=0
virtual void ReadBinary(eC_TArray< eC_UByte > &aData, const eC_Char *pcTag=NULL)=0
eC_String m_kLastReadTag
Last tag which was read, used to skip to the end of an corrupted object.
Definition: GUIStreamReader.h:440
static void DeleteInstance()
static CGUIStreamReader & GetInstance()
virtual eC_Int ReadInt(const eC_Char *pcTag=NULL)=0
FileType_t GetFileType() const
Definition: GUIStreamReader.h:381
virtual void DeleteCommentTag(const eC_Char *pcTag=NULL)=0
virtual AnimationHandle_t ReadAnimationChainID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:331
void ResetStreamingFile()
virtual ~CGUIStreamReader()
virtual DataPoolResource_t ReadDataPoolID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:311
virtual eC_Float ReadFloat(const eC_Char *pcTag=NULL)=0
virtual eC_Bool ReadBool(const eC_Char *pcTag=NULL)=0
FileAlignment_t m_eFileAlignment
Alignment of the file.
Definition: GUIStreamReader.h:437
FileAlignment_t GetFileAlignment() const
Definition: GUIStreamReader.h:389
virtual SoundResource_t ReadSoundID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:289
CGUIStreamReader(FileType_t eFileType, FileEndianess_t eFileEndianess, FileAlignment_t eFileAlignment)
virtual eC_UByte ReadUByte(const eC_Char *pcTag=NULL)=0
virtual eC_String ReadString(const eC_Char *pcTag=NULL)=0
virtual eC_UShort ReadUShort(const eC_Char *pcTag=NULL)=0
FileType_t m_eFileType
File Type.
Definition: GUIStreamReader.h:431
virtual ImageResource_t ReadImageID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:259
virtual GeneralResource_t ReadGeneralResourceID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:301
FileEndianess_t GetFileEndianess() const
Definition: GUIStreamReader.h:373
virtual GlobalProperty_t ReadPropertyID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:321
virtual eC_UInt ReadUInt(const eC_Char *pcTag=NULL)=0
virtual ObjectHandle_t ReadObjectID(const eC_Char *pcTag=NULL)
Definition: GUIStreamReader.h:249
virtual CGUIStreamReader * Clone() const =0
structure used to stream colors
Definition: GUICommonTypes.h:24
Definition: GUIStreamTypes.h:43