public/IRootConsoleMenu.h
author Scott Ehlert <ds@alliedmods.net>
Mon Feb 05 08:58:03 2007 +0000 (2007-02-05)
changeset 432 77112e9620fa
parent 379 b3c99c22ba80
child 1226 478550a4d5ec
permissions -rw-r--r--
Worst commit ever, but I have removed some unnecessary things
dvander@372
     1
/**
dvander@375
     2
 * vim: set ts=4 :
dvander@372
     3
 * ===============================================================
dvander@376
     4
 * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC. 
dvander@376
     5
 * All rights reserved.
dvander@372
     6
 * ===============================================================
dvander@372
     7
 *
dvander@379
     8
 *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be 
dvander@379
     9
 * used or modified under the Terms and Conditions of its License Agreement, 
dvander@379
    10
 * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative 
dvander@379
    11
 * works must be licensed under the GNU General Public License (version 2 or 
dvander@379
    12
 * greater).  A copy of the GPL is included under public/licenses/GPL.txt.
dvander@379
    13
 * 
dvander@379
    14
 * To view the latest information, see: http://www.sourcemod.net/license.php
dvander@372
    15
 *
dvander@372
    16
 * Version: $Id$
dvander@372
    17
 */
dvander@372
    18
dvander@324
    19
#ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
dvander@324
    20
#define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
dvander@324
    21
dvander@324
    22
/**
dvander@372
    23
 * @file IRootConsoleMenu.h
dvander@372
    24
 * @brief Defines the interface for adding options to the "sm" console command.
dvander@372
    25
 *
dvander@372
    26
 *  This interface is not yet exported.  It will be eventually.  The initial reason should 
dvander@372
    27
 * be obvious: we do not want users actually touching it.  If we exposed this, every little 
dvander@372
    28
 * plugin would be dropping down a silly set of user commands, and exploiting/cluttering the menu.
dvander@372
    29
 * Since this menu is explicitly provided for stuff that only Core itself is capable of managing,
dvander@372
    30
 * we won't expose it until a legitimate reason comes up.
dvander@324
    31
 */
dvander@324
    32
dvander@324
    33
namespace SourceMod
dvander@324
    34
{
dvander@324
    35
	/**
dvander@324
    36
	 * @brief Handles a root console menu action.
dvander@324
    37
	 */
dvander@324
    38
	class IRootConsoleCommand
dvander@324
    39
	{
dvander@324
    40
	public:
dvander@324
    41
		virtual void OnRootConsoleCommand(const char *command, unsigned int argcount) =0;
dvander@324
    42
	};
dvander@324
    43
dvander@324
    44
	/**
dvander@324
    45
	 * @brief Manages the root console menu - the "sm" command for servers.
dvander@324
    46
	 */
dvander@324
    47
	class IRootConsole
dvander@324
    48
	{
dvander@324
    49
	public:
dvander@324
    50
		/**
dvander@324
    51
		 * @brief Adds a root console command handler.  The command must be unique.
dvander@324
    52
		 *
dvander@324
    53
		 * @param cmd			String containing the console command.
dvander@324
    54
		 * @param text			Description text.
dvander@324
    55
		 * @param pHandler		An IRootConsoleCommand pointer to handle the command.
dvander@324
    56
		 * @return				True on success, false on too many commands or duplicate command.
dvander@324
    57
		 */
dvander@324
    58
		virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
dvander@324
    59
dvander@324
    60
		/**
dvander@324
    61
		 * @brief Removes a root console command handler.
dvander@324
    62
		 *
dvander@324
    63
		 * @param cmd			String containing the console command.
dvander@324
    64
		 * @param pHandler		An IRootConsoleCommand pointer for verification.
dvander@324
    65
		 * @return				True on success, false otherwise.
dvander@324
    66
		 */
dvander@324
    67
		virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
dvander@324
    68
dvander@324
    69
		/**
dvander@324
    70
		 * @brief Prints text back to the console.
dvander@324
    71
		 *
dvander@324
    72
		 * @param fmt			Format of string.
dvander@324
    73
		 * @param ...			Format arguments.
dvander@324
    74
		 */
dvander@324
    75
		virtual void ConsolePrint(const char *fmt, ...) =0;
dvander@324
    76
dvander@324
    77
		/**
dvander@324
    78
		 * @brief Returns the string of an argument.
dvander@324
    79
		 *
dvander@324
    80
		 * @param argno			The index of the argument.
dvander@324
    81
		 * @return				A string containing the argument, or nothing if invalid.
dvander@324
    82
		 */
dvander@324
    83
		virtual const char *GetArgument(unsigned int argno) =0;
dvander@324
    84
dvander@324
    85
		/**
dvander@324
    86
		 * @brief Returns the number of arguments.
dvander@324
    87
		 *
dvander@324
    88
		 * @return				Number of arguments.
dvander@324
    89
		 */
dvander@324
    90
		virtual unsigned int GetArgumentCount() =0;
dvander@324
    91
dvander@324
    92
		/** 
dvander@324
    93
		 * @brief Returns the entire argument string.
dvander@324
    94
		 *
dvander@324
    95
		 * @return				String containing all arguments.
dvander@324
    96
		 */
dvander@324
    97
		virtual const char *GetArguments() =0;
dvander@324
    98
dvander@324
    99
		/**
dvander@324
   100
		 * @brief Draws a generic command/description pair.
dvander@324
   101
		 * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
dvander@324
   102
		 * N being the length of the command name.  This is subject to change in case we
dvander@324
   103
		 * account for Valve's font choices.
dvander@324
   104
		 *
dvander@372
   105
		 * @param cmd		String containing the command option.
dvander@372
   106
		 * @param text		String containing the command description.
dvander@324
   107
		 */
dvander@324
   108
		virtual void DrawGenericOption(const char *cmd, const char *text) =0;
dvander@324
   109
	};
ds@432
   110
}
dvander@324
   111
dvander@324
   112
#endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_