VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Plugin.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <VoltMod/Runtime.hpp>
4
5namespace VoltMod
6{
7
8/**
9 * @brief Everything a plugin owns for one load cycle.
10 *
11 * The framework constructs the derived class with a live @ref Runtime, calls @ref Load, and
12 * destroys it before that runtime. Release plugin-owned resources in member destructors.
13 */
14class Plugin
15{
16public:
18 virtual ~Plugin() = default;
19
20 Plugin(const Plugin&) = delete;
21 Plugin& operator=(const Plugin&) = delete;
22
23 /** Framework services for this plugin's load cycle. */
25
26 /** Start work that can fail the load, after every member is built. Returning false aborts it. */
27 virtual bool Load() { return true; }
28};
29
30} // namespace VoltMod
Everything a plugin owns for one load cycle.
Definition Plugin.hpp:15
Plugin & operator=(const Plugin &)=delete
VoltMod::Runtime & Runtime
Definition Plugin.hpp:24
Plugin(const Plugin &)=delete
virtual bool Load()
Definition Plugin.hpp:27
Plugin(VoltMod::Runtime &runtime)
Definition Plugin.hpp:17
virtual ~Plugin()=default
Framework services for one load and unload cycle.
Definition Runtime.hpp:57
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56