mcpp index

julixian.tomlkitpp

import

C++23 module-only format-preserving TOML v1.1.0 parser, editor, and serializer (import tomlkitpp;)

import tomlkitpp;

模块名取自本索引给这个包写的测试项目。

mcpp add julixian.tomlkitpp@1.0.2

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// 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 · 项目 tests/examples/julixian.tomlkitpp

构建 · 上游清单

targets
tomlkitpp (lib)
language
c++23
manifest version
1.0.2
来源
https://raw.githubusercontent.com/julixian/tomlkitpp/v1.0.2/tomlkitpp/mcpp.toml

版本

版本平台 镜像sha256
1.0.2 最新 LinuxWindowsmacOS GLOBAL CN 7f7fca227005…
1.0.1 LinuxWindowsmacOS 源站 f6060d839c32…
1.0.0 LinuxWindowsmacOS 源站 0a242d7eed2b…