GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/models/beingslistmodel.h Lines: 10 12 83.3 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2010  The Mana Developers
4
 *  Copyright (C) 2011-2017  The ManaPlus Developers
5
 *
6
 *  This file is part of The ManaPlus Client.
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  any later version.
12
 *
13
 *  This program is distributed in the hope that it will be useful,
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 *  GNU General Public License for more details.
17
 *
18
 *  You should have received a copy of the GNU General Public License
19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
#ifndef GUI_MODELS_BEINGSLISTMODEL_H
23
#define GUI_MODELS_BEINGSLISTMODEL_H
24
25
#include "gui/models/avatarlistmodel.h"
26
27
#include "utils/cast.h"
28
#include "utils/dtor.h"
29
#include "utils/vector.h"
30
31
class BeingsListModel final : public AvatarListModel
32
{
33
    public:
34
10
        BeingsListModel() :
35
            AvatarListModel(),
36
30
            mMembers()
37
        {
38
        }
39
40
        A_DELETE_COPY(BeingsListModel)
41
42
10
        ~BeingsListModel()
43
40
        {
44
20
            delete_all(mMembers);
45
20
            mMembers.clear();
46
20
        }
47
48
        STD_VECTOR<Avatar*> *getMembers() RETURNS_NONNULL A_WARN_UNUSED
49
        {
50
2
            return &mMembers;
51
        }
52
53
        Avatar *getAvatarAt(int index) override final
54
        {
55
            return mMembers[index];
56
        }
57
58
10
        int getNumberOfElements() override final
59
        {
60
20
            return CAST_S32(mMembers.size());
61
        }
62
63
        STD_VECTOR<Avatar*> mMembers;
64
};
65
66
#endif  // GUI_MODELS_BEINGSLISTMODEL_H