X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..1c529746ff07312e30e76fd933c628c658e3c77d:/projects/stargazer/store_loader.h?ds=sidebyside diff --git a/projects/stargazer/store_loader.h b/projects/stargazer/store_loader.h index a5066926..c187b540 100644 --- a/projects/stargazer/store_loader.h +++ b/projects/stargazer/store_loader.h @@ -18,45 +18,40 @@ * Author : Maxim Mamontov */ -/* - $Revision: 1.3 $ - $Date: 2010/03/04 12:24:19 $ - $Author: faust $ - */ +#pragma once -/* - * Header file for RAII store plugin loader - */ - -#ifndef __STORE_LOADER_H__ -#define __STORE_LOADER_H__ +#include "stg/module_settings.h" #include -#include "base_store.h" -#include "base_settings.h" -#include "settings.h" -#include "noncopyable.h" - -class STORE_LOADER : private NONCOPYABLE +namespace STG { -public: - STORE_LOADER(const SETTINGS & settings); - ~STORE_LOADER(); - - bool Load(); - bool Unload(); - - BASE_STORE * GetStore() { return plugin; }; - - const std::string & GetStrError() const { return errorStr; }; -private: - bool isLoaded; - void * handle; - BASE_STORE * plugin; - std::string errorStr; - MODULE_SETTINGS storeSettings; - std::string pluginFileName; + +struct Store; +class SettingsImpl; + +class StoreLoader { + public: + explicit StoreLoader(const SettingsImpl& settings) noexcept; + ~StoreLoader(); + + StoreLoader(const StoreLoader&) = delete; + StoreLoader& operator=(const StoreLoader&) = delete; + + bool load() noexcept; + bool unload() noexcept; + + Store& get() noexcept { return *plugin; } + + const std::string& GetStrError() const noexcept { return errorStr; } + + private: + bool isLoaded; + void* handle; + Store* plugin; + std::string errorStr; + ModuleSettings storeSettings; + std::string pluginFileName; }; -#endif +}