ArchiveList.hxx 1.68 KB
Newer Older
1
/*
Max Kellermann's avatar
Max Kellermann committed
2
 * Copyright 2003-2019 The Music Player Daemon Project
3
 * http://www.musicpd.org
4 5 6 7 8 9 10 11 12 13
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
14 15 16 17
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 19
 */

20 21
#ifndef MPD_ARCHIVE_LIST_HXX
#define MPD_ARCHIVE_LIST_HXX
22

23
struct ArchivePlugin;
24

25
extern const ArchivePlugin *const archive_plugins[];
26 27

#define archive_plugins_for_each(plugin) \
28
	for (const ArchivePlugin *plugin, \
29
		*const*archive_plugin_iterator = &archive_plugins[0]; \
30
		(plugin = *archive_plugin_iterator) != nullptr; \
31 32
		++archive_plugin_iterator)

33 34
/* interface for using plugins */

35
const ArchivePlugin *
36
archive_plugin_from_suffix(const char *suffix) noexcept;
37

38
const ArchivePlugin *
39
archive_plugin_from_name(const char *name) noexcept;
40 41

/* this is where we "load" all the "plugins" ;-) */
42 43
void
archive_plugin_init_all();
44 45

/* this is where we "unload" all the "plugins" */
46
void
47
archive_plugin_deinit_all() noexcept;
48

49 50 51 52 53 54 55 56 57 58 59
class ScopeArchivePluginsInit {
public:
	ScopeArchivePluginsInit() {
		archive_plugin_init_all();
	}

	~ScopeArchivePluginsInit() noexcept {
		archive_plugin_deinit_all();
	}
};

60
#endif