Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
pluginmanager.hh
Go to the documentation of this file.
1/*
2 * Scroom - Generic viewer for 2D data
3 * Copyright (C) 2009-2026 Kees-Jan Dijkzeul
4 *
5 * SPDX-License-Identifier: LGPL-2.1
6 */
7
8#pragma once
9
10#include <list>
11#include <map>
12#include <string>
13#include <utility>
14
15#include <gtk/gtk.h>
16
17#include <scroom/logger.hh>
22#include <scroom/utilities.hh>
23
24#include "view.hh"
25#include "workinterface.hh"
26
28{
29 GModule* plugin;
31
32 PluginInformation(GModule* plugin_, PluginInformationInterface::Ptr pluginInformation_)
33 : plugin(plugin_)
34 , pluginInformation(std::move(pluginInformation_))
35 {
36 }
37};
38
40 : public WorkInterface
42 , virtual public Scroom::Utils::Base
43{
44public:
45 using Ptr = std::shared_ptr<PluginManager>;
46
47private:
55
56private:
57 bool devMode{false};
59 std::list<std::string> dirs;
60 std::list<std::string>::iterator currentDir;
61 std::list<std::string> files;
62 std::list<std::string>::iterator currentFile;
63 std::list<PluginInformation> pluginInformationList;
64 std::map<NewPresentationInterface::Ptr, std::string> newPresentationInterfaces;
65 std::map<std::string, NewAggregateInterface::Ptr> newAggregateInterfaces;
66 std::map<OpenPresentationInterface::Ptr, std::string> openPresentationInterfaces;
67 std::map<Scroom::TiledBitmap::OpenTiledBitmapInterface::Ptr, std::string> openTiledBitmapInterfaces;
68 std::map<OpenInterface::Ptr, std::string> openInterfaces;
69 std::map<ViewObserver::Ptr, std::string> viewObservers;
70 std::map<PresentationObserver::Ptr, std::string> presentationObservers;
72
73private:
74 void setStatusBarMessage(const char* message);
75
76 PluginManager() = default;
77
78public:
79 static Ptr create();
80
81 bool doWork() override;
82
83 void addHook(bool devMode);
84
86 const std::string& identifier,
87 NewPresentationInterface::Ptr newPresentationInterface
88 ) override;
89 void registerNewAggregateInterface(const std::string& identifier, NewAggregateInterface::Ptr newAggregateInterface) override;
91 const std::string& extension,
92 OpenPresentationInterface::Ptr openPresentationInterface
93 ) override;
95 const std::string& identifier,
96 std::shared_ptr<Scroom::TiledBitmap::OpenTiledBitmapInterface> openTiledBitmapInterface
97 ) override;
98 void registerOpenInterface(const std::string& extension, OpenInterface::Ptr openInterface) override;
99 void registerViewObserver(const std::string& identifier, ViewObserver::Ptr observer) override;
100 void registerPresentationObserver(const std::string& identifier, PresentationObserver::Ptr observer) override;
101
102 const std::map<NewPresentationInterface::Ptr, std::string>& getNewPresentationInterfaces();
103 const std::map<std::string, NewAggregateInterface::Ptr>& getNewAggregateInterfaces();
104 const std::map<OpenPresentationInterface::Ptr, std::string>& getOpenPresentationInterfaces();
105 const std::map<Scroom::TiledBitmap::OpenTiledBitmapInterface::Ptr, std::string>& getOpenTiledBitmapInterfaces();
106 const std::map<OpenInterface::Ptr, std::string>& getOpenInterfaces();
107 const std::map<ViewObserver::Ptr, std::string>& getViewObservers();
108 const std::map<PresentationObserver::Ptr, std::string>& getPresentationObservers();
109
110public:
112};
113
114void startPluginManager(bool devMode);
std::shared_ptr< NewAggregateInterface > Ptr
Definition scroominterface.hh:46
std::shared_ptr< NewPresentationInterface > Ptr
Definition scroominterface.hh:37
std::shared_ptr< OpenInterface > Ptr
Definition scroominterface.hh:71
std::shared_ptr< OpenPresentationInterface > Ptr
Definition scroominterface.hh:55
std::shared_ptr< PluginInformationInterface > Ptr
Definition plugininformationinterface.hh:20
Definition pluginmanager.hh:43
void registerViewObserver(const std::string &identifier, ViewObserver::Ptr observer) override
Definition pluginmanager.cc:293
void addHook(bool devMode)
Definition pluginmanager.cc:245
std::list< std::string > dirs
Definition pluginmanager.hh:59
const std::map< ViewObserver::Ptr, std::string > & getViewObservers()
Definition pluginmanager.cc:327
std::map< NewPresentationInterface::Ptr, std::string > newPresentationInterfaces
Definition pluginmanager.hh:64
PluginManagerState state
Definition pluginmanager.hh:58
void registerOpenTiledBitmapInterface(const std::string &identifier, std::shared_ptr< Scroom::TiledBitmap::OpenTiledBitmapInterface > openTiledBitmapInterface) override
Definition pluginmanager.cc:279
bool devMode
Definition pluginmanager.hh:57
std::shared_ptr< PluginManager > Ptr
Definition pluginmanager.hh:45
std::list< std::string >::iterator currentDir
Definition pluginmanager.hh:60
static Ptr create()
Definition pluginmanager.cc:31
const std::map< PresentationObserver::Ptr, std::string > & getPresentationObservers()
Definition pluginmanager.cc:329
std::map< ViewObserver::Ptr, std::string > viewObservers
Definition pluginmanager.hh:69
void registerNewPresentationInterface(const std::string &identifier, NewPresentationInterface::Ptr newPresentationInterface) override
Definition pluginmanager.cc:256
const std::map< OpenPresentationInterface::Ptr, std::string > & getOpenPresentationInterfaces()
Definition pluginmanager.cc:315
PluginManager()=default
std::map< PresentationObserver::Ptr, std::string > presentationObservers
Definition pluginmanager.hh:70
static PluginManager::Ptr getInstance()
Definition pluginmanager.cc:334
std::map< OpenPresentationInterface::Ptr, std::string > openPresentationInterfaces
Definition pluginmanager.hh:66
const std::map< std::string, NewAggregateInterface::Ptr > & getNewAggregateInterfaces()
Definition pluginmanager.cc:310
void registerOpenInterface(const std::string &extension, OpenInterface::Ptr openInterface) override
Definition pluginmanager.cc:288
void registerPresentationObserver(const std::string &identifier, PresentationObserver::Ptr observer) override
Definition pluginmanager.cc:300
const std::map< Scroom::TiledBitmap::OpenTiledBitmapInterface::Ptr, std::string > & getOpenTiledBitmapInterfaces()
Definition pluginmanager.cc:320
std::map< std::string, NewAggregateInterface::Ptr > newAggregateInterfaces
Definition pluginmanager.hh:65
bool doWork() override
Definition pluginmanager.cc:35
const std::map< OpenInterface::Ptr, std::string > & getOpenInterfaces()
Definition pluginmanager.cc:325
std::list< std::string >::iterator currentFile
Definition pluginmanager.hh:62
const std::map< NewPresentationInterface::Ptr, std::string > & getNewPresentationInterfaces()
Definition pluginmanager.cc:305
void setStatusBarMessage(const char *message)
Definition pluginmanager.cc:239
PluginManagerState
Definition pluginmanager.hh:49
@ FINDING_DIRECTORIES
Definition pluginmanager.hh:50
@ SCANNING_DIRECTORIES
Definition pluginmanager.hh:51
@ DONE
Definition pluginmanager.hh:53
@ LOADING_FILES
Definition pluginmanager.hh:52
std::list< PluginInformation > pluginInformationList
Definition pluginmanager.hh:63
Scroom::Logger logger
Definition pluginmanager.hh:71
std::list< std::string > files
Definition pluginmanager.hh:61
std::map< Scroom::TiledBitmap::OpenTiledBitmapInterface::Ptr, std::string > openTiledBitmapInterfaces
Definition pluginmanager.hh:67
void registerOpenPresentationInterface(const std::string &extension, OpenPresentationInterface::Ptr openPresentationInterface) override
Definition pluginmanager.cc:271
void registerNewAggregateInterface(const std::string &identifier, NewAggregateInterface::Ptr newAggregateInterface) override
Definition pluginmanager.cc:266
std::map< OpenInterface::Ptr, std::string > openInterfaces
Definition pluginmanager.hh:68
std::shared_ptr< PresentationObserver > Ptr
Definition scroominterface.hh:82
Definition scroominterface.hh:99
Definition logger.hh:49
Definition utilities.hh:34
std::shared_ptr< ViewObserver > Ptr
Definition scroominterface.hh:92
Definition workinterface.hh:13
STL namespace.
TestObserver::Ptr observer
Definition observable-tests.cc:91
void startPluginManager(bool devMode)
Definition pluginmanager.cc:33
Definition pluginmanager.hh:28
GModule * plugin
Definition pluginmanager.hh:29
PluginInformation(GModule *plugin_, PluginInformationInterface::Ptr pluginInformation_)
Definition pluginmanager.hh:32
PluginInformationInterface::Ptr pluginInformation
Definition pluginmanager.hh:30