mpd/src/archive/ArchiveList.hxx

48 lines
1.1 KiB
C++
Raw Normal View History

// 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
#include <string_view>
struct ConfigData;
struct ArchivePlugin;
2008-12-16 21:42:34 +01:00
extern const ArchivePlugin *const archive_plugins[];
2012-06-12 20:50:51 +02:00
#define archive_plugins_for_each(plugin) \
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 */
const ArchivePlugin *
archive_plugin_from_suffix(std::string_view suffix) noexcept;
2008-12-16 21:42:34 +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" ;-) */
void
archive_plugin_init_all(const ConfigData &config);
2008-12-16 21:42:34 +01:00
/* this is where we "unload" all the "plugins" */
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:
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