Planeshift
|
This class rappresents an option tree which comes from the server_options table. More...
#include <cachemanager.h>
Public Member Functions | |
optionEntry * | getOption (const csString path) |
Gets an option entry in the tree. | |
optionEntry * | getOptionSafe (const csString path, const csString fallback) |
Does the same of getOption, but, in case the entry is missing, an empty option will be added to the tree. | |
csString | getValue () |
Get the value of this specific option. | |
double | getValueAsDouble () |
Get the value of this specific option in double format. | |
int | getValueAsInt () |
Get the value of this specific option in int format. | |
csVector3 | getValueAsVector () |
Get the value of this specific option in csVector3 format. | |
bool | getValueAsVector (csVector3 &vector) |
Get the value of this specific option in csVector3 format. | |
bool | setOption (const csString path, const csString value) |
Sets an option in the option tree. | |
void | setValue (const csString newValue) |
Sets the value of this specific option to a newvalue. |
This class rappresents an option tree which comes from the server_options table.
You can iterate the tree starting from the root or get a leaf and start search from there: useful if a specific class/manager wants to keep only the reference to the options it needs in place of iterating the entire tree each time. All the entries in the tree are the same, so you can assign and get a value to/from any. Right now : is used as path delimiter.
Definition at line 147 of file cachemanager.h.
optionEntry* optionEntry::getOption | ( | const csString | path | ) |
Gets an option entry in the tree.
It doesn't have to be the actual option we want a value from but also a folder containing the set of options we are interested for. This is useful to allow managers to keep their reference to a specific part of the tree and so avoid going through all the branches to reach what they are interested each time.
path | A path to the optionEntry we are interested in. |
optionEntry* optionEntry::getOptionSafe | ( | const csString | path, |
const csString | fallback | ||
) |
Does the same of getOption, but, in case the entry is missing, an empty option will be added to the tree.
path | A path to the optionEntry we are interested in. |
fallback | A value to associate to the option in case it was not found. |
csString optionEntry::getValue | ( | ) | [inline] |
Get the value of this specific option.
Definition at line 164 of file cachemanager.h.
double optionEntry::getValueAsDouble | ( | ) | [inline] |
Get the value of this specific option in double format.
Definition at line 171 of file cachemanager.h.
int optionEntry::getValueAsInt | ( | ) | [inline] |
Get the value of this specific option in int format.
Definition at line 178 of file cachemanager.h.
csVector3 optionEntry::getValueAsVector | ( | ) |
Get the value of this specific option in csVector3 format.
This function takes in account the format is x,y,z as text, returns a vector with 0,0,0 in case of error.
bool optionEntry::getValueAsVector | ( | csVector3 & | vector | ) |
Get the value of this specific option in csVector3 format.
This function takes in account the format is x,y,z as text, this version allows to check if there was a conversion error.
vector | A reference to a vector where the value will be stored. |
bool optionEntry::setOption | ( | const csString | path, |
const csString | value | ||
) |
Sets an option in the option tree.
path | A path relative to this optionEntry. It's the full path only when using the "root" optionEntry. |
value | The value to set to the option we are adding to the tree. |
void optionEntry::setValue | ( | const csString | newValue | ) | [inline] |
Sets the value of this specific option to a newvalue.
newValue | The new string to assign to this option |
Definition at line 157 of file cachemanager.h.