ezconfig
Create C++ Objects from Yaml and Json
|
Yaml factory. More...
Go to the source code of this file.
Concepts | |
concept | ezconfig::yaml::YamlParseable |
Macros | |
#define | EZ_YAML_DEFINE(Base) |
Define a global yaml factory for a base class. | |
#define | EZ_YAML_REGISTER(Base, tag, Derived, ...) |
Register a conversion method with the global yaml factory. | |
Functions | |
template<typename Base , typename Derived , typename Intermediate = Derived> requires ( std::is_base_of_v<Base, Derived> && YamlParseable<Intermediate> && std::is_constructible_v<Derived, Intermediate &&>) | |
void | ezconfig::yaml::Add (const std::string &tag) |
Add a factory method. | |
template<typename Base > | |
std::unique_ptr< Base > | ezconfig::yaml::Create (const YAML::Node &y) |
Create an object from yaml using the global factory. | |
Yaml factory.
Include this file in implementation file for the base class and any derived classes.
Definition in file yaml.hpp.
#define EZ_YAML_DEFINE | ( | Base | ) |
Define a global yaml factory for a base class.
Do this in the base class implementation file.
Base | factory base class. |
Example: Define a MyBase yaml factory.
#define EZ_YAML_REGISTER | ( | Base, | |
tag, | |||
Derived, | |||
... ) |
Register a conversion method with the global yaml factory.
Do this in the implementation files for derived classes.
Base | factory base class. |
tag | conversion identifier (string). |
Derived | factory derived class. |
Intermediate | optional intermediate class. |
Example: Register a creator for MyDerived with tag "!mytag".
void ezconfig::yaml::Add | ( | const std::string & | tag | ) |
std::unique_ptr< Base > ezconfig::yaml::Create | ( | const YAML::Node & | y | ) |