- added IADTFactory for sdktools

- updated sample extension and sdktools sdks

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401034
This commit is contained in:
David Anderson
2007-06-30 16:43:11 +00:00
parent 761890b470
commit b649d60cb0
9 changed files with 229 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
#ifndef _INCLUDE_SOURCEMOD_ADT_FACTORY_H_
#define _INCLUDE_SOURCEMOD_ADT_FACTORY_H_
#include <IShareSys.h>
#define SMINTERFACE_ADTFACTORY_NAME "IADTFactory"
#define SMINTERFACE_ADTFACTORY_VERSION 1
/**
* @file IADTFactory.h
* @brief Creates abstract data types.
*/
namespace SourceMod
{
/**
* @brief A "Trie" data type.
*/
class IBasicTrie
{
public:
/**
* @brief Inserts a key/value pair.
*
* @param key Key string (null terminated).
* @param value Value pointer (may be anything).
* @return True on success, false if key already exists.
*/
virtual bool Insert(const char *key, void *value) =0;
/**
* @brief Retrieves the value of a key.
*
* @param key Key string (null terminated).
* @param value Optional pointer to store value pointer.
* @return True on success, false if key was not found.
*/
virtual bool Retrieve(const char *key, void **value) =0;
/**
* @brief Deletes a key.
*
* @param key Key string (null terminated).
* @return True on success, false if key was not found.
*/
virtual bool Delete(const char *key) =0;
/**
* @brief Flushes the entire trie of all keys.
*/
virtual void Clear() =0;
/**
* @brief Destroys the IBasicTrie object and frees all associated
* memory.
*/
virtual void Destroy() =0;
};
class IADTFactory : public SMInterface
{
public:
/**
* @brief Creates a basic Trie object.
*
* @return A new IBasicTrie object which must be destroyed
* via IBasicTrie::Destroy().
*/
virtual IBasicTrie *CreateBasicTrie() =0;
};
}
#endif //_INCLUDE_SOURCEMOD_ADT_FACTORY_H_
+6
View File
@@ -57,6 +57,9 @@ IGameHelpers *gamehelpers = NULL;
#if defined SMEXT_ENABLE_TIMERSYS
ITimerSystem *timersys = NULL;
#endif
#if defined SMEXT_ENABLE_ADTFACTORY
IADTFactory *adtfactory = NULL;
#endif
/** Exports the main interface */
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
@@ -118,6 +121,9 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
#if defined SMEXT_ENABLE_TIMERSYS
SM_GET_IFACE(TIMERSYS, timersys);
#endif
#if defined SMEXT_ENABLE_ADTFACTORY
SM_GET_IFACE(ADTFACTORY, adtfactory);
#endif
if (SDK_OnLoad(error, maxlength, late))
{
+6
View File
@@ -51,6 +51,9 @@
#if defined SMEXT_ENABLE_TIMERSYS
#include <ITimerSystem.h>
#endif
#if defined SMEXT_ENABLE_ADTFACTORY
#include <IADTFactory.h>
#endif
#if defined SMEXT_CONF_METAMOD
#include <ISmmPlugin.h>
@@ -225,6 +228,9 @@ extern IGameHelpers *gamehelpers;
#if defined SMEXT_ENABLE_TIMERSYS
extern ITimerSystem *timersys;
#endif
#if defined SMEXT_ENABLE_ADTFACTORY
extern IADTFactory *adtfactory;
#endif
#if defined SMEXT_CONF_METAMOD
PLUGIN_GLOBALVARS();