julixian.tomlkitpp
importC++23 module-only format-preserving TOML v1.1.0 parser, editor, and serializer (import tomlkitpp;)
import tomlkitpp;
Module name taken from this index's own test project for the package.
mcpp add julixian.tomlkitpp@1.0.2
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Behavioral test for julixian.tomlkitpp:
// TOML v1.1.0 parsing (optional seconds, multiline inline table, \xHH escape),
// typed lookup, in-place surgical edit, and comment/radix preservation.
import std;
import tomlkitpp;
int main() {
constexpr std::string_view input =
"# Header comment\n"
"mask = 0xff_00\n"
"\n"
"[server]\n"
"endpoint = { host = \"127.0.0.1\", port = 8080, }\n"
"window = 07:30 # TOML 1.1 optional seconds\n"
"tag = \"\\x41B\"\n";
auto doc = tomlkit::tryParse(input);
if (!doc) return 1;
if (tomlkit::findOr(*doc, "mask", std::int64_t{0}) != 0xff00) return 2;
if ((*doc)["server", "endpoint", "host"].get<std::string>() != "127.0.0.1") return 3;
if ((*doc)["server", "endpoint", "port"].get<int>() != 8080) return 4;
// …
tests/examples/julixian.tomlkitpp/tests/parse_edit_roundtrip.cpp · project tests/examples/julixian.tomlkitpp
Build · upstream manifest
- targets
tomlkitpp (lib)- language
c++23- manifest version
1.0.2- source
https://raw.githubusercontent.com/julixian/tomlkitpp/v1.0.2/tomlkitpp/mcpp.toml