8000 mini-yaml/README.md at dev · Renal-Of-Loon/mini-yaml · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
86 lines (75 loc) · 4.75 KB

README.md

File metadata and controls

86 lines (75 loc) · 4.75 KB

mini-yaml

version License: MIT Github Linux Master AppVeyor codecov
Single header YAML C++ >= 11 sax/dom reader.

Quickstart

file.yml

scalar: hello world
list:
  - "foo bar"
  - boolean: true
    integer: 123
    floating point: 2.75

.cpp

Error checking is omitted, see examples/quickstart_full.cpp for a real use case example.

#include "yaml/yaml.hpp"

auto result = yaml::dom::read_document_from_file<char>("file.yml");
if(!result) {
    return print_result(result);
}

auto& root = result.root_node;
std::cout << root["scalar"].as<std::string>() << "\n";
std::cout << root["list"][0].as<std::string>() << "\n";
std::cout << root["list"][1]["boolean"].as<bool>() << "\n";
std::cout << root["list"][1]["integer"].as<int>() << "\n";
std::cout << root["list"][1]["floating point"].as<float>() << "\n";

Output

hello world
foo bar
true
123
2.75

Usage

Download repo

Place /yaml in your project's include directory and simply #include "yaml/yaml.hpp".

Clone repo

git clone https://github.com/jimmiebergmann/mini-yaml.git

Build status

Builds pass if all tests are successful and no memory leaks are found.

Branch Linux Windows Fuzzing
master Github Linux Master Github Windows Master AppVeyor Windows Master Github Fuzzing Master
dev Github Linux Dev Github Windows Dev AppVeyor Dev Github Fuzzing Dev

Features

✅ Supported ⚠️ Partial ❌ Unsupported

Feature Support Note
sax reader ✅
dom reader ✅
dom_view reader ❌
dom writer ❌
unicode ⚠️ No escape character support.
scalars ✅
block scalars ✅
flow scalars ✅
maps ✅
ordered maps ⚠️ Supported, but no ordered map container is included.
flow maps ❌
sequences ✅
flow sequences ❌
scalar type conversions ✅
tags ✅
indentation indicator ❌
sets ❌
anchors ❌
complex keys ❌
reader result printing ❌

Note

One does not simply write a yaml parser from scratch.

0