Class configPerser#

Class Documentation#

class configPerser#

Small configuration-file parser for simple key/value settings.

The parser reads a plain-text configuration file of the form: key = value

Blank lines and comment lines beginning with ‘#’ are ignored.

Public Functions

inline configPerser()#

Read configuration entries from the configured file.

The file is scanned line by line, trimming whitespace around keys and values. Entries without a ‘=’ are ignored.

template<typename T>
inline T get(const std::string &key)#

Retrieve a configuration value converted to the requested type.

Template Parameters:

T – Output type: double, int, bool, or std::string.

Parameters:

key – Name of the configuration entry.

Throws:

std::runtime_error – If the key is missing or has an invalid format.

Returns:

Parsed value of that key.

inline void print()#

Print all parsed configuration entries to standard output.

Public Static Attributes

static const std::string configFileName#

File name used when opening the configuration file.