Polycode
|
Stores, saves and loads data. More...
Public Member Functions | |
Data () | |
Default constructor. | |
void | loadFromFile (const String &fileName) |
Loads data from a file. | |
String | getAsString (int encoding) const |
Retuns data as a string with the specified encoding. | |
void | setFromString (const String &str, int encoding) |
Sets the data from a string with the specified encoding. | |
bool | saveToFile (const String &fileName) const |
Saves the data to a file. | |
char * | getData () const |
Returns pointer to the data. |
Stores, saves and loads data.
This class can save and load arbitrary data to and from disk and convert it to strings.
String Data::getAsString | ( | int | encoding | ) | const |
Retuns data as a string with the specified encoding.
encoding | The encoding to use. Currently only supports String::ENCODING_UTF8 |
char* Polycode::Data::getData | ( | ) | const [inline] |
Returns pointer to the data.
void Data::loadFromFile | ( | const String & | fileName | ) |
Loads data from a file.
fileName | Path to the file to load data from. |
bool Data::saveToFile | ( | const String & | fileName | ) | const |
Saves the data to a file.
fileName | Path to the file to save data to. |
void Data::setFromString | ( | const String & | str, |
int | encoding | ||
) |
Sets the data from a string with the specified encoding.
str | The string to create the data from. |
encoding | The encoding to use. Currently only supports String::ENCODING_UTF8 |