GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/being/beingcacheentry.h Lines: 0 17 0.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2017  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef BEING_BEINGCACHEENTRY_H
22
#define BEING_BEINGCACHEENTRY_H
23
24
#include "enums/simpletypes/beingid.h"
25
26
#include "localconsts.h"
27
28
#include <string>
29
30
class BeingCacheEntry final
31
{
32
    public:
33
        explicit BeingCacheEntry(const BeingId id) :
34
            mName(),
35
            mPartyName(),
36
            mGuildName(),
37
            mIp(),
38
            mId(id),
39
            mLevel(0),
40
            mPvpRank(0),
41
            mTime(0),
42
            mFlags(0),
43
            mTeamId(0U),
44
            mIsAdvanced(false)
45
        {
46
        }
47
48
        A_DELETE_COPY(BeingCacheEntry)
49
50
        BeingId getId() const
51
        { return mId; }
52
53
        /**
54
         * Returns the name of the being.
55
         */
56
        const std::string &getName() const
57
        { return mName; }
58
59
        /**
60
         * Sets the name for the being.
61
         *
62
         * @param name The name that should appear.
63
         */
64
        void setName(const std::string &name)
65
        { mName = name; }
66
67
        /**
68
         * Following are set from the server (mainly for players)
69
         */
70
        void setPartyName(const std::string &name)
71
        { mPartyName = name; }
72
73
        void setGuildName(const std::string &name)
74
        { mGuildName = name; }
75
76
        const std::string &getPartyName() const
77
        { return mPartyName; }
78
79
        const std::string &getGuildName() const
80
        { return mGuildName; }
81
82
        void setLevel(const int n)
83
        { mLevel = n; }
84
85
        int getLevel() const
86
        { return mLevel; }
87
88
        void setTime(const time_t n)
89
        { mTime = n; }
90
91
        time_t getTime() const
92
        { return mTime; }
93
94
        unsigned getPvpRank() const
95
        { return mPvpRank; }
96
97
        void setPvpRank(const int r)
98
        { mPvpRank = r; }
99
100
        std::string getIp() const
101
        { return mIp; }
102
103
        void setIp(const std::string &ip)
104
        { mIp = ip; }
105
106
        bool isAdvanced() const
107
        { return mIsAdvanced; }
108
109
        void setAdvanced(const bool a)
110
        { mIsAdvanced = a; }
111
112
        int getFlags() const
113
        { return mFlags; }
114
115
        void setFlags(const int flags)
116
        { mFlags = flags; }
117
118
        uint16_t getTeamId() const
119
        { return mTeamId; }
120
121
        void setTeamId(const uint16_t teamId)
122
        { mTeamId = teamId; }
123
124
    protected:
125
        std::string mName;        /**< Name of character */
126
        std::string mPartyName;
127
        std::string mGuildName;
128
        std::string mIp;
129
        BeingId mId;              /**< Unique sprite id */
130
        int mLevel;
131
        unsigned int mPvpRank;
132
        time_t mTime;
133
        int mFlags;
134
        uint16_t mTeamId;
135
        bool mIsAdvanced;
136
};
137
138
#endif  // BEING_BEINGCACHEENTRY_H