forked from EvergreenCrypto/docker-finance
container: plugins: root: example: support Pluggable entrypoint
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// docker-finance | modern accounting for the power-user
|
// docker-finance | modern accounting for the power-user
|
||||||
//
|
//
|
||||||
// Copyright (C) 2024-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
// Copyright (C) 2024-2026 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@@ -41,9 +41,25 @@ namespace dfi::plugin
|
|||||||
//! \since docker-finance 1.1.0
|
//! \since docker-finance 1.1.0
|
||||||
namespace example
|
namespace example
|
||||||
{
|
{
|
||||||
|
//! \brief Pluggable entrypoint
|
||||||
|
//! \ingroup cpp_plugin_impl
|
||||||
|
//! \since docker-finance 1.1.0
|
||||||
|
class example_cc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
example_cc() = default;
|
||||||
|
~example_cc() = default;
|
||||||
|
|
||||||
|
example_cc(const example_cc&) = default;
|
||||||
|
example_cc& operator=(const example_cc&) = default;
|
||||||
|
|
||||||
|
example_cc(example_cc&&) = default;
|
||||||
|
example_cc& operator=(example_cc&&) = default;
|
||||||
|
|
||||||
|
public:
|
||||||
//! \brief Example auto-loader
|
//! \brief Example auto-loader
|
||||||
//! \param arg String to pass to auto-loader (use-case is plugin-implementation defined)
|
//! \param arg String to pass to auto-loader (use-case is plugin-implementation defined)
|
||||||
void load(const std::string& arg = {})
|
static void load(const std::string& arg = {})
|
||||||
{
|
{
|
||||||
namespace plugin = ::dfi::plugin;
|
namespace plugin = ::dfi::plugin;
|
||||||
namespace common = ::dfi::common;
|
namespace common = ::dfi::common;
|
||||||
@@ -71,7 +87,7 @@ void load(const std::string& arg = {})
|
|||||||
|
|
||||||
//! \brief Example auto-unloader
|
//! \brief Example auto-unloader
|
||||||
//! \param arg String to pass to auto-unloader (use-case is plugin-implementation defined)
|
//! \param arg String to pass to auto-unloader (use-case is plugin-implementation defined)
|
||||||
void unload(const std::string& arg = {})
|
static void unload(const std::string& arg = {})
|
||||||
{
|
{
|
||||||
namespace plugin = ::dfi::plugin;
|
namespace plugin = ::dfi::plugin;
|
||||||
namespace common = ::dfi::common;
|
namespace common = ::dfi::common;
|
||||||
@@ -96,9 +112,8 @@ void unload(const std::string& arg = {})
|
|||||||
plugin::common::PluginPath path("repo/example/internal/example.cc");
|
plugin::common::PluginPath path("repo/example/internal/example.cc");
|
||||||
common::unload(path.absolute());
|
common::unload(path.absolute());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: to auto-reload this plugin, load()/unload() here or utilize one of the `dfi::plugin::reload()` functions.
|
// NOTE: to auto-reload this plugin, load()/unload() here or utilize one of the `dfi::plugin::reload()` functions.
|
||||||
|
};
|
||||||
} // namespace example
|
} // namespace example
|
||||||
} // namespace dfi::plugin
|
} // namespace dfi::plugin
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user