-
Notifications
You must be signed in to change notification settings - Fork 10
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
5 changed files
with
87 additions
and
19 deletions.
There are no files selected for viewing
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,28 @@ | ||
#include "LegacyScriptEngine.h" | ||
|
||
#include <ll/api/plugin/NativePlugin.h> | ||
#include <memory> | ||
|
||
|
||
namespace lse { | ||
|
||
namespace { | ||
std::unique_ptr<LegacyScriptEngine> legacyScriptEngine; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) | ||
} // namespace | ||
|
||
LegacyScriptEngine& getLegacyScriptEngine() { return *legacyScriptEngine; } | ||
|
||
extern "C" { | ||
_declspec(dllexport) bool ll_plugin_load(ll::plugin::NativePlugin& self) { | ||
legacyScriptEngine = std::make_unique<LegacyScriptEngine>(self); | ||
return true; | ||
} | ||
|
||
_declspec(dllexport) bool ll_plugin_enable(ll::plugin::NativePlugin& /*unused*/) { | ||
return legacyScriptEngine->enable(); | ||
} | ||
|
||
// LegacyScriptEngine should not be disabled or unloaded. | ||
} | ||
|
||
} // namespace lse |
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,9 @@ | ||
#pragma once | ||
|
||
#include "LegacyScriptEngine.h" | ||
|
||
namespace lse { | ||
|
||
[[nodiscard]] LegacyScriptEngine& getLegacyScriptEngine(); | ||
|
||
} // namespace lse |
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,24 @@ | ||
#include "LegacyScriptEngine.h" | ||
|
||
#include <ll/api/plugin/NativePlugin.h> | ||
|
||
namespace lse { | ||
|
||
LegacyScriptEngine::LegacyScriptEngine(ll::plugin::NativePlugin& self) : mSelf(self) { | ||
mSelf.getLogger().info("loading..."); | ||
|
||
// Code for loading the plugin goes here. | ||
} | ||
|
||
ll::plugin::NativePlugin& LegacyScriptEngine::getSelf() const { return mSelf; } | ||
|
||
bool LegacyScriptEngine::enable() { | ||
mSelf.getLogger().info("enabling..."); | ||
|
||
// Code for enabling the plugin goes here. | ||
|
||
return true; | ||
} | ||
|
||
|
||
} // namespace lse |
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,26 @@ | ||
#pragma once | ||
|
||
#include <ll/api/plugin/NativePlugin.h> | ||
|
||
namespace lse { | ||
|
||
class LegacyScriptEngine { | ||
public: | ||
explicit LegacyScriptEngine(ll::plugin::NativePlugin& self); | ||
|
||
LegacyScriptEngine(LegacyScriptEngine&&) = delete; | ||
LegacyScriptEngine(const LegacyScriptEngine&) = delete; | ||
LegacyScriptEngine& operator=(LegacyScriptEngine&&) = delete; | ||
LegacyScriptEngine& operator=(const LegacyScriptEngine&) = delete; | ||
|
||
~LegacyScriptEngine() = default; | ||
|
||
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const; | ||
|
||
bool enable(); | ||
|
||
private: | ||
ll::plugin::NativePlugin& mSelf; | ||
}; | ||
|
||
} // namespace lse |