PGE API 0.4
PR00F's Game Engine full documentation
|
PR00F's Game Engine cfg variable (cvar) class. More...
PR00F's Game Engine cfg variable (cvar) class.
This class can hold a value of an arbitrary type.
Definition at line 44 of file PGEcfgVariable.h.
#include <PGEcfgVariable.h>
Public Member Functions | |
PGEcfgVariable () | |
Constructs a string-typed cvar. | |
PGEcfgVariable (const int &value) | |
Constructs an integer-typed cvar. | |
PGEcfgVariable (const unsigned int &value) | |
Constructs an unsigned integer-typed cvar. | |
PGEcfgVariable (const float &value) | |
Constructs a floating point-typed cvar. | |
PGEcfgVariable (const bool &value) | |
Constructs a boolean-typed cvar. | |
PGEcfgVariable (const char *value) | |
Constructs a string-typed cvar. | |
PGEcfgVariable (const std::string &value) | |
Constructs a string-typed cvar. | |
virtual | ~PGEcfgVariable () |
int | getAsInt () const noexcept(true) |
Tries to return the value of the cvar as an integer. | |
unsigned int | getAsUInt () const noexcept(true) |
Tries to return the value of the cvar as an unsigned integer. | |
float | getAsFloat () const noexcept(true) |
Tries to return the value of the cvar as a floating point number. | |
bool | getAsBool () const noexcept(true) |
Returns the value of the cvar as a boolean. | |
const std::string & | getAsString () const noexcept(true) |
Returns the value of the cvar as a string. | |
const TPGE_CFG_VARIABLE_TYPE & | getType () const noexcept(true) |
Returns the type of the cvar. | |
void | Set (const int &value) |
void | Set (const unsigned int &value) |
void | Set (const float &value) |
void | Set (const bool &value) |
void | Set (const char *value) |
void | Set (const std::string &value) |
std::string & | getShortHint () |
Get/Set for a short one-liner description of this CVAR. | |
const std::string & | getShortHint () const |
Getter for a short one-liner description of this CVAR. | |
std::vector< std::string > & | getLongHint () |
Get/Set for a longer description of this CVAR. | |
const std::vector< std::string > & | getLongHint () const |
Getter for a longer description of this CVAR. | |
bool | operator== (const int &other) const |
Equals to. | |
bool | operator== (const unsigned int &other) const |
Equals to. | |
bool | operator== (const float &other) const |
Equals to. | |
bool | operator== (const bool &other) const |
Equals to. | |
bool | operator== (const std::string &other) const |
Equals to. | |
bool | operator== (const PGEcfgVariable &other) const |
Equals to. | |
bool | operator!= (const int &other) const |
Not equals to. | |
bool | operator!= (const unsigned int &other) const |
Not equals to. | |
bool | operator!= (const float &other) const |
Not equals to. | |
bool | operator!= (const bool &other) const |
Not equals to. | |
bool | operator!= (const std::string &other) const |
Not equals to. | |
bool | operator!= (const PGEcfgVariable &other) const |
Not equals to. | |
PGEcfgVariable & | operator= (const PGEcfgVariable &other) |
Assignment. | |
PGEcfgVariable | operator+ (const PGEcfgVariable &other) const |
Addition. | |
PGEcfgVariable & | operator+= (const PGEcfgVariable &other) |
Addition assignment. | |
PGEcfgVariable | operator- (const PGEcfgVariable &other) const |
Subtraction. | |
PGEcfgVariable & | operator-= (const PGEcfgVariable &other) |
Subtraction assignment. | |
PGEcfgVariable | operator* (const PGEcfgVariable &other) const |
Multiplication by scalar. | |
PGEcfgVariable & | operator*= (const PGEcfgVariable &other) |
Multiplication assignment. | |
PGEcfgVariable | operator/ (const PGEcfgVariable &other) const |
Division by scalar. | |
PGEcfgVariable & | operator/= (const PGEcfgVariable &other) |
Division assignment. | |
PGEcfgVariable | operator% (const PGEcfgVariable &other) const |
Modulo division by scalar. | |
PGEcfgVariable & | operator%= (const PGEcfgVariable &other) |
Modulo division assignment. | |
PGEcfgVariable & | operator++ () |
Prefix increment. | |
PGEcfgVariable | operator++ (int) |
Postfix increment. | |
PGEcfgVariable & | operator-- () |
Prefix decrement. | |
PGEcfgVariable | operator-- (int) |
Postfix decrement. | |
Private Attributes | |
std::string | sValue |
TPGE_CFG_VARIABLE_TYPE | type |
std::string | sShortHint |
std::vector< std::string > | vsLongHint |
PGEcfgVariable::PGEcfgVariable | ( | ) |
Constructs a string-typed cvar.
Definition at line 37 of file PGEcfgVariable.cpp.
PGEcfgVariable::PGEcfgVariable | ( | const int & | value | ) |
Constructs an integer-typed cvar.
Definition at line 45 of file PGEcfgVariable.cpp.
PGEcfgVariable::PGEcfgVariable | ( | const unsigned int & | value | ) |
Constructs an unsigned integer-typed cvar.
Definition at line 53 of file PGEcfgVariable.cpp.
PGEcfgVariable::PGEcfgVariable | ( | const float & | value | ) |
Constructs a floating point-typed cvar.
Definition at line 61 of file PGEcfgVariable.cpp.
PGEcfgVariable::PGEcfgVariable | ( | const bool & | value | ) |
Constructs a boolean-typed cvar.
Definition at line 69 of file PGEcfgVariable.cpp.
PGEcfgVariable::PGEcfgVariable | ( | const char * | value | ) |
Constructs a string-typed cvar.
Definition at line 77 of file PGEcfgVariable.cpp.
PGEcfgVariable::PGEcfgVariable | ( | const std::string & | value | ) |
Constructs a string-typed cvar.
Definition at line 85 of file PGEcfgVariable.cpp.
|
virtual |
Definition at line 90 of file PGEcfgVariable.cpp.
|
noexcept |
Returns the value of the cvar as a boolean.
Definition at line 174 of file PGEcfgVariable.cpp.
|
noexcept |
Tries to return the value of the cvar as a floating point number.
Definition at line 149 of file PGEcfgVariable.cpp.
|
noexcept |
Tries to return the value of the cvar as an integer.
Definition at line 103 of file PGEcfgVariable.cpp.
|
noexcept |
Returns the value of the cvar as a string.
Definition at line 205 of file PGEcfgVariable.cpp.
|
noexcept |
Tries to return the value of the cvar as an unsigned integer.
Definition at line 126 of file PGEcfgVariable.cpp.
std::vector< std::string > & PGEcfgVariable::getLongHint | ( | ) |
Get/Set for a longer description of this CVAR.
This text will appear in the configuration file right below the CVAR definition, it can explain the purpose and effects of this CVAR in more details, even in multiple lines. You can wrap this text into multiple lines: one element of the vector represent one line. Just make sure a single line is no longer than 80-120 characters so no "word wrap" is needed to be enabled in a text editor for properly viewing the configuration file. Neither the short- nor the long hint text is mandatory.
Definition at line 300 of file PGEcfgVariable.cpp.
const std::vector< std::string > & PGEcfgVariable::getLongHint | ( | ) | const |
Getter for a longer description of this CVAR.
This text will appear in the configuration file right below the CVAR definition, it can explain the purpose and effects of this CVAR in more details, even in multiple lines. You can wrap this text into multiple lines: one element of the vector represent one line. Just make sure a single line is no longer than 80-120 characters so no "word wrap" is needed to be enabled in a text editor for properly viewing the configuration file. Neither the short- nor the long hint text is mandatory.
Definition at line 316 of file PGEcfgVariable.cpp.
std::string & PGEcfgVariable::getShortHint | ( | ) |
Get/Set for a short one-liner description of this CVAR.
This one-liner will appear in the configuration file right above the CVAR definition, so it should not be longer than 80-120 characters. Neither the short- nor the long hint string is mandatory.
Definition at line 271 of file PGEcfgVariable.cpp.
const std::string & PGEcfgVariable::getShortHint | ( | ) | const |
Getter for a short one-liner description of this CVAR.
This one-liner will appear in the configuration file right above the CVAR definition, so it should not be longer than 80-120 characters. Neither the short- nor the long hint string is mandatory.
Definition at line 284 of file PGEcfgVariable.cpp.
|
noexcept |
Returns the type of the cvar.
Definition at line 216 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator!= | ( | const bool & | other | ) | const |
Not equals to.
Definition at line 429 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator!= | ( | const float & | other | ) | const |
Not equals to.
Definition at line 421 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator!= | ( | const int & | other | ) | const |
Not equals to.
Definition at line 405 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator!= | ( | const PGEcfgVariable & | other | ) | const |
Not equals to.
Definition at line 445 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator!= | ( | const std::string & | other | ) | const |
Not equals to.
Definition at line 437 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator!= | ( | const unsigned int & | other | ) | const |
Not equals to.
Definition at line 413 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator% | ( | const PGEcfgVariable & | other | ) | const |
Modulo division by scalar.
Modulo division is supported for int-typed and unsigned int-typed cvars only.
Definition at line 630 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator%= | ( | const PGEcfgVariable & | other | ) |
Modulo division assignment.
Definition at line 664 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator* | ( | const PGEcfgVariable & | other | ) | const |
Multiplication by scalar.
Multiplication of bool-typed and string-typed cvars is not supported. Multiplication is supported for int-, unsigned int- and float-typed cvars.
Definition at line 551 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator*= | ( | const PGEcfgVariable & | other | ) |
Multiplication assignment.
Definition at line 571 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator+ | ( | const PGEcfgVariable & | other | ) | const |
Addition.
Addition of bool-typed cvars is not supported. Addition is supported for int-, unsigned int-, float- and string-typed cvars.
Definition at line 475 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator++ | ( | ) |
Prefix increment.
This only works if the type of the cvar is int or unsigned int.
Definition at line 675 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator++ | ( | int | ) |
Postfix increment.
This only works if the type of the cvar is int or unsigned int.
Definition at line 692 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator+= | ( | const PGEcfgVariable & | other | ) |
Addition assignment.
Definition at line 495 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator- | ( | const PGEcfgVariable & | other | ) | const |
Subtraction.
Subtraction of bool-typed and string-typed cvars is not supported. Subtraction is supported for int-, unsigned int- and float-typed cvars.
Definition at line 513 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator-- | ( | ) |
Prefix decrement.
This only works if the type of the cvar is int or unsigned int.
Definition at line 713 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator-- | ( | int | ) |
Postfix decrement.
This only works if the type of the cvar is int or unsigned int.
Definition at line 730 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator-= | ( | const PGEcfgVariable & | other | ) |
Subtraction assignment.
Definition at line 533 of file PGEcfgVariable.cpp.
PGEcfgVariable PGEcfgVariable::operator/ | ( | const PGEcfgVariable & | other | ) | const |
Division by scalar.
Division of bool-typed and string-typed cvars is not supported. Division is supported for int-, unsigned int- and float-typed cvars.
Definition at line 590 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator/= | ( | const PGEcfgVariable & | other | ) |
Division assignment.
Definition at line 613 of file PGEcfgVariable.cpp.
PGEcfgVariable & PGEcfgVariable::operator= | ( | const PGEcfgVariable & | other | ) |
Assignment.
Definition at line 454 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator== | ( | const bool & | other | ) | const |
Equals to.
Definition at line 373 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator== | ( | const float & | other | ) | const |
Equals to.
Definition at line 358 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator== | ( | const int & | other | ) | const |
Equals to.
Definition at line 326 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator== | ( | const PGEcfgVariable & | other | ) | const |
Equals to.
Definition at line 397 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator== | ( | const std::string & | other | ) | const |
Equals to.
Definition at line 383 of file PGEcfgVariable.cpp.
bool PGEcfgVariable::operator== | ( | const unsigned int & | other | ) | const |
Equals to.
Definition at line 342 of file PGEcfgVariable.cpp.
void PGEcfgVariable::Set | ( | const bool & | value | ) |
Definition at line 245 of file PGEcfgVariable.cpp.
void PGEcfgVariable::Set | ( | const char * | value | ) |
Definition at line 251 of file PGEcfgVariable.cpp.
void PGEcfgVariable::Set | ( | const float & | value | ) |
Definition at line 237 of file PGEcfgVariable.cpp.
void PGEcfgVariable::Set | ( | const int & | value | ) |
Definition at line 221 of file PGEcfgVariable.cpp.
void PGEcfgVariable::Set | ( | const std::string & | value | ) |
Definition at line 257 of file PGEcfgVariable.cpp.
void PGEcfgVariable::Set | ( | const unsigned int & | value | ) |
Definition at line 229 of file PGEcfgVariable.cpp.
|
private |
Definition at line 115 of file PGEcfgVariable.h.
|
private |
Definition at line 113 of file PGEcfgVariable.h.
|
private |
Definition at line 114 of file PGEcfgVariable.h.
|
private |
Definition at line 116 of file PGEcfgVariable.h.