public/IRootConsoleMenu.h
author David Anderson <dvander@alliedmods.net>
Thu Aug 02 00:19:47 2007 +0000 (2007-08-02)
changeset 1248 ee9f7860e9db
parent 1226 478550a4d5ec
child 1330 ab94316bb52b
permissions -rw-r--r--
added a build of sniperbeamer's batch compiling tool for sourcemod
dvander@372
     1
/**
dvander@375
     2
 * vim: set ts=4 :
dvander@1226
     3
 * ================================================================
dvander@1226
     4
 * SourceMod
dvander@1226
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
dvander@1226
     6
 * ================================================================
dvander@372
     7
 *
dvander@1226
     8
 * This program is free software; you can redistribute it and/or 
dvander@1226
     9
 * modify it under the terms of the GNU General Public License, 
dvander@1226
    10
 * version 3.0, as published by the Free Software Foundation.
dvander@379
    11
 * 
dvander@1226
    12
 * This program is distributed in the hope that it will be useful,
dvander@1226
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@1226
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dvander@1226
    15
 * GNU General Public License for more details.
dvander@1226
    16
 *
dvander@1226
    17
 * You should have received a copy of the GNU General Public License
dvander@1226
    18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1226
    19
 *
dvander@1226
    20
 * As a special exception, AlliedModders LLC gives you permission to 
dvander@1226
    21
 * link the code of this program (as well as its derivative works) to 
dvander@1226
    22
 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
dvander@1226
    23
 * Game MODs that run on software by the Valve Corporation.  You must 
dvander@1226
    24
 * obey the GNU General Public License in all respects for all other 
dvander@1226
    25
 * code used. Additionally, AlliedModders LLC grants this exception 
dvander@1226
    26
 * to all derivative works. AlliedModders LLC defines further 
dvander@1226
    27
 * exceptions, found in LICENSE.txt (as of this writing, version 
dvander@1226
    28
 * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
dvander@372
    29
 *
dvander@372
    30
 * Version: $Id$
dvander@372
    31
 */
dvander@372
    32
dvander@324
    33
#ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
dvander@324
    34
#define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
dvander@324
    35
dvander@324
    36
/**
dvander@372
    37
 * @file IRootConsoleMenu.h
dvander@372
    38
 * @brief Defines the interface for adding options to the "sm" console command.
dvander@372
    39
 *
dvander@372
    40
 *  This interface is not yet exported.  It will be eventually.  The initial reason should 
dvander@372
    41
 * be obvious: we do not want users actually touching it.  If we exposed this, every little 
dvander@372
    42
 * plugin would be dropping down a silly set of user commands, and exploiting/cluttering the menu.
dvander@372
    43
 * Since this menu is explicitly provided for stuff that only Core itself is capable of managing,
dvander@372
    44
 * we won't expose it until a legitimate reason comes up.
dvander@324
    45
 */
dvander@324
    46
dvander@324
    47
namespace SourceMod
dvander@324
    48
{
dvander@324
    49
	/**
dvander@324
    50
	 * @brief Handles a root console menu action.
dvander@324
    51
	 */
dvander@324
    52
	class IRootConsoleCommand
dvander@324
    53
	{
dvander@324
    54
	public:
dvander@324
    55
		virtual void OnRootConsoleCommand(const char *command, unsigned int argcount) =0;
dvander@324
    56
	};
dvander@324
    57
dvander@324
    58
	/**
dvander@324
    59
	 * @brief Manages the root console menu - the "sm" command for servers.
dvander@324
    60
	 */
dvander@324
    61
	class IRootConsole
dvander@324
    62
	{
dvander@324
    63
	public:
dvander@324
    64
		/**
dvander@324
    65
		 * @brief Adds a root console command handler.  The command must be unique.
dvander@324
    66
		 *
dvander@324
    67
		 * @param cmd			String containing the console command.
dvander@324
    68
		 * @param text			Description text.
dvander@324
    69
		 * @param pHandler		An IRootConsoleCommand pointer to handle the command.
dvander@324
    70
		 * @return				True on success, false on too many commands or duplicate command.
dvander@324
    71
		 */
dvander@324
    72
		virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
dvander@324
    73
dvander@324
    74
		/**
dvander@324
    75
		 * @brief Removes a root console command handler.
dvander@324
    76
		 *
dvander@324
    77
		 * @param cmd			String containing the console command.
dvander@324
    78
		 * @param pHandler		An IRootConsoleCommand pointer for verification.
dvander@324
    79
		 * @return				True on success, false otherwise.
dvander@324
    80
		 */
dvander@324
    81
		virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
dvander@324
    82
dvander@324
    83
		/**
dvander@324
    84
		 * @brief Prints text back to the console.
dvander@324
    85
		 *
dvander@324
    86
		 * @param fmt			Format of string.
dvander@324
    87
		 * @param ...			Format arguments.
dvander@324
    88
		 */
dvander@324
    89
		virtual void ConsolePrint(const char *fmt, ...) =0;
dvander@324
    90
dvander@324
    91
		/**
dvander@324
    92
		 * @brief Returns the string of an argument.
dvander@324
    93
		 *
dvander@324
    94
		 * @param argno			The index of the argument.
dvander@324
    95
		 * @return				A string containing the argument, or nothing if invalid.
dvander@324
    96
		 */
dvander@324
    97
		virtual const char *GetArgument(unsigned int argno) =0;
dvander@324
    98
dvander@324
    99
		/**
dvander@324
   100
		 * @brief Returns the number of arguments.
dvander@324
   101
		 *
dvander@324
   102
		 * @return				Number of arguments.
dvander@324
   103
		 */
dvander@324
   104
		virtual unsigned int GetArgumentCount() =0;
dvander@324
   105
dvander@324
   106
		/** 
dvander@324
   107
		 * @brief Returns the entire argument string.
dvander@324
   108
		 *
dvander@324
   109
		 * @return				String containing all arguments.
dvander@324
   110
		 */
dvander@324
   111
		virtual const char *GetArguments() =0;
dvander@324
   112
dvander@324
   113
		/**
dvander@324
   114
		 * @brief Draws a generic command/description pair.
dvander@324
   115
		 * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
dvander@324
   116
		 * N being the length of the command name.  This is subject to change in case we
dvander@324
   117
		 * account for Valve's font choices.
dvander@324
   118
		 *
dvander@372
   119
		 * @param cmd		String containing the command option.
dvander@372
   120
		 * @param text		String containing the command description.
dvander@324
   121
		 */
dvander@324
   122
		virtual void DrawGenericOption(const char *cmd, const char *text) =0;
dvander@324
   123
	};
ds@432
   124
}
dvander@324
   125
dvander@324
   126
#endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_