major cleanup

This commit is contained in:
ineed bots
2023-08-27 01:35:49 -06:00
parent 3f71e99a0b
commit cdad6184dd
21 changed files with 75 additions and 6968 deletions

View File

@@ -6,22 +6,17 @@ void component_loader::register_component(std::unique_ptr<component_interface>&&
get_components().push_back(std::move(component_));
}
bool component_loader::post_start()
{
static auto handled = false;
if (handled) return true;
handled = true;
try
for (const auto& component_ : get_components())
{
for (const auto& component_ : get_components())
{
component_->post_start();
}
}
catch (premature_shutdown_trigger&)
{
return false;
component_->post_start();
}
return true;
@@ -35,16 +30,9 @@ bool component_loader::post_load()
clean();
try
for (const auto& component_ : get_components())
{
for (const auto& component_ : get_components())
{
component_->post_load();
}
}
catch (premature_shutdown_trigger&)
{
return false;
component_->post_load();
}
return true;
@@ -107,11 +95,6 @@ void* component_loader::load_import(const std::string& library, const std::strin
return function_ptr;
}
void component_loader::trigger_premature_shutdown()
{
throw premature_shutdown_trigger();
}
std::vector<std::unique_ptr<component_interface>>& component_loader::get_components()
{
using component_vector = std::vector<std::unique_ptr<component_interface>>;

View File

@@ -4,14 +4,6 @@
class component_loader final
{
public:
class premature_shutdown_trigger final : public std::exception
{
[[nodiscard]] const char* what() const noexcept override
{
return "Premature shutdown requested";
}
};
template <typename T>
class installer final
{
@@ -48,8 +40,6 @@ public:
static void* load_import(const std::string& library, const std::string& function);
static void trigger_premature_shutdown();
private:
static std::vector<std::unique_ptr<component_interface>>& get_components();
};