Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlInputClause.h
Go to the documentation of this file.
1#pragma once
2
3#include "SDL/sdl_helpers.h"
4
5#include <string>
6#include <string_view>
7
8namespace ph
9{
10
14class SdlInputClause final
15{
16public:
17 std::string type;
18 std::string name;
19
25 std::string value;
26
27 std::string tag;
28
34
35 // TODO: more efficient storage; able to reuse memory
36 // TODO: support binary data
37
38public:
39 SdlInputClause() = default;
40 explicit SdlInputClause(std::string value);
41 SdlInputClause(std::string value, std::string tag);
42 SdlInputClause(std::string type, std::string name, std::string value);
43 SdlInputClause(std::string type, std::string name, std::string value, std::string tag);
44
47 bool isResourceIdentifier() const;
48
49 std::string genPrettyName() const;
50 std::string toString() const;
51};
52
53inline SdlInputClause::SdlInputClause(std::string value) :
54 SdlInputClause(std::move(value), "")
55{}
56
57inline SdlInputClause::SdlInputClause(std::string value, std::string tag) :
58 SdlInputClause("", "", std::move(value), std::move(tag))
59{}
60
61inline SdlInputClause::SdlInputClause(std::string type, std::string name, std::string value) :
62 SdlInputClause(std::move(type), std::move(name), std::move(value), "")
63{}
64
66 std::string type,
67 std::string name,
68 std::string value,
69 std::string tag)
70
71 : type(std::move(type))
72 , name(std::move(name))
73 , value(std::move(value))
74 , tag(std::move(tag))
75{}
76
77inline std::string SdlInputClause::genPrettyName() const
78{
79 return "type: " + type + ", name: " + name;
80}
81
82inline std::string SdlInputClause::toString() const
83{
84 return "type: " + type + ", name: " + name + ", value: " + value + (tag.empty() ? "" : ", tag: " + tag);
85}
86
87}// end namespace ph
Carries SDL representation of various data during the input process. Helps to read input data such as...
Definition SdlInputClause.h:15
std::string toString() const
Definition SdlInputClause.h:82
std::string value
Loaded stringified data of a clause. All potential SDL value prefixes or suffixes (e....
Definition SdlInputClause.h:25
std::string tag
Definition SdlInputClause.h:27
std::string type
Definition SdlInputClause.h:17
SdlInputClause()=default
bool isResourceIdentifier() const
Helper to check if the carried value is a SDL resource identifier (SRI).
Definition SdlInputClause.cpp:7
std::string name
Definition SdlInputClause.h:18
std::string genPrettyName() const
Definition SdlInputClause.h:77
ESdlClauseValue valueType
Type of the carried value. For identifying the type of the value string only. Does not check whether ...
Definition SdlInputClause.h:33
The root for all renderer implementations.
Definition EEngineProject.h:6
ESdlClauseValue
Meta information for the value in a clause.
Definition sdl_fwd.h:43
@ General
Definition sdl_fwd.h:45
Definition TAABB2D.h:96
Low-level helpers for SDL. Helpers are in an additional sdl namespace.