-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
98 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <exception> | ||
|
||
#include <ll/api/plugin/Plugin.h> | ||
|
||
#include "Plugin.h" | ||
|
||
namespace plugins { | ||
|
||
// The global plugin instance. | ||
Plugin* plugin = nullptr; | ||
|
||
extern "C" { | ||
_declspec(dllexport) bool ll_plugin_load(ll::plugin::Plugin& self) { | ||
try { | ||
plugin = new Plugin(self); | ||
|
||
} catch (const std::exception& e) { | ||
self.getLogger().error(e.what()); | ||
|
||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
_declspec(dllexport) bool ll_plugin_enable(ll::plugin::Plugin&) { | ||
if (plugin == nullptr) { | ||
return false; | ||
} | ||
|
||
return plugin->enable(); | ||
} | ||
|
||
_declspec(dllexport) bool ll_plugin_disable(ll::plugin::Plugin&) { | ||
if (plugin == nullptr) { | ||
return false; | ||
} | ||
|
||
return plugin->disable(); | ||
} | ||
} | ||
|
||
} // namespace plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "Plugin.h" | ||
|
||
#include <ll/api/plugin/Plugin.h> | ||
|
||
namespace plugins { | ||
|
||
Plugin::Plugin(ll::plugin::Plugin& self) : mSelf(self) { | ||
// Code for loading the plugin goes here. | ||
} | ||
|
||
bool Plugin::enable() { | ||
// Code for enabling the plugin goes here. | ||
|
||
return true; | ||
} | ||
|
||
bool Plugin::disable() { | ||
// Code for disabling the plugin goes here. | ||
|
||
return true; | ||
} | ||
|
||
} // namespace plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <ll/api/plugin/Plugin.h> | ||
|
||
namespace plugins { | ||
|
||
class Plugin { | ||
public: | ||
Plugin(ll::plugin::Plugin& self); | ||
|
||
Plugin(const Plugin&) = delete; | ||
|
||
Plugin(const Plugin&&) = delete; | ||
|
||
Plugin& operator=(const Plugin&) = delete; | ||
|
||
Plugin& operator=(const Plugin&&) = delete; | ||
|
||
~Plugin() = default; | ||
|
||
/// @return True if the plugin is enabled successfully. | ||
bool enable(); | ||
|
||
/// @return True if the plugin is disabled successfully. | ||
bool disable(); | ||
|
||
private: | ||
ll::plugin::Plugin& mSelf; | ||
}; | ||
|
||
} // namespace plugins |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.