Skip to content

Enables automatic serialization/deserialization for user defined types. Uses `boost::hana` to inject reflection

License

Notifications You must be signed in to change notification settings

nicktrandafil/yenxo

Repository files navigation

yenxo

Build Status codecov Documentation

Some add-in's which enable the traits listed below for user defined types:

  • serialization/deserialization;
  • comparison;
  • pushing to std::ostream.

Uses boost::hana in order to obtain reflection in C++. Uses rapidjson to serialize to and deserialize form JSON.

Examples

Typical use case of trait::Var:

struct Person : trait::Var<Person> {
    std::string name;
    int age;
    float height;
};

BOOST_HANA_ADAPT_STRUCT(Person, name, age, height);

auto const json = R"(
    {
        "name": "An uncommon name",
        "age": 20,
        "height": "170.5"
    }
)";

// Construct from JSON
Person person(Variant::from(rapidjson::Document().Parse(json)));

More snippets can be found in examples and test directories. The documentation can be found here.

About

Enables automatic serialization/deserialization for user defined types. Uses `boost::hana` to inject reflection

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages