2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2009-12-15 17:36:21 +01:00
|
|
|
|
2013-01-24 19:18:58 +01:00
|
|
|
#ifndef MPD_ARCHIVE_PLUGIN_HXX
|
|
|
|
#define MPD_ARCHIVE_PLUGIN_HXX
|
2009-12-15 17:36:21 +01:00
|
|
|
|
2017-12-27 09:07:21 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2013-01-29 23:26:51 +01:00
|
|
|
class ArchiveFile;
|
2014-02-08 13:21:50 +01:00
|
|
|
class Path;
|
2009-12-15 17:36:21 +01:00
|
|
|
|
2014-02-08 13:22:13 +01:00
|
|
|
struct ArchivePlugin {
|
2009-12-15 17:36:21 +01:00
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/**
|
2013-10-19 18:19:03 +02:00
|
|
|
* optional, set this to nullptr if the archive plugin doesn't
|
2009-12-15 17:36:21 +01:00
|
|
|
* have/need one this must false if there is an error and
|
|
|
|
* true otherwise
|
|
|
|
*/
|
2015-03-03 20:05:08 +01:00
|
|
|
bool (*init)();
|
2009-12-15 17:36:21 +01:00
|
|
|
|
|
|
|
/**
|
2013-10-19 18:19:03 +02:00
|
|
|
* optional, set this to nullptr if the archive plugin doesn't
|
2009-12-15 17:36:21 +01:00
|
|
|
* have/need one
|
|
|
|
*/
|
2015-03-03 20:05:08 +01:00
|
|
|
void (*finish)();
|
2009-12-15 17:36:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* tryes to open archive file and associates handle with archive
|
|
|
|
* returns pointer to handle used is all operations with this archive
|
2016-09-09 18:34:55 +02:00
|
|
|
*
|
|
|
|
* Throws std::runtime_error on error.
|
2009-12-15 17:36:21 +01:00
|
|
|
*/
|
2017-12-27 09:07:21 +01:00
|
|
|
std::unique_ptr<ArchiveFile> (*open)(Path path_fs);
|
2009-12-15 17:36:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* suffixes handled by this plugin.
|
2013-10-19 18:19:03 +02:00
|
|
|
* last element in these arrays must always be a nullptr
|
2009-12-15 17:36:21 +01:00
|
|
|
*/
|
|
|
|
const char *const*suffixes;
|
|
|
|
};
|
|
|
|
|
2017-12-27 09:07:21 +01:00
|
|
|
std::unique_ptr<ArchiveFile>
|
2016-09-09 18:34:55 +02:00
|
|
|
archive_file_open(const ArchivePlugin *plugin, Path path);
|
2009-12-16 16:28:26 +01:00
|
|
|
|
|
|
|
#endif
|