#include <util.hpp>
Public Member Functions | |
| variant () | |
| Initialize the variant to an integer with the value 0. | |
| variant (int) | |
| Initialize the variant to an integer with the specified value. | |
| variant (double) | |
| Initialize the variant to a float with the specified value. | |
| variant (const std::string &) | |
| Initialize the variant to a string with the specified value. | |
| variant & | operator= (int) |
| Set the value to an integer. | |
| variant & | operator= (double) |
| Set the value to a float. | |
| variant & | operator= (const std::string &) |
| Set the value to a string. | |
| operator int () | |
| Return the value as an integer, casting if neccessary. | |
| operator double () | |
| Return the value as a float, casting if neccessary. | |
| operator std::string () | |
| Return the value as a string, casting if neccessary. | |
Protected Types | |
| enum | var_type { type_int, type_float, type_string } |
Protected Member Functions | |
| int | GetInt () |
| Return the value as an integer, casting if neccessary. | |
| double | GetFloat () |
| Return the value as a float, casting if neccessary. | |
| std::string | GetString () |
| Return the value as a string, casting if neccessary. | |
| variant & | SetInt (int) |
| Set the value to an integer. | |
| variant & | SetFloat (double) |
| Set the value to a float. | |
| variant & | SetString (const std::string &) |
| Set the value to a string. | |
| int | int_length (int) |
| Helper function that returns the string length of a number in decimal format. | |
Protected Attributes | |
| union { | |
| int val_int | |
| Value stored as an integer. | |
| double val_float | |
| Value stored as a float. | |
| }; | |
| Integer and float values are a union to save on a few bytes of memory. | |
| std::string | val_string |
| Value stored as a string. | |
| int | type |
| Current type the value is stored as. | |
It takes way too much effort to use, so it's only used by the Config class.
enum util::variant::var_type [protected] |
| util::variant::variant | ( | ) |
Initialize the variant to an integer with the value 0.
| util::variant::variant | ( | int | i | ) |
Initialize the variant to an integer with the specified value.
| util::variant::variant | ( | double | d | ) |
Initialize the variant to a float with the specified value.
| util::variant::variant | ( | const std::string & | s | ) |
Initialize the variant to a string with the specified value.
| int util::variant::GetInt | ( | ) | [protected] |
Return the value as an integer, casting if neccessary.
| double util::variant::GetFloat | ( | ) | [protected] |
Return the value as a float, casting if neccessary.
| std::string util::variant::GetString | ( | ) | [protected] |
Return the value as a string, casting if neccessary.
| variant & util::variant::SetInt | ( | int | i | ) | [protected] |
Set the value to an integer.
| variant & util::variant::SetFloat | ( | double | d | ) | [protected] |
Set the value to a float.
| variant & util::variant::SetString | ( | const std::string & | s | ) | [protected] |
Set the value to a string.
| int util::variant::int_length | ( | int | x | ) | [protected] |
Helper function that returns the string length of a number in decimal format.
| variant & util::variant::operator= | ( | int | i | ) |
Set the value to an integer.
| variant & util::variant::operator= | ( | double | d | ) |
Set the value to a float.
| variant & util::variant::operator= | ( | const std::string & | s | ) |
Set the value to a string.
| util::variant::operator int | ( | ) |
Return the value as an integer, casting if neccessary.
| util::variant::operator double | ( | ) |
Return the value as a float, casting if neccessary.
| util::variant::operator std::string | ( | ) |
Return the value as a string, casting if neccessary.
Value stored as an integer.
| double util::variant::val_float |
Value stored as a float.
union { ... } [protected] |
Integer and float values are a union to save on a few bytes of memory.
std::string util::variant::val_string [protected] |
Value stored as a string.
int util::variant::type [protected] |
Current type the value is stored as.
Accessing as this type will need no conversion.
1.5.7.1