galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Tag.cpp
Go to the documentation of this file.
1
7
8#include <nlohmann/json.hpp>
9
10#include "Tag.hpp"
11
12namespace galaxy
13{
14 namespace components
15 {
17 : Serializable {}
18 , m_tag {""}
19 {
20 }
21
22 Tag::Tag(std::string_view tag)
23 : Serializable {}
24 , m_tag {tag}
25 {
26 }
27
28 Tag::Tag(const nlohmann::json& json)
29 : Serializable {}
30 {
31 deserialize(json);
32 }
33
35 : Serializable {}
36 , m_tag {"null"}
37 {
38 this->m_tag = std::move(t.m_tag);
39 }
40
42 {
43 if (this != &t)
44 {
45 this->m_tag = std::move(t.m_tag);
46 }
47
48 return *this;
49 }
50
52 {
53 }
54
55 nlohmann::json Tag::serialize()
56 {
57 nlohmann::json json = "{}"_json;
58 json["tag"] = m_tag;
59
60 return json;
61 }
62
63 void Tag::deserialize(const nlohmann::json& json)
64 {
65 m_tag = json.at("tag");
66 }
67 } // namespace components
68} // namespace galaxy
Tag an entity.
Definition Tag.hpp:21
Tag()
Constructor.
Definition Tag.cpp:16
void deserialize(const nlohmann::json &json) override
Deserializes from object.
Definition Tag.cpp:63
std::string m_tag
Tag.
Definition Tag.hpp:87
Tag & operator=(Tag &&)
Move assignment operator.
Definition Tag.cpp:41
virtual ~Tag()
Destructor.
Definition Tag.cpp:51
nlohmann::json serialize() override
Serializes object.
Definition Tag.cpp:55
Timer.hpp galaxy.
Definition Async.hpp:17