2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2013-01-24 19:18:58 +01:00
|
|
|
#ifndef MPD_ARCHIVE_LIST_HXX
|
|
|
|
#define MPD_ARCHIVE_LIST_HXX
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2020-11-04 20:29:25 +01:00
|
|
|
#include <string_view>
|
|
|
|
|
2022-02-14 16:30:38 +01:00
|
|
|
struct ConfigData;
|
2014-02-08 13:22:13 +01:00
|
|
|
struct ArchivePlugin;
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2014-02-08 13:22:13 +01:00
|
|
|
extern const ArchivePlugin *const archive_plugins[];
|
2012-06-12 20:50:51 +02:00
|
|
|
|
|
|
|
#define archive_plugins_for_each(plugin) \
|
2014-02-08 13:22:13 +01:00
|
|
|
for (const ArchivePlugin *plugin, \
|
2012-06-12 20:50:51 +02:00
|
|
|
*const*archive_plugin_iterator = &archive_plugins[0]; \
|
2013-10-19 18:19:03 +02:00
|
|
|
(plugin = *archive_plugin_iterator) != nullptr; \
|
2012-06-12 20:50:51 +02:00
|
|
|
++archive_plugin_iterator)
|
|
|
|
|
2008-12-16 21:42:34 +01:00
|
|
|
/* interface for using plugins */
|
|
|
|
|
2014-02-08 13:22:13 +01:00
|
|
|
const ArchivePlugin *
|
2020-11-04 20:29:25 +01:00
|
|
|
archive_plugin_from_suffix(std::string_view suffix) noexcept;
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2014-02-08 13:22:13 +01:00
|
|
|
const ArchivePlugin *
|
2019-02-05 21:38:46 +01:00
|
|
|
archive_plugin_from_name(const char *name) noexcept;
|
2008-12-16 21:42:34 +01:00
|
|
|
|
|
|
|
/* this is where we "load" all the "plugins" ;-) */
|
2015-03-03 20:05:08 +01:00
|
|
|
void
|
2022-02-14 16:30:38 +01:00
|
|
|
archive_plugin_init_all(const ConfigData &config);
|
2008-12-16 21:42:34 +01:00
|
|
|
|
|
|
|
/* this is where we "unload" all the "plugins" */
|
2015-03-03 20:05:08 +01:00
|
|
|
void
|
2019-02-05 21:38:46 +01:00
|
|
|
archive_plugin_deinit_all() noexcept;
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2019-02-05 21:40:07 +01:00
|
|
|
class ScopeArchivePluginsInit {
|
|
|
|
public:
|
2022-02-14 16:30:38 +01:00
|
|
|
explicit ScopeArchivePluginsInit(const ConfigData &config) {
|
|
|
|
archive_plugin_init_all(config);
|
2019-02-05 21:40:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
~ScopeArchivePluginsInit() noexcept {
|
|
|
|
archive_plugin_deinit_all();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-12-16 21:42:34 +01:00
|
|
|
#endif
|