Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlField.h
Go to the documentation of this file.
1#pragma once
2
3#include "SDL/sdl_fwd.h"
6
7#include <Common/logging.h>
8
9#include <string>
10#include <string_view>
11#include <utility>
12
13namespace ph
14{
15
17
19{
20public:
21 SdlField(std::string typeName, std::string fieldName);
22
24 std::string typeName,
25 std::string fieldName,
26 std::string typeSignature);
27
28 virtual ~SdlField();
29
36 virtual SdlNativeData nativeData(SdlNonConstInstance instance) const = 0;
37
38 std::string genPrettyName() const;
39 std::string_view getTypeName() const;
40 std::string_view getFieldName() const;
41 std::string_view getDescription() const;
42 std::string_view getTypeSignature() const;
43
45
50 bool isFallbackEnabled() const;
51
52protected:
53 SdlField& setDescription(std::string descriptionStr);
54
60
62
63private:
64 std::string m_typeName;
65 std::string m_fieldName;
66 std::string m_description;
67 std::string m_typeSignature;
68 EFieldImportance m_importance;
69 bool m_isFallbackEnabled;
70};
71
72// In-header Implementation:
73
74inline std::string_view SdlField::getTypeName() const
75{
76 return m_typeName;
77}
78
79inline std::string_view SdlField::getFieldName() const
80{
81 return m_fieldName;
82}
83
84inline std::string_view SdlField::getDescription() const
85{
86 return m_description;
87}
88
89inline std::string_view SdlField::getTypeSignature() const
90{
91 return m_typeSignature;
92}
93
95{
96 return m_importance;
97}
98
99inline bool SdlField::isFallbackEnabled() const
100{
101 return m_isFallbackEnabled;
102}
103
104inline SdlField& SdlField::setDescription(std::string descriptionStr)
105{
106 m_description = std::move(descriptionStr);
107
108 return *this;
109}
110
112{
113 m_importance = importance;
114
115 return *this;
116}
117
118inline SdlField& SdlField::setEnableFallback(bool isFallbackEnabled)
119{
120 m_isFallbackEnabled = isFallbackEnabled;
121
122 return *this;
123}
124
125}// end namespace ph
Definition SdlField.h:19
SdlField(std::string typeName, std::string fieldName)
Definition SdlField.cpp:9
SdlField & setEnableFallback(bool isFallbackEnabled)
Definition SdlField.h:118
std::string_view getFieldName() const
Definition SdlField.h:79
bool isFallbackEnabled() const
Whether the field want to use built-in mechanism to handle I/O problems. An example of this is defaul...
Definition SdlField.h:99
virtual SdlNativeData nativeData(SdlNonConstInstance instance) const =0
Direct access to the field memory of a SDL instance. Note that this field may not necessarily be boun...
std::string_view getDescription() const
Definition SdlField.h:84
std::string_view getTypeSignature() const
Definition SdlField.h:89
std::string_view getTypeName() const
Definition SdlField.h:74
SdlField & setImportance(EFieldImportance importance)
Sets the importance of the field. Different importance affect the underlying policy used during the i...
Definition SdlField.h:111
std::string genPrettyName() const
Definition SdlField.cpp:32
SdlField & setDescription(std::string descriptionStr)
Definition SdlField.h:104
EFieldImportance getImportance() const
Definition SdlField.h:94
virtual ~SdlField()
Definition SdlNativeData.h:88
References a SDL object. This is a lightweight utility for referencing SDL objects....
Definition TSdlAnyInstance.h:20
The root for all renderer implementations.
Definition EEngineProject.h:6
EFieldImportance
Definition EFieldImportance.h:7
PH_DEFINE_EXTERNAL_LOG_GROUP(ApiDatabase, Core)