added plugin properties
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40492
This commit is contained in:
@@ -40,6 +40,7 @@ CPlugin::CPlugin(const char *file)
|
||||
snprintf(m_filename, sizeof(m_filename), "%s", file);
|
||||
m_handle = 0;
|
||||
m_ident = NULL;
|
||||
m_pProps = sm_trie_create();
|
||||
}
|
||||
|
||||
CPlugin::~CPlugin()
|
||||
@@ -75,6 +76,10 @@ CPlugin::~CPlugin()
|
||||
g_pSourcePawn->FreeFromMemory(m_plugin);
|
||||
m_plugin = NULL;
|
||||
}
|
||||
if (!m_pProps)
|
||||
{
|
||||
sm_trie_destroy(m_pProps);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugin::InitIdentity()
|
||||
@@ -125,6 +130,23 @@ CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
|
||||
return pPlugin;
|
||||
}
|
||||
|
||||
bool CPlugin::GetProperty(const char *prop, void **ptr, bool remove/* =false */)
|
||||
{
|
||||
bool exists = sm_trie_retrieve(m_pProps, prop, ptr);
|
||||
|
||||
if (exists && remove)
|
||||
{
|
||||
sm_trie_delete(m_pProps, prop);
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
bool CPlugin::SetProperty(const char *prop, void *ptr)
|
||||
{
|
||||
return sm_trie_insert(m_pProps, prop, ptr);
|
||||
}
|
||||
|
||||
ICompilation *CPlugin::StartMyCompile(IVirtualMachine *vm)
|
||||
{
|
||||
if (!m_plugin)
|
||||
|
||||
Reference in New Issue
Block a user