blob: 352850b0963fdd5fc430bba2a32d37ecf1e1caed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "json.hpp"
#include "feature.h"
#include "creature.h"
#include <sstream>
#include <map>
using namespace std;
typedef nlohmann::json json;
namespace feature {
shared_ptr<Feature> Feature::create(const json& data) {
return shared_ptr<Feature>(new Feature(data));
}
Feature::Feature(const json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {}
Feature::~Feature() {}
string Feature::getName() const {
return name;
}
string Feature::getType() const {
return type;
}
string Feature::getText() const {
return text;
}
json Feature::toJson() const {
return json({
{"name", name},
{"type", type},
{"text", text}
});
}
}
|