Changes after merge
parent
611680a72e
commit
f1d1cdceee
|
@ -14,13 +14,13 @@
|
||||||
// * You should have received a copy of the GNU General Public License
|
// * You should have received a copy of the GNU General Public License
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
// plugin.cpp
|
// pluginloader.cpp
|
||||||
|
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "pluginloader.h"
|
||||||
|
|
||||||
|
|
||||||
CPlugin::CPlugin(std::string filename)
|
CPluginLoader::CPluginLoader(std::string filename)
|
||||||
{
|
{
|
||||||
mInterface = nullptr;
|
mInterface = nullptr;
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
|
@ -28,7 +28,7 @@ CPlugin::CPlugin(std::string filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* CPlugin::GetName()
|
char* CPluginLoader::GetName()
|
||||||
{
|
{
|
||||||
if (mLoaded)
|
if (mLoaded)
|
||||||
return mInterface->PluginName();
|
return mInterface->PluginName();
|
||||||
|
@ -36,7 +36,7 @@ char* CPlugin::GetName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CPlugin::GetVersion()
|
int CPluginLoader::GetVersion()
|
||||||
{
|
{
|
||||||
if (mLoaded)
|
if (mLoaded)
|
||||||
return mInterface->PluginVersion();
|
return mInterface->PluginVersion();
|
||||||
|
@ -44,13 +44,13 @@ int CPlugin::GetVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CPlugin::IsLoaded()
|
bool CPluginLoader::IsLoaded()
|
||||||
{
|
{
|
||||||
return mLoaded;
|
return mLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CPlugin::UnloadPlugin()
|
bool CPluginLoader::UnloadPlugin()
|
||||||
{
|
{
|
||||||
if (!mLoaded) {
|
if (!mLoaded) {
|
||||||
GetLogger()->Warn("Plugin %s is not loaded.\n");
|
GetLogger()->Warn("Plugin %s is not loaded.\n");
|
||||||
|
@ -69,7 +69,7 @@ bool CPlugin::UnloadPlugin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CPlugin::LoadPlugin()
|
bool CPluginLoader::LoadPlugin()
|
||||||
{
|
{
|
||||||
mHandle = lt_dlopenext(mFilename.c_str());
|
mHandle = lt_dlopenext(mFilename.c_str());
|
||||||
if (!mHandle) {
|
if (!mHandle) {
|
|
@ -14,7 +14,7 @@
|
||||||
// * You should have received a copy of the GNU General Public License
|
// * You should have received a copy of the GNU General Public License
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
// plugin.h
|
// pluginloader.h
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -27,9 +27,9 @@
|
||||||
#include "plugininterface.h"
|
#include "plugininterface.h"
|
||||||
|
|
||||||
|
|
||||||
class CPlugin {
|
class CPluginLoader {
|
||||||
public:
|
public:
|
||||||
CPlugin(std::string filename);
|
CPluginLoader(std::string filename);
|
||||||
|
|
||||||
char* GetName();
|
char* GetName();
|
||||||
int GetVersion();
|
int GetVersion();
|
|
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8)
|
||||||
set(CMAKE_BUILD_TYPE debug)
|
set(CMAKE_BUILD_TYPE debug)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic")
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic")
|
||||||
|
|
||||||
add_executable(plugin_test plugin_test.cpp ../../common/iman.cpp ../../common/logger.cpp ../plugin.cpp)
|
add_executable(plugin_test plugin_test.cpp ../../common/iman.cpp ../../common/logger.cpp ../pluginloader.cpp)
|
||||||
|
|
||||||
# Change to DirectX SDK directory
|
# Change to DirectX SDK directory
|
||||||
include_directories("../../")
|
include_directories("../../")
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <common/logger.h>
|
#include <common/logger.h>
|
||||||
#include <common/iman.h>
|
#include <common/iman.h>
|
||||||
#include <sound/sound.h>
|
#include <sound/sound.h>
|
||||||
#include <plugins/plugin.h>
|
#include <plugins/pluginloader.h>
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
@ -14,7 +14,7 @@ int main() {
|
||||||
|
|
||||||
lt_dlinit();
|
lt_dlinit();
|
||||||
|
|
||||||
CPlugin *plugin = new CPlugin("libopenalsound");
|
CPluginLoader *plugin = new CPluginLoader("libopenalsound");
|
||||||
if (plugin->LoadPlugin()) {
|
if (plugin->LoadPlugin()) {
|
||||||
CSoundInterface *sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
|
CSoundInterface *sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <math/vector.h>
|
#include <math/vector.h>
|
||||||
|
|
||||||
#include <plugins/plugin.h>
|
#include <plugins/plugininterface.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ enum SoundNext
|
||||||
* @brief Sound plugin interface
|
* @brief Sound plugin interface
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class CSoundInterface : public CPlugin
|
class CSoundInterface : public CPluginInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSoundInterface() {
|
CSoundInterface() {
|
||||||
|
|
Loading…
Reference in New Issue