ezconfig
Create C++ Objects from Yaml and Json
Loading...
Searching...
No Matches
yaml_fwd.hpp File Reference

Yaml factory forward declarations. More...

#include "factory.hpp"
#include "macro.hpp"
Include dependency graph for yaml_fwd.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  YAML::convert< std::shared_ptr< Base > >
 Converter yaml -> std::shared_ptr<Base> using yaml::Create(). More...
 
struct  YAML::convert< std::unique_ptr< Base > >
 Converter yaml -> std::unique_ptr<Base> using yaml::Create(). More...
 

Namespaces

namespace  YAML
 YAML forward declarations.
 

Concepts

concept  ezconfig::yaml::Constructible
 

Macros

#define EZ_YAML_DECLARE(Base)
 Declare a global yaml factory for a base class.
 

Functions

template<typename Base >
std::unique_ptr< Base > ezconfig::yaml::Create (const YAML::Node &y)
 Create an object from yaml using the global factory.
 

Detailed Description

Yaml factory forward declarations.

Include this file in the header for the base class.

Definition in file yaml_fwd.hpp.

Macro Definition Documentation

◆ EZ_YAML_DECLARE

#define EZ_YAML_DECLARE ( Base)
Value:
EZ_FACTORY_DECLARE(Base, const YAML::Node &)

Declare a global yaml factory for a base class.

Do this in the base class header file.

Parameters
Basefactory base class.

The factory creates pointers to Base.

Example: Declare a MyBase yaml factory.

#define EZ_YAML_DECLARE(Base)
Declare a global yaml factory for a base class.
Definition yaml_fwd.hpp:57

Definition at line 57 of file yaml_fwd.hpp.

Function Documentation

◆ Create()

template<typename Base >
std::unique_ptr< Base > ezconfig::yaml::Create ( const YAML::Node & y)

Create an object from yaml using the global factory.

Template Parameters
Basefactory base class
Parameters
yyaml data
auto obj = yaml::Create<MyBase>(YAML::Load(data));

Definition at line 90 of file yaml.hpp.