cppfig 0.1.0
Modern C++20 compile-time type-safe configuration library
Loading...
Searching...
No Matches
cppfig::ConfSerializer Struct Reference

Flat key-value .conf serializer — the default, zero-dependency serializer. More...

#include <conf.h>

Public Types

using data_type = Value
 

Static Public Member Functions

static auto Parse (std::istream &is) -> StatusOr< Value >
 Parses a .conf stream into a Value tree.
 
static auto ParseString (std::string_view str) -> StatusOr< Value >
 Parses a .conf string into a Value tree.
 
static auto Stringify (const Value &data) -> std::string
 Converts a Value tree to flat key = value lines.
 

Detailed Description

Flat key-value .conf serializer — the default, zero-dependency serializer.

File format:

# Comment lines start with #
server.host = localhost
server.port = 8080
logging.enabled = true
logging.level = info

Keys are the full dot-separated setting paths. There are no sections or grouping — each line is simply path = value.

Type inference during parsing:

  • true/false/yes/no/on/off → bool
  • All-digit strings (optional leading -) → int64
  • Numeric with decimal point or exponent → double
  • Quoted strings ("...") → string (quotes stripped)
  • Everything else → string

Member Typedef Documentation

◆ data_type

Member Function Documentation

◆ Parse()

static auto cppfig::ConfSerializer::Parse ( std::istream &  is) -> StatusOr<Value>
inlinestatic

Parses a .conf stream into a Value tree.

◆ ParseString()

static auto cppfig::ConfSerializer::ParseString ( std::string_view  str) -> StatusOr<Value>
inlinestatic

Parses a .conf string into a Value tree.

◆ Stringify()

static auto cppfig::ConfSerializer::Stringify ( const Value data) -> std::string
inlinestatic

Converts a Value tree to flat key = value lines.


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