]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/ctables.h
Missing a changeover
[user/henk/code/inspircd.git] / include / ctables.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16  
17 #ifndef __CTABLES_H__
18 #define __CTABLES_H__
19
20 #include "inspircd_config.h"
21
22 #ifdef GCC3
23 #include <ext/hash_map>
24 #else
25 #include <hash_map>
26 #endif
27
28 #ifdef GCC3
29 #define nspace __gnu_cxx
30 #else
31 #define nspace std
32 #endif
33
34 class userrec;
35
36 /*typedef void (handlerfunc) (char**, int, userrec*);*/
37
38 /** A structure that defines a command
39  */
40 class command_t
41 {
42  public:
43         /** Command name
44         */
45          std::string command;
46         /** User flags needed to execute the command or 0
47          */
48         char flags_needed;
49         /** Minimum number of parameters command takes
50         */
51         int min_params;
52         /** used by /stats m
53          */
54         long use_count;
55         /** used by /stats m
56          */
57         long total_bytes;
58         /** used for resource tracking between modules
59          */
60         std::string source;
61
62         command_t(std::string cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara)
63         {
64                 use_count = total_bytes = 0;
65                 source = "<core>";
66         }
67
68         virtual void Handle(char** parameters, int pcnt, userrec* user) = 0;
69
70         virtual ~command_t() {}
71 };
72
73 typedef nspace::hash_map<std::string,command_t*> command_table;
74
75 #endif
76