2007-01-25 23:36:38 +01:00
|
|
|
/**
|
2007-03-22 22:50:20 +01:00
|
|
|
* vim: set ts=4 :
|
2007-01-25 23:36:38 +01:00
|
|
|
* ===============================================================
|
|
|
|
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
|
|
|
* ===============================================================
|
|
|
|
*
|
|
|
|
* This file is not open source and may not be copied without explicit
|
|
|
|
* written permission of AlliedModders LLC. This file may not be redistributed
|
|
|
|
* in whole or significant part.
|
|
|
|
* For information, see LICENSE.txt or http://www.sourcemod.net/license.php
|
|
|
|
*
|
|
|
|
* Version: $Id$
|
|
|
|
*/
|
|
|
|
|
2006-12-30 00:18:13 +01:00
|
|
|
#ifndef _INCLUDE_SOURCEMOD_SHARESYSTEM_H_
|
|
|
|
#define _INCLUDE_SOURCEMOD_SHARESYSTEM_H_
|
|
|
|
|
|
|
|
#include <IShareSys.h>
|
|
|
|
#include <IHandleSys.h>
|
|
|
|
#include <sh_list.h>
|
|
|
|
#include "sm_globals.h"
|
|
|
|
#include "sourcemod.h"
|
|
|
|
|
|
|
|
using namespace SourceHook;
|
|
|
|
|
|
|
|
namespace SourceMod
|
|
|
|
{
|
|
|
|
struct IdentityToken_t
|
|
|
|
{
|
|
|
|
Handle_t ident;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct IfaceInfo
|
|
|
|
{
|
|
|
|
SMInterface *iface;
|
2007-01-17 04:01:38 +01:00
|
|
|
IExtension *owner;
|
2006-12-30 00:18:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class ShareSystem :
|
|
|
|
public IShareSys,
|
|
|
|
public SMGlobalClass,
|
|
|
|
public IHandleTypeDispatch
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShareSystem();
|
|
|
|
public: //IShareSys
|
2007-01-17 04:01:38 +01:00
|
|
|
bool AddInterface(IExtension *myself, SMInterface *pIface);
|
2006-12-30 00:18:13 +01:00
|
|
|
bool RequestInterface(const char *iface_name,
|
|
|
|
unsigned int iface_vers,
|
2007-01-17 04:01:38 +01:00
|
|
|
IExtension *mysql,
|
2006-12-30 00:18:13 +01:00
|
|
|
SMInterface **pIface);
|
2007-01-18 21:30:45 +01:00
|
|
|
void AddNatives(IExtension *myself, const sp_nativeinfo_t *natives);
|
2006-12-30 00:18:13 +01:00
|
|
|
IdentityType_t CreateIdentType(const char *name);
|
|
|
|
IdentityType_t FindIdentType(const char *name);
|
|
|
|
IdentityToken_t *CreateIdentity(IdentityType_t type);
|
|
|
|
void DestroyIdentType(IdentityType_t type);
|
|
|
|
void DestroyIdentity(IdentityToken_t *identity);
|
2007-01-19 06:33:04 +01:00
|
|
|
void AddDependency(IExtension *myself, const char *filename, bool require, bool autoload);
|
2006-12-30 00:18:13 +01:00
|
|
|
public: //SMGlobalClass
|
|
|
|
/* Pre-empt in case anything tries to register idents early */
|
|
|
|
void OnSourceModStartup(bool late);
|
|
|
|
void OnSourceModShutdown();
|
|
|
|
public: //IHandleTypeDispatch
|
|
|
|
void OnHandleDestroy(HandleType_t type, void *object);
|
|
|
|
public:
|
|
|
|
IdentityToken_t *CreateCoreIdentity();
|
2007-01-17 04:01:38 +01:00
|
|
|
void RemoveInterfaces(IExtension *pExtension);
|
2006-12-30 00:18:13 +01:00
|
|
|
public:
|
|
|
|
inline IdentityToken_t *GetIdentRoot()
|
|
|
|
{
|
|
|
|
return &m_IdentRoot;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
List<IfaceInfo> m_Interfaces;
|
|
|
|
HandleType_t m_TypeRoot;
|
|
|
|
IdentityToken_t m_IdentRoot;
|
|
|
|
HandleType_t m_IfaceType;
|
|
|
|
IdentityType_t m_CoreType;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern ShareSystem g_ShareSys;
|
|
|
|
|
|
|
|
#endif //_INCLUDE_SOURCEMOD_SHARESYSTEM_H_
|