3 * ===============================================================
4 * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.
6 * ===============================================================
8 * This file is part of the SourceMod/SourcePawn SDK. This file may only be
9 * used or modified under the Terms and Conditions of its License Agreement,
10 * which is found in public/licenses/LICENSE.txt. As of this notice, derivative
11 * works must be licensed under the GNU General Public License (version 2 or
12 * greater). A copy of the GPL is included under public/licenses/GPL.txt.
14 * To view the latest information, see: http://www.sourcemod.net/license.php
19 #ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
20 #define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
23 * @file IRootConsoleMenu.h
24 * @brief Defines the interface for adding options to the "sm" console command.
26 * This interface is not yet exported. It will be eventually. The initial reason should
27 * be obvious: we do not want users actually touching it. If we exposed this, every little
28 * plugin would be dropping down a silly set of user commands, and exploiting/cluttering the menu.
29 * Since this menu is explicitly provided for stuff that only Core itself is capable of managing,
30 * we won't expose it until a legitimate reason comes up.
36 * @brief Handles a root console menu action.
38 class IRootConsoleCommand
41 virtual void OnRootConsoleCommand(const char *command, unsigned int argcount) =0;
45 * @brief Manages the root console menu - the "sm" command for servers.
51 * @brief Adds a root console command handler. The command must be unique.
53 * @param cmd String containing the console command.
54 * @param text Description text.
55 * @param pHandler An IRootConsoleCommand pointer to handle the command.
56 * @return True on success, false on too many commands or duplicate command.
58 virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
61 * @brief Removes a root console command handler.
63 * @param cmd String containing the console command.
64 * @param pHandler An IRootConsoleCommand pointer for verification.
65 * @return True on success, false otherwise.
67 virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
70 * @brief Prints text back to the console.
72 * @param fmt Format of string.
73 * @param ... Format arguments.
75 virtual void ConsolePrint(const char *fmt, ...) =0;
78 * @brief Returns the string of an argument.
80 * @param argno The index of the argument.
81 * @return A string containing the argument, or nothing if invalid.
83 virtual const char *GetArgument(unsigned int argno) =0;
86 * @brief Returns the number of arguments.
88 * @return Number of arguments.
90 virtual unsigned int GetArgumentCount() =0;
93 * @brief Returns the entire argument string.
95 * @return String containing all arguments.
97 virtual const char *GetArguments() =0;
100 * @brief Draws a generic command/description pair.
101 * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
102 * N being the length of the command name. This is subject to change in case we
103 * account for Valve's font choices.
105 * @param cmd String containing the command option.
106 * @param text String containing the command description.
108 virtual void DrawGenericOption(const char *cmd, const char *text) =0;
112 #endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_