#include <configreader.h>
|
std::string | getString (const std::string &key, const std::string &def, const std::tr1 ::function< bool(const std::string &)> &validator) |
|
std::string | getString (const std::string &key, const std::string &def="", size_t minlen=0, size_t maxlen=UINT32_MAX) |
|
long | getInt (const std::string &key, long def, long min=LONG_MIN, long max=LONG_MAX) |
|
unsigned long | getUInt (const std::string &key, unsigned long def, unsigned long min=0, unsigned long max=ULONG_MAX) |
|
double | getFloat (const std::string &key, double def, double min=DBL_MIN, double max=DBL_MAX) |
|
bool | getBool (const std::string &key, bool def=false) |
|
unsigned long | getDuration (const std::string &key, unsigned long def, unsigned long min=0, unsigned long max=ULONG_MAX) |
|
bool | readString (const std::string &key, std::string &value, bool allow_newline=false) |
|
std::string | getTagLocation () |
|
const ConfigItems & | getItems () const |
|
unsigned int | GetReferenceCount () const |
|
void | refcount_inc () const |
|
bool | refcount_dec () const |
|
|
static ConfigTag * | create (const std::string &Tag, const std::string &file, int line, ConfigItems *&Items) |
|
static void * | operator new (size_t, void *m) |
|
static void * | operator new (size_t) |
|
static void | operator delete (void *) |
|
|
const std::string | tag |
|
const std::string | src_name |
|
const int | src_line |
|
Structure representing a single <tag> in config
◆ create()
ConfigTag * ConfigTag::create |
( |
const std::string & |
Tag, |
|
|
const std::string & |
file, |
|
|
int |
line, |
|
|
ConfigItems *& |
Items |
|
) |
| |
|
static |
Create a new ConfigTag, giving access to the private ConfigItems item list
◆ getBool()
bool ConfigTag::getBool |
( |
const std::string & |
key, |
|
|
bool |
def = false |
|
) |
| |
Get the value of an option, using def if it does not exist
◆ getDuration()
unsigned long ConfigTag::getDuration |
( |
const std::string & |
key, |
|
|
unsigned long |
def, |
|
|
unsigned long |
min = 0 , |
|
|
unsigned long |
max = ULONG_MAX |
|
) |
| |
Get the value in seconds of a duration that is in the user-friendly "1h2m3s" format, using a default value if it does not exist or is out of bounds.
- Parameters
-
key | The config key name |
def | Default value (optional) |
min | Minimum acceptable value (optional) |
max | Maximum acceptable value (optional) |
- Returns
- The duration in seconds
◆ getFloat()
double ConfigTag::getFloat |
( |
const std::string & |
key, |
|
|
double |
def, |
|
|
double |
min = DBL_MIN , |
|
|
double |
max = DBL_MAX |
|
) |
| |
Get the value of an option, using def if it does not exist
◆ getInt()
long ConfigTag::getInt |
( |
const std::string & |
key, |
|
|
long |
def, |
|
|
long |
min = LONG_MIN , |
|
|
long |
max = LONG_MAX |
|
) |
| |
Get the value of an option, using def if it does not exist
◆ getString() [1/2]
std::string ConfigTag::getString |
( |
const std::string & |
key, |
|
|
const std::string & |
def, |
|
|
const std::tr1 ::function< bool(const std::string &)> & |
validator |
|
) |
| |
Get the value of an option, using def if it does not exist
◆ getString() [2/2]
std::string ConfigTag::getString |
( |
const std::string & |
key, |
|
|
const std::string & |
def = "" , |
|
|
size_t |
minlen = 0 , |
|
|
size_t |
maxlen = UINT32_MAX |
|
) |
| |
Get the value of an option, using def if it does not exist
◆ getUInt()
unsigned long ConfigTag::getUInt |
( |
const std::string & |
key, |
|
|
unsigned long |
def, |
|
|
unsigned long |
min = 0 , |
|
|
unsigned long |
max = ULONG_MAX |
|
) |
| |
Get the value of an option, using def if it does not exist
◆ readString()
bool ConfigTag::readString |
( |
const std::string & |
key, |
|
|
std::string & |
value, |
|
|
bool |
allow_newline = false |
|
) |
| |
Get the value of an option
- Parameters
-
key | The option to get |
value | The location to store the value (unmodified if does not exist) |
allow_newline | Allow newlines in the option (normally replaced with spaces) |
- Returns
- true if the option exists
The documentation for this class was generated from the following files: