core/CConVarManager.h
author Scott Ehlert <ds@alliedmods.net>
Thu Feb 08 21:41:28 2007 +0000 (2007-02-08)
changeset 457 9b8a85bf4175
child 464 765517f654a5
permissions -rw-r--r--
Initial import of convar stuff
1) Natives to create, find, set, and get convars
2) "cvars" option added to sm menu
3) Some internal additions to CPlugin to store a convar list
Still some things left to do...
ds@457
     1
/**
ds@457
     2
* ===============================================================
ds@457
     3
* SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
ds@457
     4
* ===============================================================
ds@457
     5
*
ds@457
     6
* This file is not open source and may not be copied without explicit
ds@457
     7
* written permission of AlliedModders LLC.  This file may not be redistributed 
ds@457
     8
* in whole or significant part.
ds@457
     9
* For information, see LICENSE.txt or http://www.sourcemod.net/license.php
ds@457
    10
*
ds@457
    11
* Version: $Id$
ds@457
    12
*/
ds@457
    13
ds@457
    14
#ifndef _INCLUDE_SOURCEMOD_CCONVARMANAGER_H_
ds@457
    15
#define _INCLUDE_SOURCEMOD_CCONVARMANAGER_H_
ds@457
    16
ds@457
    17
#include "sm_globals.h"
ds@457
    18
#include "sourcemm_api.h"
ds@457
    19
#include "HandleSys.h"
ds@457
    20
#include "sm_trie.h"
ds@457
    21
#include <IRootConsoleMenu.h>
ds@457
    22
ds@457
    23
class CConVarManager :
ds@457
    24
	public SMGlobalClass,
ds@457
    25
	public IHandleTypeDispatch,
ds@457
    26
	public IRootConsoleCommand
ds@457
    27
{
ds@457
    28
public:
ds@457
    29
	CConVarManager();
ds@457
    30
	~CConVarManager();
ds@457
    31
public: // SMGlobalClass
ds@457
    32
	void OnSourceModAllInitialized();
ds@457
    33
	void OnSourceModShutdown();
ds@457
    34
public: // IHandleTypeDispatch
ds@457
    35
	void OnHandleDestroy(HandleType_t type, void *object);
ds@457
    36
public: //IRootConsoleCommand
ds@457
    37
	void OnRootConsoleCommand(const char *command, unsigned int argcount);
ds@457
    38
public:
ds@457
    39
	inline HandleType_t GetHandleType()
ds@457
    40
	{
ds@457
    41
		return m_ConVarType;
ds@457
    42
	}
ds@457
    43
public:
ds@457
    44
	Handle_t CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *helpText,
ds@457
    45
	                      int flags, bool hasMin, float min, bool hasMax, float max);
ds@457
    46
	Handle_t FindConVar(const char* name);
ds@457
    47
private:
ds@457
    48
	HandleType_t m_ConVarType;
ds@457
    49
	Trie *m_CvarCache;
ds@457
    50
};
ds@457
    51
ds@457
    52
extern CConVarManager g_ConVarManager;
ds@457
    53
ds@457
    54
#endif // _INCLUDE_SOURCEMOD_CCONVARMANAGER_H_