All Projects → jimmiebergmann → Mini Yaml

jimmiebergmann / Mini Yaml

Licence: mit
Single header YAML 1.0 C++11 serializer/deserializer.

Programming Languages

cpp
1120 projects

Projects that are alternatives of or similar to Mini Yaml

Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (+1555.7%)
Mutual labels:  serializer, parser, serialization
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+958.23%)
Mutual labels:  yaml, parser, serialization
Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+12872.15%)
Mutual labels:  serializer, parser, serialization
Parse5
HTML parsing/serialization toolset for Node.js. WHATWG HTML Living Standard (aka HTML5)-compliant.
Stars: ✭ 2,778 (+3416.46%)
Mutual labels:  serializer, parser, serialization
Yamldotnet
YamlDotNet is a .NET library for YAML
Stars: ✭ 1,382 (+1649.37%)
Mutual labels:  yaml, parser, serialization
wasmbin
A self-generating WebAssembly parser & serializer in Rust.
Stars: ✭ 40 (-49.37%)
Mutual labels:  serialization, parsing, serializer
Rapidyaml
Rapid YAML - a library to parse and emit YAML, and do it fast.
Stars: ✭ 183 (+131.65%)
Mutual labels:  yaml, parser, serialization
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (-49.37%)
Mutual labels:  yaml, serialization, parsing
Jkt
Simple helper to parse JSON based on independent schema
Stars: ✭ 22 (-72.15%)
Mutual labels:  parser, parsing
Dsongo
Encoding, decoding, marshaling, unmarshaling, and verification of the DSON (Doge Serialized Object Notation)
Stars: ✭ 23 (-70.89%)
Mutual labels:  serializer, parser
Eminim
JSON serialization framework for Nim, works from a Stream directly to any type and back. Depends only on stdlib.
Stars: ✭ 32 (-59.49%)
Mutual labels:  serializer, serialization
Fuzi
A fast & lightweight XML & HTML parser in Swift with XPath & CSS support
Stars: ✭ 894 (+1031.65%)
Mutual labels:  parser, parsing
Edn Data
EDN parser and generator that works with plain JS data, with support for TS and node streams
Stars: ✭ 44 (-44.3%)
Mutual labels:  parser, serialization
Errorstacks
Tiny library to parse error stack traces
Stars: ✭ 29 (-63.29%)
Mutual labels:  parser, parsing
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+860.76%)
Mutual labels:  yaml, parser
Serd
A lightweight C library for RDF syntax
Stars: ✭ 43 (-45.57%)
Mutual labels:  serializer, parser
Esprima
ECMAScript parsing infrastructure for multipurpose analysis
Stars: ✭ 6,391 (+7989.87%)
Mutual labels:  parser, parsing
Logos
Create ridiculously fast Lexers
Stars: ✭ 1,001 (+1167.09%)
Mutual labels:  parser, parsing
Serializer Pack
A Symfony Pack for Symfony Serializer
Stars: ✭ 1,068 (+1251.9%)
Mutual labels:  serializer, serialization
Parser Javascript
Browser sniffing gone too far — A useragent parser library for JavaScript
Stars: ✭ 66 (-16.46%)
Mutual labels:  parser, parsing

mini-yaml

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

Quickstart

file.txt

key: foo bar
list:
  - hello world
  - integer: 123
    boolean: true

.cpp

Yaml::Node root;
Yaml::Parse(root, "file.txt");

// Print all scalars.
std::cout << root["key"].As<std::string>() << std::endl;
std::cout << root["list"][0].As<std::string>() << std::endl;
std::cout << root["list"][1]["integer"].As<int>() << std::endl;
std::cout << root["list"][1]["boolean"].As<bool>() << std::endl;

// Iterate second sequence item.
Node & item = root[1];
for(auto it = item.Begin(); it != item.End(); it++)
{
    std::cout << (*it).first << ": " << (*it).second.As<string>() << std::endl;
}

Output

foo bar
hello world
123
1
integer: 123
boolean: true

See Best practice.

Usage

Put /yaml in your project directory and simply #include "yaml/Yaml.hpp". See examples/FirstExample.cpp for additional examples.

Best practice

Always use references when accessing node content, if not intended to make a copy. Modifying copied node wont affect the original node content.
See example:

Yaml::Node root;

Yaml::Node & ref = root;  // The content of "root" is not being copied.
ref["key"] = "value";     // Modifying "root" node content.

Yaml::Node copy = root;   // The content of "root" is copied to "copy".
                          // Slow operation if "root" contains a lot of content.
copy["key"] = "value";    // Modifying "copy" node content. "root" is left untouched.

Build status

Builds are passed if all tests are good and no memory leaks were found.

Branch Status
master Build Status
dev Build Status

Todo

  • Parse/serialize tags(!!type).
  • Parse anchors.
  • Parse flow sequences/maps.
  • Parse complex keys.
  • Parse sets.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].