This project provides a full-featured, dependency-free implementation of the Erbsland Configuration Language for modern C++ (C++20 and newer).
- Fully implements the Erbsland Configuration Language.
- Thoroughly tested and stable for use in productive development.
- The API is stable.
- The documentation covers the most important features.
#include <erbsland/all_conf.hpp>
#include <filesystem>
#include <iostream>
#include <format>
using namespace el::conf;
int main(int argc, char **argv) {
if (argc < 2) {
std::cout << "Usage: " << argv[0] << " <config-file>\n";
return 1;
}
const auto configFile = std::filesystem::path{argv[1]};
try {
Parser parser;
const auto source = Source::fromFile(configFile);
const auto doc = parser.parseOrThrow(source);
auto width = doc->getIntegerOrThrow(u8"field.width");
auto height = doc->getIntegerOrThrow(u8"field.height");
std::cout << std::format("Field width = {}, height = {}\n", width, height);
return 0;
} catch (const Error &error) {
std::cerr << error.toText().toCharString() << "\n";
return 1;
}
}
Please read the documentation for more information about the parser and its features:
👉 Erbsland Configuration Parser Documentation
The Erbsland Configuration Language is a human-friendly format designed for writing clear and structured configuration files. It combines a strict, well-defined syntax with flexibility in formatting, making configurations easier to read and maintain.
Here’s an example of a configuration file in a more descriptive style:
# Comments are allowed almost everywhere.
---[ Main Settings ] -------------------- # A section
App Name : "ELCL Demo" # Name-Value Pair with Text Value
Version : 1 # Name-Value Pair with Integer Value
And the same data in a minimal style:
[main_settings]
app_name: "ELCL Demo"
version: 1
Supported data types include text, integer, floating-point, boolean, date, time, datetime, time-delta, regular expressions, code, and byte sequences. These can be grouped into sections, nested via name paths, or organized into lists.
A detailed language specification is available here:
👉 Erbsland Configuration Language Documentation
- A C++20-compliant compiler (clang, gcc, or MSVC)
- CMake 3.23 or higher
Copyright © 2025 Tobias Erbsland – https://erbsland.dev/
Licensed under the Apache License, Version 2.0. You may obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0 Distributed on an “AS IS” basis, without warranties or conditions of any kind. See the LICENSE file for full details.