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...

Inheritance diagram for DataStack:

Inheritance graph
[legend]
Collaboration diagram for DataStack:

Collaboration graph
[legend]

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.
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 removeVars ()
 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.


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 33 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 53 of file DataStack.cpp.

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

Gets the name of the DataStack.

Definition at line 59 of file DataStack.cpp.

u32 DataStack::getSize (  )  const

Gets the number of variables on the DataStack.

Definition at line 65 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 87 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 143 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 255 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 92 of file DataStack.cpp.

void DataStack::removeVars (  ) 

Removes all variables from this DataStack.

Definition at line 86 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 107 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 222 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 64 of file DataStack.h.


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

Generated on Fri Aug 21 23:55:13 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8