Knoodle
Knoodle is a Free Open-Source alternative for graph-based texture designers. It is a tool for creating procedural textures using a node-based graph editor. It is designed to be easy to use, to be able to create complex textures with a minimum of effort, and to be pluggable to any game engine and front-end.
 
Loading...
Searching...
No Matches
kn::ConfigManager Class Reference

#include <config_manager.hpp>

Public Member Functions

bool load_config (const std::filesystem::path &file_path)
 
std::set< std::string > get_sections () const
 
std::optional< std::string > get_value (const std::string_view &key) const
 
std::optional< int32_t > get_int_value (const std::string_view &key) const
 
std::optional< real_t > get_real_value (const std::string_view &key) const
 
std::optional< bool > get_bool_value (const std::string_view &key) const
 

Static Public Member Functions

static ConfigManagerget_instance ()
 

Protected Member Functions

virtual void parse_line (const std::string_view &line)
 
virtual void parse_key_value (const std::string_view &line)
 
virtual void parse_comment (const std::string_view &line)
 
virtual void parse_section (const std::string_view &line)
 
virtual void parse_blank (const std::string_view &line)
 

Detailed Description

Manages the configuration of the application. The configuration is read from a file and stored in memory.

Member Function Documentation

◆ get_bool_value()

std::optional< bool > kn::ConfigManager::get_bool_value ( const std::string_view &  key) const

Returns a value by key as boolean.

Parameters
keyThe key to search for.
Returns
The value associated with the key, if it exists.

◆ get_int_value()

std::optional< int32_t > kn::ConfigManager::get_int_value ( const std::string_view &  key) const

Returns a value by key as integer.

Parameters
keyThe key to search for.
Returns
The value associated with the key, if it exists.

◆ get_real_value()

std::optional< real_t > kn::ConfigManager::get_real_value ( const std::string_view &  key) const

Returns a value by key as real_t.

Parameters
keyThe key to search for.
Returns
The value associated with the key, if it exists.

◆ get_sections()

std::set< std::string > kn::ConfigManager::get_sections ( ) const

Return a set of all the registered sections.

◆ get_value()

std::optional< std::string > kn::ConfigManager::get_value ( const std::string_view &  key) const

Returns a value by key.

Parameters
keyThe key to search for.
Returns
The value associated with the key, if it exists.

◆ load_config()

bool kn::ConfigManager::load_config ( const std::filesystem::path &  file_path)

Loads the configuration from a file and append it to the current configuration.

Parameters
file_pathThe path to the file to load.
Returns
True if the file was successfully loaded, false otherwise.

◆ parse_blank()

void kn::ConfigManager::parse_blank ( const std::string_view &  line)
protectedvirtual

Parses a blank line from a line.

Parameters
lineThe line to parse.

◆ parse_comment()

void kn::ConfigManager::parse_comment ( const std::string_view &  line)
protectedvirtual

Parses a comment from a line.

Parameters
lineThe line to parse.

◆ parse_key_value()

void kn::ConfigManager::parse_key_value ( const std::string_view &  line)
protectedvirtual

Parses a key-value pair from a line.

Parameters
lineThe line to parse.

◆ parse_line()

void kn::ConfigManager::parse_line ( const std::string_view &  line)
protectedvirtual

Parses a line from the configuration file.

Parameters
lineThe line to parse.

◆ parse_section()

void kn::ConfigManager::parse_section ( const std::string_view &  line)
protectedvirtual

Parses a section from a line.

Parameters
lineThe line to parse.

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