summaryrefslogblamecommitdiffstats
path: root/src/Bindings/Plugin.cpp
blob: 2f2771e3859bb13d20737e9fcd0f5768cc21cc8c (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                                                              
                   




 


                                                
                     
                                  


 
 


 
                   
 
                                                          

 



 














                                              
                                           
 









                                                       




 

#include "Globals.h"  // NOTE: MSVC stupidness requires this to be the same across all modules

#include "Plugin.h"





cPlugin::cPlugin(const AString & a_FolderName) :
	m_Status(cPluginManager::psDisabled),
	m_Name(a_FolderName),
	m_Version(0),
	m_FolderName(a_FolderName)
{
}





cPlugin::~cPlugin()
{
	LOGD("Destroying plugin \"%s\".", m_Name.c_str());
}





void cPlugin::Unload(void)
{
	auto pm = cPluginManager::Get();
	pm->RemovePluginCommands(this);
	pm->RemovePluginConsoleCommands(this);
	pm->RemoveHooks(this);
	OnDisable();
	m_Status = cPluginManager::psUnloaded;
	m_LoadError.clear();
}





AString cPlugin::GetLocalFolder(void) const
{
	return std::string("Plugins/") + m_FolderName;
}




void cPlugin::SetLoadError(const AString & a_LoadError)
{
	m_Status = cPluginManager::psError;
	m_LoadError = a_LoadError;
}