38 #ifndef ASYNC_CONFIG_INCLUDED 39 #define ASYNC_CONFIG_INCLUDED 156 bool open(
const std::string& name);
170 const std::string &
getValue(
const std::string& section,
171 const std::string& tag)
const;
185 bool getValue(
const std::string& section,
const std::string& tag,
186 std::string& value)
const;
208 template <
typename Rsp>
209 bool getValue(
const std::string& section,
const std::string& tag,
210 Rsp &rsp,
bool missing_ok =
false)
const 213 if (!
getValue(section, tag, str_val))
217 std::stringstream ssval(str_val);
224 if (ssval.fail() || !ssval.eof())
252 template <
template <
typename,
typename>
class Container,
254 bool getValue(
const std::string& section,
const std::string& tag,
255 Container<Value, std::allocator<Value> > &c,
256 bool missing_ok =
false)
const 259 if (!
getValue(section, tag, str_val))
268 std::stringstream ssval(str_val);
307 template <
typename Rsp>
308 bool getValue(
const std::string& section,
const std::string& tag,
309 const Rsp& min,
const Rsp& max, Rsp &rsp,
310 bool missing_ok =
false)
const 313 if (!
getValue(section, tag, str_val))
317 std::stringstream ssval(str_val);
324 if (ssval.fail() || !ssval.eof() || (tmp < min) || (tmp > max))
338 std::list<std::string>
listSection(
const std::string& section);
353 void setValue(
const std::string& section,
const std::string& tag,
354 const std::string& value);
357 typedef std::map<std::string, std::string> Values;
358 typedef std::map<std::string, Values> Sections;
363 bool parseCfgFile(
void);
364 char *trimSpaces(
char *line);
365 char *parseSection(
char *line);
366 char *parseDelimitedString(
char *str,
char begin_tok,
char end_tok);
367 bool parseValueLine(
char *line, std::string& tag, std::string& value);
368 char *parseValue(
char *value);
369 char *translateEscapedChars(
char *val);
bool getValue(const std::string §ion, const std::string &tag, Container< Value, std::allocator< Value > > &c, bool missing_ok=false) const
Get the value of the given config variable into container.
bool getValue(const std::string §ion, const std::string &tag, Rsp &rsp, bool missing_ok=false) const
Get the value of the given configuration variable.
Config(void)
Default constuctor.
void setValue(const std::string §ion, const std::string &tag, const std::string &value)
Set the value of a configuration variable.
const std::string & getValue(const std::string §ion, const std::string &tag) const
Return the string value of the given configuration variable.
bool open(const std::string &name)
Open the given config file.
std::list< std::string > listSection(const std::string §ion)
Return the name of all the tags in the given section.
A class for reading INI-formatted configuration files.
Namespace for the asynchronous programming classes.
bool getValue(const std::string §ion, const std::string &tag, const Rsp &min, const Rsp &max, Rsp &rsp, bool missing_ok=false) const
Get a range checked variable value.