Binding of RoR::LocalStorage; A class that allows your script to store data persistently.
More...
#include <LocalStorageClass.h>
|
| LocalStorage (string filename, const string &in sectionname="common", const string &in resource_group_name="Cache") |
| The constructor for the class. More...
|
|
string | get (string key) |
| A getter for string data. More...
|
|
string | getString (string key) |
|
void | set (string key, const string value) |
|
void | setString (string key, const string value) |
| This sets a key. More...
|
|
float | getFloat (string key) |
|
void | set (string key, float value) |
|
void | setFloat (string key, float value) |
|
vector3 | getVector3 (string key) |
|
void | set (string key, const vector3 value) |
|
void | setVector3 (string key, const vector3 value) |
|
radian | getRadian (string key) |
|
void | set (string key, const radian value) |
|
void | setRadian (string key, const radian value) |
|
degree | getDegree (string key) |
|
void | set (string key, const degree value) |
|
void | setDegree (string key, const degree value) |
|
quaternion | getQuaternion (string key) |
|
void | set (string key, const quaternion value) |
|
void | setQuaternion (string key, const quaternion value) |
|
bool | getBool (string key) |
|
void | set (string key, const bool value) |
|
void | setBool (string key, const bool value) |
|
int | getInt (string key) |
|
int | getInteger (string key) |
|
void | set (string key, int) |
|
void | setInt (string key, int) |
|
void | setInteger (string key, int) |
|
void | save () |
| This saves the data to a file. More...
|
|
bool | reload () |
| This reloads the data from the saved file, overwriting your changes. More...
|
|
bool | exists (string key) const |
| Check if certain key exists. More...
|
|
void | delete (string key) |
| deletes a key and its associated value. More...
|
|
void | changeSection (const string section) |
| Changes the default section. More...
|
|
Binding of RoR::LocalStorage; A class that allows your script to store data persistently.
The data will be stored on the hard disk of the user. The data will stay available until the user clears his cache. Your data will be saved automatically if the object is destroyed or when you call the save() method. To get your data, you'll have to use the correct get function, as that function will have to convert the data from a string to the correct datatype.
Definition at line 19 of file LocalStorageClass.h.
◆ changeSection()
void Script2Game::LocalStorageClass::changeSection |
( |
const string |
section | ) |
|
Changes the default section.
- Parameters
-
◆ delete()
void Script2Game::LocalStorageClass::delete |
( |
string |
key | ) |
|
deletes a key and its associated value.
- Parameters
-
- See also
- get
◆ exists()
bool Script2Game::LocalStorageClass::exists |
( |
string |
key | ) |
const |
Check if certain key exists.
- Parameters
-
- See also
- get
- Returns
- true if the key exists.
◆ get()
string Script2Game::LocalStorageClass::get |
( |
string |
key | ) |
|
A getter for string data.
- Parameters
-
key | The key, associated with the data you want to get.
You can use a point ('.') to use another section than the default, as specified when constructing the object.
E.g.: string myValue = get("mySection.myKey"); will get the value associated with the key 'myKey' in section 'mySection'. |
- Returns
- the value associated with the key or an empty string if the key did not exist.
◆ getBool()
bool Script2Game::LocalStorageClass::getBool |
( |
string |
key | ) |
|
◆ getDegree()
degree Script2Game::LocalStorageClass::getDegree |
( |
string |
key | ) |
|
◆ getFloat()
float Script2Game::LocalStorageClass::getFloat |
( |
string |
key | ) |
|
◆ getInt()
int Script2Game::LocalStorageClass::getInt |
( |
string |
key | ) |
|
◆ getInteger()
int Script2Game::LocalStorageClass::getInteger |
( |
string |
key | ) |
|
◆ getQuaternion()
quaternion Script2Game::LocalStorageClass::getQuaternion |
( |
string |
key | ) |
|
◆ getRadian()
radian Script2Game::LocalStorageClass::getRadian |
( |
string |
key | ) |
|
◆ getString()
string Script2Game::LocalStorageClass::getString |
( |
string |
key | ) |
|
◆ getVector3()
vector3 Script2Game::LocalStorageClass::getVector3 |
( |
string |
key | ) |
|
◆ LocalStorage()
Script2Game::LocalStorageClass::LocalStorage |
( |
string |
filename, |
|
|
const string &in |
sectionname = "common" , |
|
|
const string &in |
resource_group_name = "Cache" |
|
) |
| |
The constructor for the class.
This will return a reference to the newly created object.
- Parameters
-
filename | The name of the file that should be used to save the data. |
filename | The name of the resource group where the file should be created. |
sectionname | Which section should be used by default. |
- Returns
- A reference to the new object.
◆ reload()
bool Script2Game::LocalStorageClass::reload |
( |
| ) |
|
This reloads the data from the saved file, overwriting your changes.
◆ save()
void Script2Game::LocalStorageClass::save |
( |
| ) |
|
This saves the data to a file.
The data will also be auto-saved when the object is destroyed.
◆ set() [1/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
const bool |
value |
|
) |
| |
◆ set() [2/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
const degree |
value |
|
) |
| |
◆ set() [3/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
const quaternion |
value |
|
) |
| |
◆ set() [4/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
const radian |
value |
|
) |
| |
◆ set() [5/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
const string |
value |
|
) |
| |
◆ set() [6/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
const vector3 |
value |
|
) |
| |
◆ set() [7/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
float |
value |
|
) |
| |
◆ set() [8/8]
void Script2Game::LocalStorageClass::set |
( |
string |
key, |
|
|
int |
|
|
) |
| |
◆ setBool()
void Script2Game::LocalStorageClass::setBool |
( |
string |
key, |
|
|
const bool |
value |
|
) |
| |
◆ setDegree()
void Script2Game::LocalStorageClass::setDegree |
( |
string |
key, |
|
|
const degree |
value |
|
) |
| |
◆ setFloat()
void Script2Game::LocalStorageClass::setFloat |
( |
string |
key, |
|
|
float |
value |
|
) |
| |
◆ setInt()
void Script2Game::LocalStorageClass::setInt |
( |
string |
key, |
|
|
int |
|
|
) |
| |
◆ setInteger()
void Script2Game::LocalStorageClass::setInteger |
( |
string |
key, |
|
|
int |
|
|
) |
| |
◆ setQuaternion()
void Script2Game::LocalStorageClass::setQuaternion |
( |
string |
key, |
|
|
const quaternion |
value |
|
) |
| |
◆ setRadian()
void Script2Game::LocalStorageClass::setRadian |
( |
string |
key, |
|
|
const radian |
value |
|
) |
| |
◆ setString()
void Script2Game::LocalStorageClass::setString |
( |
string |
key, |
|
|
const string |
value |
|
) |
| |
This sets a key.
- Parameters
-
- See also
- get
- Parameters
-
value | The string that should be stored. |
◆ setVector3()
void Script2Game::LocalStorageClass::setVector3 |
( |
string |
key, |
|
|
const vector3 |
value |
|
) |
| |
The documentation for this class was generated from the following file: