aboutsummaryrefslogtreecommitdiff
path: root/src/entry.h
blob: abfe831afb756276b2b5c2457f2dfae36172ac65 (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
#pragma once
#include "defines.h"
#include <nlohmann/json.hpp>
#include <memory>

namespace creature {
    class Creature;
}

namespace entry {
    struct entryImpl;

    class Entry {
        public:
            Entry();
            // Also can be created programmatically
            Entry(const std::string& entry, const std::string& name, const std::string& type, const std::string& text);
            static std::shared_ptr<Entry> create(const nlohmann::json& data);
            virtual ~Entry() {}

            std::string getName(void) const;
            std::string getType(void) const;
            virtual std::string getText(void) const;
            virtual std::string getText(const creature::Creature& c) const;
            void setText(const std::string& t);
            virtual void init(void) {}
            
            NLOHMANN_FRIEND_DECLARES(Entry);

        private:
            std::shared_ptr<entryImpl> data;
    };
}