1.1 --- a/public/IGameConfigs.h Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,148 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod
1.8 - * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
1.9 - * =============================================================================
1.10 - *
1.11 - * This program is free software; you can redistribute it and/or modify it under
1.12 - * the terms of the GNU General Public License, version 3.0, as published by the
1.13 - * Free Software Foundation.
1.14 - *
1.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.18 - * details.
1.19 - *
1.20 - * You should have received a copy of the GNU General Public License along with
1.21 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.22 - *
1.23 - * As a special exception, AlliedModders LLC gives you permission to link the
1.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.26 - * by the Valve Corporation. You must obey the GNU General Public License in
1.27 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.28 - * this exception to all derivative works. AlliedModders LLC defines further
1.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.30 - * or <http://www.sourcemod.net/license.php>.
1.31 - *
1.32 - * Version: $Id$
1.33 - */
1.34 -
1.35 -#ifndef _INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_
1.36 -#define _INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_
1.37 -
1.38 -#include <IShareSys.h>
1.39 -#include <IHandleSys.h>
1.40 -
1.41 -/**
1.42 - * @file IGameConfigs.h
1.43 - * @brief Abstracts game private data configuration.
1.44 - */
1.45 -
1.46 -#define SMINTERFACE_GAMECONFIG_NAME "IGameConfigManager"
1.47 -#define SMINTERFACE_GAMECONFIG_VERSION 3
1.48 -
1.49 -class SendProp;
1.50 -
1.51 -namespace SourceMod
1.52 -{
1.53 - /**
1.54 - * @brief Describes a game private data config file
1.55 - */
1.56 - class IGameConfig
1.57 - {
1.58 - public:
1.59 - /**
1.60 - * @brief Returns an offset value.
1.61 - *
1.62 - * @param key Key to retrieve from the offset section.
1.63 - * @param value Pointer to store the offset value in.
1.64 - * @return True if found, false otherwise.
1.65 - */
1.66 - virtual bool GetOffset(const char *key, int *value) =0;
1.67 -
1.68 - /**
1.69 - * @brief Returns information about a dynamic offset.
1.70 - *
1.71 - * @param key Key to retrieve from the property section.
1.72 - * @return A SendProp pointer, or NULL if not found.
1.73 - */
1.74 - virtual SendProp *GetSendProp(const char *key) =0;
1.75 -
1.76 - /**
1.77 - * @brief Returns the value of a key from the "Keys" section.
1.78 - *
1.79 - * @param key Key to retrieve from the Keys section.
1.80 - * @return String containing the value, or NULL if not found.
1.81 - */
1.82 - virtual const char *GetKeyValue(const char *key) =0;
1.83 -
1.84 - /**
1.85 - * @brief Retrieves a cached memory signature.
1.86 - *
1.87 - * @param key Name of the signature.
1.88 - * @param addr Pointer to store the memory address in.
1.89 - * @return True if the key was found, false otherwise.
1.90 - * Note that true is a valid return even if the
1.91 - * address is NULL.
1.92 - */
1.93 - virtual bool GetMemSig(const char *key, void **addr) =0;
1.94 - };
1.95 -
1.96 - /**
1.97 - * @brief Manages game config files
1.98 - */
1.99 - class IGameConfigManager : public SMInterface
1.100 - {
1.101 - public:
1.102 - const char *GetInterfaceName()
1.103 - {
1.104 - return SMINTERFACE_GAMECONFIG_NAME;
1.105 - }
1.106 - unsigned int GetInterfaceVersion()
1.107 - {
1.108 - return SMINTERFACE_GAMECONFIG_VERSION;
1.109 - }
1.110 - public:
1.111 - /**
1.112 - * @brief Loads or finds an already loaded game config file.
1.113 - *
1.114 - * @param file File to load. The path must be relative to the
1.115 - * 'gamedata' folder and the extension should be
1.116 - * omitted.
1.117 - * @param pConfig Pointer to store the game config pointer. Pointer
1.118 - * will be valid even on failure.
1.119 - * @param error Optional error message buffer.
1.120 - * @param maxlength Maximum length of the error buffer.
1.121 - * @return True on success, false if the file failed.
1.122 - */
1.123 - virtual bool LoadGameConfigFile(const char *file,
1.124 - IGameConfig **pConfig,
1.125 - char *error,
1.126 - size_t maxlength) =0;
1.127 -
1.128 - /**
1.129 - * @brief Closes an IGameConfig pointer. Since a file can be loaded
1.130 - * more than once, the file will not actually be removed from memory
1.131 - * until it is closed once for each call to LoadGameConfigfile().
1.132 - *
1.133 - * @param cfg Pointer to the IGameConfig to close.
1.134 - */
1.135 - virtual void CloseGameConfigFile(IGameConfig *cfg) =0;
1.136 -
1.137 - /**
1.138 - * @brief Reads an GameConfig Handle.
1.139 - *
1.140 - * @param hndl Handle to read.
1.141 - * @param ident Identity of the owner (can be NULL).
1.142 - * @param err Optional error buffer.
1.143 - * @return IGameConfig pointer on success, NULL otherwise.
1.144 - */
1.145 - virtual IGameConfig *ReadHandle(Handle_t hndl,
1.146 - IdentityToken_t *ident,
1.147 - HandleError *err) =0;
1.148 - };
1.149 -}
1.150 -
1.151 -#endif //_INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_