Gorgon Game Engine
DataItem Class Referenceabstract
Inheritance diagram for DataItem:
[legend]

Public Types

using LoaderFn = std::function< DataItem *(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long totalsize)>
 

Public Member Functions

virtual ~DataItem ()
 
template<class T_ >
T_ Get () const
 Returns the contents of this data item to the requested type; use GetObject in order to get resource objects. More...
 
template<>
int Get () const
 
template<>
float Get () const
 
virtual GID::Type GetGID () const =0
 Returns the Gorgon ID of this data object. More...
 
template<class T_ >
T_ & GetObject () const
 
virtual void Save (Writer &writer) const
 Saves the data item with header information to gorgon file. More...
 
virtual void SaveValue (Writer &writer) const =0
 Saves only the value of the data item to gorgon file. More...
 
virtual std::string ToString () const =0
 Converts the contents of this data to string. More...
 

Static Public Member Functions

static void InitializeLoaders ()
 This function will initialize data loaders. More...
 

Public Attributes

std::string Name
 The name of the data item. More...
 

Static Public Attributes

static std::map< GID::Type, LoaderFnDataLoaders
 Data loaders that all data containing classes would use to load their children. More...
 

Member Typedef Documentation

◆ LoaderFn

using LoaderFn = std::function<DataItem *(std::weak_ptr<File> file, std::shared_ptr<Reader> reader, unsigned long totalsize)>

Constructor & Destructor Documentation

◆ ~DataItem()

virtual ~DataItem ( )
virtual

Member Function Documentation

◆ Get() [1/3]

T_ Get ( ) const

Returns the contents of this data item to the requested type; use GetObject in order to get resource objects.

◆ Get() [2/3]

int Get ( ) const

References DataItem::Get().

◆ Get() [3/3]

float Get ( ) const

References DataItem::Get().

◆ GetGID()

virtual GID::Type GetGID ( ) const
pure virtual

Returns the Gorgon ID of this data object.

Implemented in ObjectData, MarginData, BoundsData, RectangleData, SizeData, PointfData, PointData, TextData, FloatData, and IntegerData.

◆ GetObject()

T_ & GetObject

References ObjectData::Get().

◆ InitializeLoaders()

◆ Save()

virtual void Save ( Writer writer) const
virtual

Saves the data item with header information to gorgon file.

References DataItem::GetGID(), DataItem::Name, DataItem::SaveValue(), Writer::WriteChunkStart(), Writer::WriteEnd(), and Writer::WriteStringWithSize().

◆ SaveValue()

virtual void SaveValue ( Writer writer) const
pure virtual

Saves only the value of the data item to gorgon file.

issizewritten controls whether the size of the object should be written for some data types (like blob and string)

Implemented in ObjectData, MarginData, BoundsData, RectangleData, SizeData, PointfData, PointData, TextData, FloatData, and IntegerData.

◆ ToString()

virtual std::string ToString ( ) const
pure virtual

Converts the contents of this data to string.

Implemented in ObjectData, MarginData, BoundsData, RectangleData, SizeData, PointfData, PointData, TextData, FloatData, and IntegerData.

Member Data Documentation

◆ DataLoaders

std::map< GID::Type, DataItem::LoaderFn > DataLoaders
static

Data loaders that all data containing classes would use to load their children.

◆ Name

std::string Name

The name of the data item.


The documentation for this class was generated from the following files: