TexGen
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TexGen::CTexGen Class Reference

Singleton class holding the Textiles in a database. More...

#include <TexGen.h>

Inheritance diagram for TexGen::CTexGen:
Inheritance graph
[legend]

Public Member Functions

 CTexGen (void)
 
 ~CTexGen (void)
 
string GetName (const CTextile *pTextile) const
 Get the name of the textile with given pointer. More...
 
CTextileGetTextile (string TextileName="")
 Get a textile with given name. More...
 
bool AddTextile (string TextileName, const CTextile &Textile, bool bOverwrite=false)
 Add Textile. More...
 
string AddTextile (const CTextile &Textile)
 Add Textile. More...
 
bool DeleteTextile (string TextileName)
 Delete a textile. More...
 
void PopulateTiXmlElement (TiXmlElement &Element, string TextileName="", OUTPUT_TYPE OutputType=OUTPUT_STANDARD)
 Used for saving data to XML. More...
 
bool LoadTiXmlElement (TiXmlElement &Element)
 Used for loading data from XML. More...
 
void SaveToXML (string FileName, string TextileName="", OUTPUT_TYPE OutputType=OUTPUT_STANDARD)
 Save TexGen XML file. More...
 
bool ReadFromXML (string FileName)
 Read TexGen XML file. More...
 
void DeleteTextiles ()
 Clear Textiles. More...
 
void SetLogger (const CLogger &Logger)
 Set the logger. More...
 
void SetTextileCallback (void(*pTextileCallback)(string TextileName, bool bAdded))
 Set the callback function when a textile is added or deleted. More...
 
string GetVersion () const
 Get the version of TexGen. More...
 
void SetMessages (bool bMessagesOn, const CLogger &Logger)
 Switch messages on/off. More...
 
void SetMessages (bool bMessagesOn)
 Switch messages on/off - use from scripts. More...
 
bool GetMessagesOn () const
 Get messages on/off. More...
 
void GetTextileNames (vector< string > &Names)
 Get list of textile names. More...
 
const map< string, CTextile * > & GetTextiles () const
 
CLoggerGetLogger () const
 

Static Public Member Functions

static CTexGenGetInstance ()
 

Protected Attributes

map< string, CTextile * > m_Textiles
 List of textiles created. More...
 
CLoggerm_pLogger
 Logger used to keep track of how error messages and log messages displayed or stored. More...
 
bool m_bMessagesOn
 
void(* m_pTextileCallback )(string TextileName, bool bAdded)
 
int m_iMajorVersion
 
int m_iMinorVersion
 
int m_iRevision
 

Static Protected Attributes

static CTexGen m_SingleInstance
 

Detailed Description

Singleton class holding the Textiles in a database.

Definition at line 85 of file TexGen.h.

Constructor & Destructor Documentation

◆ CTexGen()

CTexGen::CTexGen ( void  )

Definition at line 28 of file TexGen.cpp.

References TexGen::AddNewUnits(), and SetLogger().

◆ ~CTexGen()

CTexGen::~CTexGen ( void  )

Definition at line 41 of file TexGen.cpp.

References DeleteTextiles(), and m_pLogger.

Member Function Documentation

◆ AddTextile() [1/2]

string CTexGen::AddTextile ( const CTextile Textile)

Add Textile.

Parameters
TextileTextile object to add, a copy of it will be created and stored
Returns
Name of the textile created

Definition at line 117 of file TexGen.cpp.

References TexGen::CTextile::Copy(), TexGen::CTextile::GetDefaultName(), m_pTextileCallback, m_Textiles, TexGen::stringify(), and TGLOG.

◆ AddTextile() [2/2]

bool CTexGen::AddTextile ( string  TextileName,
const CTextile Textile,
bool  bOverwrite = false 
)

Add Textile.

Parameters
TextileNameName assigned to the textile, it must be unique
TextileTextile object to add, a copy of it will be created and stored
bOverwriteIf true an existing textile with the same name will be overwritten
Returns
false if the name already exists else true

Definition at line 83 of file TexGen.cpp.

References TexGen::CTextile::Copy(), m_pTextileCallback, m_Textiles, TGERROR, and TGLOG.

Referenced by LoadTiXmlElement().

◆ DeleteTextile()

bool CTexGen::DeleteTextile ( string  TextileName)

Delete a textile.

Parameters
TextileNameName of the textile to delete
Returns
true if successful

Definition at line 134 of file TexGen.cpp.

References m_pTextileCallback, m_Textiles, TGERROR, and TGLOG.

Referenced by DeleteTextiles().

◆ DeleteTextiles()

void CTexGen::DeleteTextiles ( )

Clear Textiles.

Definition at line 261 of file TexGen.cpp.

References DeleteTextile(), and m_Textiles.

Referenced by ~CTexGen().

◆ GetInstance()

static CTexGen & TexGen::CSingleton< CTexGen >::GetInstance ( )
inlinestaticinherited

Definition at line 40 of file Singleton.h.

◆ GetLogger()

CLogger & TexGen::CTexGen::GetLogger ( ) const
inline

Definition at line 156 of file TexGen.h.

◆ GetMessagesOn()

bool TexGen::CTexGen::GetMessagesOn ( ) const
inline

Get messages on/off.

Definition at line 150 of file TexGen.h.

◆ GetName()

string CTexGen::GetName ( const CTextile pTextile) const

Get the name of the textile with given pointer.

Returns
the name of the textile or "" if the textile is not in the list

Definition at line 48 of file TexGen.cpp.

References m_Textiles.

◆ GetTextile()

CTextile * CTexGen::GetTextile ( string  TextileName = "")

◆ GetTextileNames()

void CTexGen::GetTextileNames ( vector< string > &  Names)

Get list of textile names.

Definition at line 301 of file TexGen.cpp.

References m_Textiles.

◆ GetTextiles()

const map< string, CTextile * > & TexGen::CTexGen::GetTextiles ( ) const
inline

◆ GetVersion()

string CTexGen::GetVersion ( ) const

Get the version of TexGen.

Definition at line 281 of file TexGen.cpp.

References m_iMajorVersion, m_iMinorVersion, m_iRevision, and TexGen::stringify().

Referenced by ReadFromXML(), and SaveToXML().

◆ LoadTiXmlElement()

bool CTexGen::LoadTiXmlElement ( TiXmlElement &  Element)

Used for loading data from XML.

Definition at line 177 of file TexGen.cpp.

References AddTextile(), and FOR_EACH_TIXMLELEMENT.

Referenced by ReadFromXML().

◆ PopulateTiXmlElement()

void CTexGen::PopulateTiXmlElement ( TiXmlElement &  Element,
string  TextileName = "",
OUTPUT_TYPE  OutputType = OUTPUT_STANDARD 
)

Used for saving data to XML.

Definition at line 151 of file TexGen.cpp.

References GetTextile(), m_Textiles, and TexGen::CTextile::PopulateTiXmlElement().

Referenced by SaveToXML().

◆ ReadFromXML()

bool CTexGen::ReadFromXML ( string  FileName)

Read TexGen XML file.

Definition at line 234 of file TexGen.cpp.

References GetVersion(), LoadTiXmlElement(), TGERROR, TGLOG, and TGLOGINDENT.

◆ SaveToXML()

void CTexGen::SaveToXML ( string  FileName,
string  TextileName = "",
OUTPUT_TYPE  OutputType = OUTPUT_STANDARD 
)

Save TexGen XML file.

Parameters
FileNameThe name of the XML file on disk
TextileNameThe name of the textile to save, if left blank will save all textiles
OutputTypeThe amount of information to save to disk

Definition at line 215 of file TexGen.cpp.

References GetVersion(), PopulateTiXmlElement(), TGERROR, and TGLOG.

◆ SetLogger()

void CTexGen::SetLogger ( const CLogger Logger)

Set the logger.

Definition at line 269 of file TexGen.cpp.

References TexGen::CLogger::Copy(), and m_pLogger.

Referenced by CTexGen(), and SetMessages().

◆ SetMessages() [1/2]

void CTexGen::SetMessages ( bool  bMessagesOn)

Switch messages on/off - use from scripts.

Definition at line 292 of file TexGen.cpp.

References m_bMessagesOn, and SetLogger().

◆ SetMessages() [2/2]

void CTexGen::SetMessages ( bool  bMessagesOn,
const CLogger Logger 
)

Switch messages on/off.

Definition at line 286 of file TexGen.cpp.

References m_bMessagesOn, and SetLogger().

◆ SetTextileCallback()

void CTexGen::SetTextileCallback ( void(*)(string TextileName, bool bAdded)  pTextileCallback)

Set the callback function when a textile is added or deleted.

Definition at line 276 of file TexGen.cpp.

References m_pTextileCallback.

Member Data Documentation

◆ m_bMessagesOn

bool TexGen::CTexGen::m_bMessagesOn
protected

Definition at line 161 of file TexGen.h.

Referenced by SetMessages().

◆ m_iMajorVersion

int TexGen::CTexGen::m_iMajorVersion
protected

Definition at line 163 of file TexGen.h.

Referenced by GetVersion().

◆ m_iMinorVersion

int TexGen::CTexGen::m_iMinorVersion
protected

Definition at line 164 of file TexGen.h.

Referenced by GetVersion().

◆ m_iRevision

int TexGen::CTexGen::m_iRevision
protected

Definition at line 165 of file TexGen.h.

Referenced by GetVersion().

◆ m_pLogger

CLogger* TexGen::CTexGen::m_pLogger
protected

Logger used to keep track of how error messages and log messages displayed or stored.

Definition at line 160 of file TexGen.h.

Referenced by SetLogger(), and ~CTexGen().

◆ m_pTextileCallback

void(* TexGen::CTexGen::m_pTextileCallback) (string TextileName, bool bAdded)
protected

Definition at line 162 of file TexGen.h.

Referenced by AddTextile(), DeleteTextile(), and SetTextileCallback().

◆ m_SingleInstance

CTexGen TexGen::CSingleton< CTexGen >::m_SingleInstance
staticprotectedinherited

Definition at line 45 of file Singleton.h.

◆ m_Textiles

map<string, CTextile*> TexGen::CTexGen::m_Textiles
protected

List of textiles created.

Definition at line 159 of file TexGen.h.

Referenced by AddTextile(), DeleteTextile(), DeleteTextiles(), GetName(), GetTextile(), GetTextileNames(), and PopulateTiXmlElement().


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