Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Public Member Functions | List of all members
toolbox::util::Config Class Reference

Simple config reader with environment variable substitution. More...

#include <toolbox/util/Config.hpp>

Public Member Functions

 Config ()
 
 ~Config ()
 
 Config (const Config &)
 
Configoperator= (const Config &)
 
 Config (Config &&) noexcept
 
Configoperator= (Config &&) noexcept
 
const std::string & get (const std::string &key) const
 Throws std::runtime_error if key does not exist.
 
const charget (const std::string &key, const char *dfl) const noexcept
 
const charget (const std::string &key, std::nullptr_t) const noexcept
 
template<typename ValueT >
ValueT get (const std::string &key) const
 Throws std::runtime_error if key does not exist.
 
template<typename ValueT >
ValueT get (const std::string &key, ValueT dfl) const noexcept
 
std::size_t size () const noexcept
 
void clear () noexcept
 
std::istream & read_section (std::istream &is)
 
std::istream & read_section (std::istream &&is)
 
std::istream & read_section (std::istream &is, std::string &next)
 
std::istream & read_section (std::istream &&is, std::string &next)
 
void set (std::string key, std::string val)
 
void set_parent (Config &parent) noexcept
 

Detailed Description

Simple config reader with environment variable substitution.

Definition at line 67 of file Config.hpp.

Constructor & Destructor Documentation

◆ Config() [1/3]

toolbox::util::Config::Config ( )
default

◆ ~Config()

toolbox::util::Config::~Config ( )
default

◆ Config() [2/3]

toolbox::util::Config::Config ( const Config )
default

◆ Config() [3/3]

toolbox::util::Config::Config ( Config &&  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

Config & toolbox::util::Config::operator= ( const Config )
default

◆ operator=() [2/2]

Config & toolbox::util::Config::operator= ( Config &&  )
defaultnoexcept

◆ get() [1/5]

const std::string & toolbox::util::Config::get ( const std::string &  key) const

Throws std::runtime_error if key does not exist.

Definition at line 36 of file Config.cpp.

Referenced by get().

◆ get() [2/5]

const char * toolbox::util::Config::get ( const std::string &  key,
const char dfl 
) const
noexcept

Definition at line 48 of file Config.cpp.

◆ get() [3/5]

const char * toolbox::util::Config::get ( const std::string &  key,
std::nullptr_t   
) const
inlinenoexcept

Definition at line 83 of file Config.hpp.

◆ get() [4/5]

template<typename ValueT >
ValueT toolbox::util::Config::get ( const std::string &  key) const
inline

Throws std::runtime_error if key does not exist.

Definition at line 89 of file Config.hpp.

◆ get() [5/5]

template<typename ValueT >
ValueT toolbox::util::Config::get ( const std::string &  key,
ValueT  dfl 
) const
inlinenoexcept

Definition at line 109 of file Config.hpp.

◆ size()

std::size_t toolbox::util::Config::size ( ) const
inlinenoexcept

Definition at line 125 of file Config.hpp.

◆ clear()

void toolbox::util::Config::clear ( )
inlinenoexcept

Definition at line 126 of file Config.hpp.

◆ read_section() [1/4]

std::istream & toolbox::util::Config::read_section ( std::istream &  is)
inline

Definition at line 127 of file Config.hpp.

Referenced by toolbox::util::MultiConfig::read(), and read_section().

◆ read_section() [2/4]

std::istream & toolbox::util::Config::read_section ( std::istream &&  is)
inline

Definition at line 128 of file Config.hpp.

Referenced by read_section().

◆ read_section() [3/4]

std::istream & toolbox::util::Config::read_section ( std::istream &  is,
std::string &  next 
)
inline

Definition at line 129 of file Config.hpp.

◆ read_section() [4/4]

std::istream & toolbox::util::Config::read_section ( std::istream &&  is,
std::string &  next 
)
inline

Definition at line 133 of file Config.hpp.

◆ set()

void toolbox::util::Config::set ( std::string  key,
std::string  val 
)
inline

Definition at line 137 of file Config.hpp.

◆ set_parent()

void toolbox::util::Config::set_parent ( Config parent)
inlinenoexcept

Definition at line 141 of file Config.hpp.

Referenced by toolbox::util::MultiConfig::read().


The documentation for this class was generated from the following files: