GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/models/typelistmodel.h Lines: 7 12 58.3 %
Date: 2017-11-29 Branches: 1 6 16.7 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2012  The Mana Developers
4
 *  Copyright (C) 2012-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_TYPELISTMODEL_H
23
#define GUI_MODELS_TYPELISTMODEL_H
24
25
#include "gui/models/listmodel.h"
26
27
/**
28
 * Server Type List Model
29
 */
30
2
class TypeListModel final : public ListModel
31
{
32
    public:
33
        TypeListModel() :
34
4
            ListModel()
35
        { }
36
37
        A_DELETE_COPY(TypeListModel)
38
39
        /**
40
         * Used to get number of line in the list
41
         */
42
16
        int getNumberOfElements() override final A_WARN_UNUSED
43
#if defined(TMWA_SUPPORT)
44
16
        { return 3; }
45
#else  // defined(TMWA_SUPPORT)
46
        { return 2; }
47
#endif  // defined(TMWA_SUPPORT)
48
49
        /**
50
         * Used to get an element from the list
51
         */
52
2
        std::string getElementAt(int elementIndex)
53
                                 override final A_WARN_UNUSED
54
        {
55
#ifdef TMWA_SUPPORT
56
2
            if (elementIndex == 0)
57
6
                return "TmwAthena";
58
            else if (elementIndex == 1)
59
                return "Hercules";
60
            else if (elementIndex == 2)
61
                return "Evol2";
62
            else
63
#else   // TMWA_SUPPORT
64
            if (elementIndex == 0)
65
                return "Hercules";
66
            else if (elementIndex == 1)
67
                return "Evol2";
68
            else
69
#endif  // TMWA_SUPPORT
70
                return "Unknown";
71
        }
72
};
73
74
#endif  // GUI_MODELS_TYPELISTMODEL_H