]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/ctables.h
irc::tokenstream is a token parser which using std::string and std::vector builds...
[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 #include "hash_map.h"
22 #include "base.h"
23
24 class userrec;
25
26 /*typedef void (handlerfunc) (char**, int, userrec*);*/
27
28 /** A structure that defines a command
29  */
30 class command_t : public Extensible
31 {
32  public:
33         /** Command name
34         */
35          std::string command;
36         /** User flags needed to execute the command or 0
37          */
38         char flags_needed;
39         /** Minimum number of parameters command takes
40         */
41         int min_params;
42         /** used by /stats m
43          */
44         long use_count;
45         /** used by /stats m
46          */
47         long total_bytes;
48         /** used for resource tracking between modules
49          */
50         std::string source;
51
52         command_t(const std::string &cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara)
53         {
54                 use_count = total_bytes = 0;
55                 source = "<core>";
56         }
57
58         virtual void Handle(char** parameters, int pcnt, userrec* user) = 0;
59
60         virtual ~command_t() {}
61 };
62
63 typedef nspace::hash_map<std::string,command_t*> command_table;
64
65 #endif