Enigma  3.2.0
A Simple, Reliable and Efficient Encryption Tool
Config Class Reference

#include <Config.hpp>

Public Member Functions

 Config (const fs::path &file_name)
 
 ~Config ()=default
 
template<typename T >
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, T >::type Get (const std::string &section, const std::string &name, const T &default_value) const
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, T >::type Get (const std::string &section, const std::string &name, const T &default_value) const
 
template<typename T >
std::enable_if< std::is_same< T, bool >::value, T >::type Get (const std::string &section, const std::string &name, const T &default_value) const
 
template<typename T >
std::enable_if< std::is_same< T, std::string >::value, T >::type Get (const std::string &section, const std::string &name, const T &default_value) const
 

Detailed Description

Config file Loader (.ini)

Definition at line 11 of file Config.hpp.

Constructor & Destructor Documentation

◆ Config()

Config::Config ( const fs::path &  file_name)
explicit

Config Constructor Loads and initializes config file

Parameters
file_nameini config file path
Exceptions
std::runtime_erroron failure

◆ ~Config()

Config::~Config ( )
default

Member Function Documentation

◆ Get() [1/4]

template<typename T >
std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type Config::Get ( const std::string &  section,
const std::string &  name,
const T default_value 
) const
inline

Get integer fields from loaded config file Integers (and make sure its not bool since its also considered integral : https://stackoverflow.com/questions/51859172/recognize-that-a-value-is-bool-in-a-template)

Parameters
sectionsection name
namefield name
default_valuedefault value to return if field not found

Definition at line 30 of file Config.hpp.

◆ Get() [2/4]

template<typename T >
std::enable_if<std::is_floating_point<T>::value, T>::type Config::Get ( const std::string &  section,
const std::string &  name,
const T default_value 
) const
inline

Get Floating point fields from loaded config file

Parameters
sectionsection name
namefield name
default_valuedefault value to return if field not found

Definition at line 41 of file Config.hpp.

◆ Get() [3/4]

template<typename T >
std::enable_if<std::is_same<T, bool>::value, T>::type Config::Get ( const std::string &  section,
const std::string &  name,
const T default_value 
) const
inline

Get Boolean fields from loaded config file

Parameters
sectionsection name
namefield name
default_valuedefault value to return if field not found

Definition at line 52 of file Config.hpp.

◆ Get() [4/4]

template<typename T >
std::enable_if<std::is_same<T, std::string>::value, T>::type Config::Get ( const std::string &  section,
const std::string &  name,
const T default_value 
) const
inline

Get std::string fields from loaded config file

Parameters
sectionsection name
namefield name
default_valuedefault value to return if field not found

Definition at line 63 of file Config.hpp.


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