Planeshift
commandmanager.h
Go to the documentation of this file.
1 /*
2  * commandmanager.h
3  *
4  * Copyright (C) 2005 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef __COMMANDMANAGER_H__
21 #define __COMMANDMANAGER_H__
22 //=============================================================================
23 // Crystal Space Includes
24 //=============================================================================
25 #include <csutil/csstring.h>
26 #include <csutil/hash.h>
27 
28 //=============================================================================
29 // Project Includes
30 //=============================================================================
31 
32 //=============================================================================
33 // Local Includes
34 //=============================================================================
35 
36 
40 {
41  csString name;
42  unsigned int id;
43  csArray<csString> commands;
44 };
45 
46 
50 {
51  csString command;
52  csArray<int> groupMembers;
53 };
54 
55 
71 {
72 public:
73  virtual ~psCommandManager();
74 
75  bool LoadFromDatabase();
76  bool GroupExists(int securityLevel);
77  bool Validate(int securityLevel, const char* command);
78  bool Validate(int securityLevel, const char* command, csString &error);
79  void BuildXML(int securityLevel, csString &dest, bool subscribe = true);
80 
81 private:
82 
83  csHash<CommandGroup*, int> commandGroups;
84  csHash<CommandList*, csString> commandLists;
85 };
86 
87 #endif
Defines a command listing.
unsigned int id
Unique ID code from database.
csString name
The name of the group from the database.
csArray< int > groupMembers
List of all groups the command is in.
csArray< csString > commands
List of all the commands in this group.
This class handles the permission system such as Game Masters and Role play masters.
csString command
The command string.
Defines a command group.