Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
PluginLoader.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
4 *
5 * Authors: David Auber and the Tulip development Team
6 * from LaBRI, University of Bordeaux
7 *
8 * Tulip is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * Tulip is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 */
19
20#ifndef TLP_PLUGINLOADER
21#define TLP_PLUGINLOADER
22#include <list>
23#include <string>
24#include <tulip/WithDependency.h>
25
26namespace tlp {
27
28class Plugin;
29
30/**
31 * @ingroup Plugins
32 *
33 * @brief A callback class when loading plugins into Tulip
34 *
35 * This interface can be subclassed and passed to the tlp::PluginLibraryLoader to implement custom
36 * event handling when loading plugins into Tulip
37 *
38 * @see tlp::PluginLibraryLoader
39 * @see tlp::PluginLoaderTxt
40 */
41struct TLP_SCOPE PluginLoader {
42 virtual ~PluginLoader() {}
43
44 /**
45 * @brief Called when starting to load plugins into a given directory
46 * @param path The absolute path of the directory
47 */
48 virtual void start(const std::string &path) = 0;
49
50 /**
51 * @brief Indicates the number of files to be loaded
52 * @param int the number of files
53 */
54 virtual void numberOfFiles(int) {}
55
56 /**
57 * @brief Indicates that a new file is being loaded
58 * @param filename The absolute path of the file
59 */
60 virtual void loading(const std::string &filename) = 0;
61
62 /**
63 * @brief Indicates that a plugin has been loaded successfully
64 * @param info The Plugin object that has just been loaded
65 * @param dependencies The plugin dependencies
66 *
67 * @see tlp::Dependency
68 */
69 virtual void loaded(const Plugin *info, const std::list<Dependency> &dependencies) = 0;
70
71 /**
72 * @brief Indicates that an error occurred when trying to load a file.
73 * @param filename The absolute path of where the error occurred.
74 * @param errormsg A human-readable error message.
75 */
76 virtual void aborted(const std::string &filename, const std::string &errormsg) = 0;
77
78 /**
79 * @brief Indicates that a file has finished being loaded
80 * @param state true if the load was successful
81 * @param msg An additional human-readable message about the load state
82 */
83 virtual void finished(bool state, const std::string &msg) = 0;
84
85 static PluginLoader *current;
86};
87} // namespace tlp
88#endif
Top-level interface for plug-ins.
Definition: Plugin.h:85
A callback class when loading plugins into Tulip.
Definition: PluginLoader.h:41
virtual void loaded(const Plugin *info, const std::list< Dependency > &dependencies)=0
Indicates that a plugin has been loaded successfully.
virtual void numberOfFiles(int)
Indicates the number of files to be loaded.
Definition: PluginLoader.h:54
virtual void aborted(const std::string &filename, const std::string &errormsg)=0
Indicates that an error occurred when trying to load a file.
virtual void finished(bool state, const std::string &msg)=0
Indicates that a file has finished being loaded.
virtual void start(const std::string &path)=0
Called when starting to load plugins into a given directory.
virtual void loading(const std::string &filename)=0
Indicates that a new file is being loaded.