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…