Skip to content
 
 

Repository files navigation

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.

About

Single header YAML 1.0 C++11 serializer/deserializer.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages