2 * ===============================================================
3 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
4 * ===============================================================
6 * This file is part of the SourceMod/SourcePawn SDK. This file may only be used
7 * or modified under the Terms and Conditions of its License Agreement, which is found
8 * in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
9 * may change at any time. To view the latest information, see:
10 * http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
16 #define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
19 * @file IRootConsoleMenu.h
20 * @brief Defines the interface for adding options to the "sm" console command.
22 * This interface is not yet exported. It will be eventually. The initial reason should
23 * be obvious: we do not want users actually touching it. If we exposed this, every little
24 * plugin would be dropping down a silly set of user commands, and exploiting/cluttering the menu.
25 * Since this menu is explicitly provided for stuff that only Core itself is capable of managing,
26 * we won't expose it until a legitimate reason comes up.
32 * @brief Handles a root console menu action.
34 class IRootConsoleCommand
37 virtual void OnRootConsoleCommand(const char *command, unsigned int argcount) =0;
41 * @brief Manages the root console menu - the "sm" command for servers.
47 * @brief Adds a root console command handler. The command must be unique.
49 * @param cmd String containing the console command.
50 * @param text Description text.
51 * @param pHandler An IRootConsoleCommand pointer to handle the command.
52 * @return True on success, false on too many commands or duplicate command.
54 virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
57 * @brief Removes a root console command handler.
59 * @param cmd String containing the console command.
60 * @param pHandler An IRootConsoleCommand pointer for verification.
61 * @return True on success, false otherwise.
63 virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
66 * @brief Prints text back to the console.
68 * @param fmt Format of string.
69 * @param ... Format arguments.
71 virtual void ConsolePrint(const char *fmt, ...) =0;
74 * @brief Returns the string of an argument.
76 * @param argno The index of the argument.
77 * @return A string containing the argument, or nothing if invalid.
79 virtual const char *GetArgument(unsigned int argno) =0;
82 * @brief Returns the number of arguments.
84 * @return Number of arguments.
86 virtual unsigned int GetArgumentCount() =0;
89 * @brief Returns the entire argument string.
91 * @return String containing all arguments.
93 virtual const char *GetArguments() =0;
96 * @brief Draws a generic command/description pair.
97 * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
98 * N being the length of the command name. This is subject to change in case we
99 * account for Valve's font choices.
101 * @param cmd String containing the command option.
102 * @param text String containing the command description.
104 virtual void DrawGenericOption(const char *cmd, const char *text) =0;
108 #endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_