ManaPlus
groupdb.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2016-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
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 RESOURCES_DB_GROUPDB_H
23 #define RESOURCES_DB_GROUPDB_H
24 
26 
28 
29 #include <map>
30 #include <string>
31 
32 #include "localconsts.h"
33 
34 struct GroupInfo;
35 
36 namespace GroupDb
37 {
38  void load();
39 
40  void unload();
41 
42  void loadXmlFile(const std::string &fileName,
43  const SkipError skipError);
44  const std::string &getName(const int id) A_WARN_UNUSED;
45  const std::string &getLongName(const int id) A_WARN_UNUSED;
46  bool getShowBadge(const int id) A_WARN_UNUSED;
47  bool getHighlightName(const int id) A_WARN_UNUSED;
48  const std::string &getBadge(const int id) A_WARN_UNUSED;
49  const GroupInfo *getGroup(const int id) A_WARN_UNUSED RETURNS_NONNULL;
50  bool isAllowCommand(const ServerCommandTypeT command);
51 
52  typedef std::map<int, GroupInfo*> GroupInfos;
53  typedef GroupInfos::iterator GroupInfosIter;
54 
55 #ifdef UNITTESTS
56  GroupDb::GroupInfos &getGroups();
57 #endif // UNITTESTS
58 } // namespace GroupDb
59 
60 #endif // RESOURCES_DB_GROUPDB_H
#define RETURNS_NONNULL
Definition: localconsts.h:167
#define A_WARN_UNUSED
Definition: localconsts.h:161
const std::string & getBadge(const int id)
Definition: groupdb.cpp:388
void loadXmlFile(const std::string &fileName, const SkipError skipError)
Definition: groupdb.cpp:256
void load()
Definition: groupdb.cpp:46
bool getShowBadge(const int id)
Definition: groupdb.cpp:366
void unload()
Definition: groupdb.cpp:333
bool getHighlightName(const int id)
Definition: groupdb.cpp:377
const std::string & getName(const int id)
Definition: groupdb.cpp:344
bool isAllowCommand(const ServerCommandTypeT command)
Definition: groupdb.cpp:410
GroupInfos::iterator GroupInfosIter
Definition: groupdb.h:53
std::map< int, GroupInfo * > GroupInfos
Definition: groupdb.h:52
const GroupInfo * getGroup(const int id)
Definition: groupdb.cpp:399
const std::string & getLongName(const int id)
Definition: groupdb.cpp:355
ServerCommandType ::T ServerCommandTypeT
bool SkipError
Definition: skiperror.h:30
std::string fileName
Definition: testmain.cpp:39