Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlStruct.h
Go to the documentation of this file.
1#pragma once
2
4#include "SDL/sdl_fwd.h"
5#include "Utility/TAnyPtr.h"
6
7#include <Common/logging.h>
8
9#include <cstddef>
10#include <string>
11#include <vector>
12
13namespace ph
14{
15
17
25{
26public:
27 explicit SdlStruct(std::string typeName);
28
32 virtual void initObject(
34 SdlInputClauses& clauses,
35 const SdlInputContext& ctx) const = 0;
36
40 virtual void initDefaultObject(AnyNonConstPtr obj) const = 0;
41
42 virtual void saveObject(
43 AnyConstPtr obj,
44 SdlOutputClauses& clauses,
45 const SdlOutputContext& ctx) const = 0;
46
52 virtual void referencedResources(
53 AnyConstPtr obj,
54 std::vector<const ISdlResource*>& out_resources) const = 0;
55
56 std::size_t numFields() const override = 0;
57 const SdlField* getField(std::size_t index) const override = 0;
58
59 std::string_view getTypeName() const override;
60 std::string_view getDescription() const override;
61
62protected:
63 SdlStruct& setDescription(std::string description);
64
65private:
66 std::string m_typeName;
67 std::string m_description;
68};
69
70// In-header Implementations:
71
72inline std::string_view SdlStruct::getTypeName() const
73{
74 return m_typeName;
75}
76
77inline std::string_view SdlStruct::getDescription() const
78{
79 return m_description;
80}
81
82}// end namespace ph
Definition ISdlInstantiable.h:12
Definition SdlField.h:19
Container for input clauses.
Definition SdlInputClauses.h:18
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
Definition SdlOutputClauses.h:14
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
Definition SdlStruct.h:25
std::size_t numFields() const override=0
std::string_view getDescription() const override
Definition SdlStruct.h:77
SdlStruct & setDescription(std::string description)
Definition SdlStruct.cpp:17
const SdlField * getField(std::size_t index) const override=0
virtual void initObject(AnyNonConstPtr obj, SdlInputClauses &clauses, const SdlInputContext &ctx) const =0
Initialize a struct object from value clauses. How the object will be initialized depends on the stru...
SdlStruct(std::string typeName)
Definition SdlStruct.cpp:10
virtual void saveObject(AnyConstPtr obj, SdlOutputClauses &clauses, const SdlOutputContext &ctx) const =0
std::string_view getTypeName() const override
Definition SdlStruct.h:72
virtual void initDefaultObject(AnyNonConstPtr obj) const =0
Initialize a struct object to default values. Default values are defined by the struct's SDL definiti...
virtual void referencedResources(AnyConstPtr obj, std::vector< const ISdlResource * > &out_resources) const =0
Get all SDL resources referenced by obj.
The root for all renderer implementations.
Definition EEngineProject.h:6
PH_DEFINE_EXTERNAL_LOG_GROUP(ApiDatabase, Core)