Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlFunction.h
Go to the documentation of this file.
1#pragma once
2
4#include "SDL/sdl_fwd.h"
5
6#include <Common/assertion.h>
7#include <Common/logging.h>
8
9#include <string>
10#include <utility>
11
12namespace ph
13{
14
16
18{
19public:
20 explicit SdlFunction(std::string name);
21
22 virtual void call(
23 ISdlResource* resource,
24 SdlInputClauses& clauses,
25 const SdlInputContext& ctx) const = 0;
26
27 // TODO: saveCall() & asyncCall() ?
28
29 virtual std::size_t numParams() const = 0;
30 virtual const SdlField* getParam(std::size_t index) const = 0;
31
32 std::size_t numFields() const override;
33 const SdlField* getField(std::size_t index) const override;
34 std::string_view getTypeName() const override;
35 std::string_view getDescription() const override;
36
40 std::string_view getName() const;
41
42 std::string genPrettyName() const;
43
44protected:
45 SdlFunction& setDescription(std::string description);
46
47private:
48 std::string m_name;
49 std::string m_description;
50};
51
52// In-header Implementations:
53
54inline SdlFunction::SdlFunction(std::string name) :
55 m_name (std::move(name)),
56 m_description()
57{
58 PH_ASSERT(!m_name.empty());
59}
60
61inline std::size_t SdlFunction::numFields() const
62{
63 return numParams();
64}
65
66inline const SdlField* SdlFunction::getField(std::size_t index) const
67{
68 return getParam(index);
69}
70
71inline std::string_view SdlFunction::getTypeName() const
72{
73 return getName();
74}
75
76inline std::string_view SdlFunction::getName() const
77{
78 return m_name;
79}
80
81inline std::string_view SdlFunction::getDescription() const
82{
83 return m_description;
84}
85
86inline SdlFunction& SdlFunction::setDescription(std::string description)
87{
88 m_description = std::move(description);
89
90 return *this;
91}
92
93}// end namespace ph
Definition ISdlInstantiable.h:12
Interface for all SDL resource.
Definition ISdlResource.h:22
Definition SdlField.h:19
Definition SdlFunction.h:18
const SdlField * getField(std::size_t index) const override
Definition SdlFunction.h:66
std::size_t numFields() const override
Definition SdlFunction.h:61
SdlFunction(std::string name)
Definition SdlFunction.h:54
virtual void call(ISdlResource *resource, SdlInputClauses &clauses, const SdlInputContext &ctx) const =0
std::string_view getDescription() const override
Definition SdlFunction.h:81
std::string_view getName() const
Definition SdlFunction.h:76
virtual std::size_t numParams() const =0
SdlFunction & setDescription(std::string description)
Definition SdlFunction.h:86
std::string_view getTypeName() const override
Definition SdlFunction.h:71
virtual const SdlField * getParam(std::size_t index) const =0
std::string genPrettyName() const
Definition SdlFunction.cpp:7
Container for input clauses.
Definition SdlInputClauses.h:18
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
The root for all renderer implementations.
Definition EEngineProject.h:6
PH_DEFINE_EXTERNAL_LOG_GROUP(ApiDatabase, Core)
Definition TAABB2D.h:96