38 #ifndef ASYNC_CONFIG_INCLUDED
39 #define ASYNC_CONFIG_INCLUDED
140 Config(
void) : file(NULL) {}
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);