2009-12-15 17:36:21 +01:00
|
|
|
/*
|
2018-10-31 17:54:59 +01:00
|
|
|
* Copyright 2003-2018 The Music Player Daemon Project
|
2009-12-15 17:36:21 +01:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
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
|