Skip to content

cppalliance/yaml

Repository files navigation

Boost.Yaml

A C++11 library for parsing and working with YAML documents.

Overview

Boost.Yaml provides an idiomatic C++ interface for reading YAML files and accessing their structured contents. The library is designed to be simple, efficient, and standards-compliant.

Features

  • C++11 Compatible: Works with modern C++ compilers
  • Simple API: Easy-to-use interface for parsing and accessing YAML data
  • Header-only Option: Can be used as header-only or compiled library
  • Comprehensive Error Handling: Built on Boost.System for robust error reporting
  • Well Documented: Complete documentation with examples
  • Tested: Comprehensive test suite

Quick Example

#include <boost/yaml.hpp>
#include <iostream>

int main()
{
    using namespace boost::yaml;
    
    auto result = parse("name: John\nage: 30");
    if(result)
    {
        auto& v = *result;
        if(v.is_mapping())
        {
            auto& m = v.as_mapping();
            std::cout << "Name: " << m["name"].as_scalar() << "\n";
            std::cout << "Age: " << m["age"].as_scalar() << "\n";
        }
    }
    return 0;
}

Building

CMake

mkdir build
cd build
cmake .. -DBOOST_SRC_DIR=/path/to/boost
cmake --build .

B2 (Boost.Build)

b2

Testing

cmake --build . --target test

or with B2:

b2 test

Documentation

See the documentation for complete API reference and guides.

License

Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

About

Boost.Yaml proposed

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •