DataStack Class Reference

DataStacks provide an interface for storing (and removing) variables that can be accessed from anywhere within the framework. Furthermore it's also possible to save these variables into files. More...

List of all members.

Public Member Functions

 DataStack (const std::string &name)
 Constructor.
 ~DataStack ()
 Deconstructor.
void init ()
 Initialises the DataStack.
void clear ()
 Clears the DataStack.
void refAdd ()
 Increases the reference counter.
void refRelease ()
 Decreases the reference counter.
u32 getID () const
 Gets the ID of the DataStack.
const std::string & getName () const
 Gets the name of the DataStack.
u32 getSize () const
 Gets the number of variables on the DataStack.
template<typename T >
bool setVar (const std::string &name, const T &value)
 Sets the variable with the given name.
template<typename T >
getVar (const std::string &name)
 Gets the variable with the given name.
std::string getVar (const std::string &name)
 Gets the variable with the given name.
void removeAll ()
 Removes all variables from this DataStack.
bool removeVar (const std::string &name)
 Removes the variable with the given name.
bool saveBencode (const std::string &fileName)
 Saves the DataStack as a bencoded file.
bool loadBencode (const std::string &fileName)
 Loads the DataStack from a bencoded file.
bool saveXML (const std::string &fileName)
 Saves the DataStack as a XML file.
bool loadXML (const std::string &fileName)
 Loads the DataStack from a XML file.

Static Public Member Functions

static DataStackrefFactory (const std::string &name)
 Will be used to instanciate objects of this class.


Detailed Description

DataStacks provide an interface for storing (and removing) variables that can be accessed from anywhere within the framework. Furthermore it's also possible to save these variables into files.

Definition at line 32 of file DataStack.h.


Constructor & Destructor Documentation

DataStack::DataStack ( const std::string &  name  ) 

Constructor.

Parameters:
name Name of the DataStack.

Definition at line 29 of file DataStack.cpp.

DataStack::~DataStack (  ) 

Deconstructor.

Definition at line 36 of file DataStack.cpp.


Member Function Documentation

void DataStack::clear (  ) 

Clears the DataStack.

Definition at line 47 of file DataStack.cpp.

u32 DataStack::getID (  )  const

Gets the ID of the DataStack.

Definition at line 75 of file DataStack.cpp.

const std::string & DataStack::getName (  )  const

Gets the name of the DataStack.

Definition at line 81 of file DataStack.cpp.

u32 DataStack::getSize (  )  const

Gets the number of variables on the DataStack.

Definition at line 87 of file DataStack.cpp.

std::string DataStack::getVar ( const std::string &  name  ) 

Gets the variable with the given name.

Parameters:
name Name of the variable.
Returns:
The value of the given variable.
Note:
Specialization function for std::string.

template<typename T >
std::string DataStack::getVar ( const std::string &  name  )  [inline]

Gets the variable with the given name.

Parameters:
name Name of the variable.
Returns:
The value of the given variable.
Note:
This function is not directly available in AngelScript. You can use the get_<valuetype> functions, though.

Definition at line 97 of file DataStack.h.

void DataStack::init (  ) 

Initialises the DataStack.

Definition at line 42 of file DataStack.cpp.

bool DataStack::loadBencode ( const std::string &  fileName  ) 

Loads the DataStack from a bencoded file.

Parameters:
fileName Filename of the file where the data is retrieved from.

Definition at line 165 of file DataStack.cpp.

bool DataStack::loadXML ( const std::string &  fileName  ) 

Loads the DataStack from a XML file.

Parameters:
fileName Filename of the file where the data is retrieved from.

Definition at line 277 of file DataStack.cpp.

void DataStack::refAdd (  ) 

Increases the reference counter.

Note:
For internal use only!

Definition at line 59 of file DataStack.cpp.

DataStack * DataStack::refFactory ( const std::string &  name  )  [static]

Will be used to instanciate objects of this class.

Note:
For internal use only!

Definition at line 53 of file DataStack.cpp.

void DataStack::refRelease (  ) 

Decreases the reference counter.

Note:
For internal use only!

Definition at line 65 of file DataStack.cpp.

void DataStack::removeAll (  ) 

Removes all variables from this DataStack.

Definition at line 108 of file DataStack.cpp.

bool DataStack::removeVar ( const std::string &  name  ) 

Removes the variable with the given name.

Parameters:
name Name of the variable.

Definition at line 114 of file DataStack.cpp.

bool DataStack::saveBencode ( const std::string &  fileName  ) 

Saves the DataStack as a bencoded file.

Parameters:
fileName Filename of the file where the data is stored in.

Definition at line 129 of file DataStack.cpp.

bool DataStack::saveXML ( const std::string &  fileName  ) 

Saves the DataStack as a XML file.

Parameters:
fileName Filename of the file where the data is stored in.

Definition at line 244 of file DataStack.cpp.

template<typename T >
bool DataStack::setVar ( const std::string &  name,
const T &  value 
) [inline]

Sets the variable with the given name.

Parameters:
name Name of the variable to set.
value Value of the variable.
Note:
This function is not directly available in AngelScript. You can use the set_<valuetype> functions, though.

Definition at line 74 of file DataStack.h.


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

Generated on Wed Jun 10 22:26:25 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8