InspIRCd  3.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ConfigTag Class Reference

#include <configreader.h>

Inheritance diagram for ConfigTag:
refcountbase

Public Member Functions

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 ConfigItemsgetItems () const
 
- Public Member Functions inherited from refcountbase
unsigned int GetReferenceCount () const
 
void refcount_inc () const
 
bool refcount_dec () const
 

Static Public Member Functions

static ConfigTagcreate (const std::string &Tag, const std::string &file, int line, ConfigItems *&Items)
 
- Static Public Member Functions inherited from refcountbase
static void * operator new (size_t, void *m)
 
static void * operator new (size_t)
 
static void operator delete (void *)
 

Public Attributes

const std::string tag
 
const std::string src_name
 
const int src_line
 

Detailed Description

Structure representing a single <tag> in config

Member Function Documentation

◆ 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
keyThe config key name
defDefault value (optional)
minMinimum acceptable value (optional)
maxMaximum 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
keyThe option to get
valueThe location to store the value (unmodified if does not exist)
allow_newlineAllow 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: