Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

configparser

configparser is a simple C++ config parser library.

Build instructions

Requirements:

  1. CMake 3.17.0 or higher
  2. Compiler supporting C++17

Steps:

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make
    Tests can be run with the following command ./tests/test

Basic usage

ConfigParser parser("<path>");
parser.SetValue("int_value", 55);
parser.Save();

int val = parser.GetValue<int>("int_value");

Default value can be provided to be returned if key was not found
int val = parser.GetValue("int_value", 44);

Template parameter can be ommitted when default value is provided because compiler can deduce the type from argument.

If key cannot be found and the default argument is not provided GetValue will throw a std::invalid_argument exception.
If the default argument is provided exception will not be thrown and instead the value will be returned.

Note*
Library doesn't support sections yet

About

C++ config parser library

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages