aboutsummaryrefslogtreecommitdiff
path: root/src/feature.cc
blob: 2747631d2fa95119007228c6d9dcb57efcc8bb17 (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
#include "json.hpp"
#include "feature.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}
                });
    }
}