35 lines
1018 B
C++
35 lines
1018 B
C++
#ifndef SHADOW_SCHEMA_HPP
|
|
#define SHADOW_SCHEMA_HPP
|
|
|
|
#include "matador/utils/result.hpp"
|
|
#include "matador/utils/error.hpp"
|
|
|
|
#include <memory>
|
|
#include <typeindex>
|
|
|
|
namespace matador::object {
|
|
class schema;
|
|
class schema_node;
|
|
}
|
|
|
|
namespace matador::object::internal {
|
|
class shadow_schema {
|
|
private:
|
|
using node_ptr = std::shared_ptr<schema_node>;
|
|
|
|
public:
|
|
explicit shadow_schema(object::schema& s);
|
|
|
|
[[nodiscard]] object::schema& schema() const;
|
|
[[nodiscard]] bool schema_contains(const std::type_index& ti) const;
|
|
[[nodiscard]] utils::result<node_ptr, utils::error> find_node(const std::type_index &type_index) const;
|
|
[[nodiscard]] utils::result<node_ptr, utils::error> find_node(const std::string &name) const;
|
|
[[nodiscard]] utils::result<node_ptr, utils::error> attach_node(const std::shared_ptr<schema_node> &node) const;
|
|
[[nodiscard]] utils::result<void, utils::error> detach_node(const std::shared_ptr<schema_node> &node) const;
|
|
|
|
private:
|
|
object::schema& schema_;
|
|
};
|
|
}
|
|
#endif //SHADOW_SCHEMA_HPP
|