-
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
1 parent
d1daa32
commit a6ec7ef
Showing
8 changed files
with
79 additions
and
102 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 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
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,35 @@ | ||
#include "plugin/MyPlugin.h" | ||
|
||
#include <memory> | ||
|
||
#include "ll/api/plugin/NativePlugin.h" | ||
#include "ll/api/plugin/RegisterHelper.h" | ||
|
||
namespace my_plugin { | ||
|
||
std::unique_ptr<MyPlugin>& MyPlugin::getInstance() { | ||
static std::unique_ptr<MyPlugin> instance; | ||
return instance; | ||
} | ||
|
||
bool MyPlugin::load() { | ||
getSelf().getLogger().info("Loading..."); | ||
// Code for loading the plugin goes here. | ||
return true; | ||
} | ||
|
||
bool MyPlugin::enable() { | ||
getSelf().getLogger().info("Enabling..."); | ||
// Code for enabling the plugin goes here. | ||
return true; | ||
} | ||
|
||
bool MyPlugin::disable() { | ||
getSelf().getLogger().info("Disabling..."); | ||
// Code for disabling the plugin goes here. | ||
return true; | ||
} | ||
|
||
} // namespace my_plugin | ||
|
||
LL_REGISTER_PLUGIN(my_plugin::MyPlugin, my_plugin::MyPlugin::getInstance()); |
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,33 @@ | ||
#pragma once | ||
|
||
#include "ll/api/plugin/NativePlugin.h" | ||
|
||
namespace my_plugin { | ||
|
||
class MyPlugin { | ||
|
||
public: | ||
static std::unique_ptr<MyPlugin>& getInstance(); | ||
|
||
MyPlugin(ll::plugin::NativePlugin& self) : mSelf(self) {} | ||
|
||
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; } | ||
|
||
/// @return True if the plugin is loaded successfully. | ||
bool load(); | ||
|
||
/// @return True if the plugin is enabled successfully. | ||
bool enable(); | ||
|
||
/// @return True if the plugin is disabled successfully. | ||
bool disable(); | ||
|
||
// TODO: Implement this method if you need to unload the plugin. | ||
// /// @return True if the plugin is unloaded successfully. | ||
// bool unload(); | ||
|
||
private: | ||
ll::plugin::NativePlugin& mSelf; | ||
}; | ||
|
||
} // namespace my_plugin |
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 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