InspIRCd  3.0
command_parse.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2009-2010 Daniel De Graaf <[email protected]>
5  * Copyright (C) 2007 Robin Burchell <[email protected]>
6  * Copyright (C) 2007 Dennis Friis <[email protected]>
7  * Copyright (C) 2005-2007 Craig Edwards <[email protected]>
8  *
9  * This file is part of InspIRCd. InspIRCd is free software: you can
10  * redistribute it and/or modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation, version 2.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16  * 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 
23 #pragma once
24 
30 class CoreExport CommandParser
31 {
32  public:
33  typedef TR1NS::unordered_map<std::string, Command*, irc::insensitive, irc::StrHashComp> CommandMap;
34 
35  private:
41  void ProcessCommand(LocalUser* user, std::string& command, CommandBase::Params& parameters);
42 
45  CommandMap cmdlist;
46 
47  public:
50  CommandParser();
51 
55  const CommandMap& GetCommands() const { return cmdlist; }
56 
69  CmdResult CallHandler(const std::string& commandname, const CommandBase::Params& parameters, User* user, Command** cmd = NULL);
70 
75  Command* GetHandler(const std::string &commandname);
76 
114  static bool LoopCall(User* user, Command* handler, const CommandBase::Params& parameters, unsigned int splithere, int extra = -1, bool usemax = true);
115 
120  void ProcessBuffer(LocalUser* user, const std::string& buffer);
121 
126  bool AddCommand(Command *f);
127 
130  void RemoveCommand(Command* x);
131 
139  static void TranslateSingleParam(TranslateType to, const std::string& item, std::string& dest, CommandBase* custom_translator = NULL, unsigned int paramnumber = 0);
140 
148  static std::string TranslateUIDs(const std::vector<TranslateType>& to, const CommandBase::Params& source, bool prefix_final = false, CommandBase* custom_translator = NULL);
149 };
const CommandMap & GetCommands() const
Definition: command_parse.h:55
Definition: users.h:224
Definition: command_parse.h:30
Definition: ctables.h:221
Definition: users.h:707
Definition: ctables.h:110
Definition: ctables.h:114