2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2016-02-26 17:54:05 +01:00
|
|
|
* Copyright 2003-2016 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2008-12-16 21:42:34 +01:00
|
|
|
*
|
|
|
|
* 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.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* 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.
|
2008-12-16 21:42:34 +01:00
|
|
|
*/
|
|
|
|
|
2013-01-29 23:26:51 +01:00
|
|
|
#ifndef MPD_ARCHIVE_FILE_HXX
|
|
|
|
#define MPD_ARCHIVE_FILE_HXX
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2013-10-17 10:06:31 +02:00
|
|
|
class Mutex;
|
|
|
|
class Cond;
|
2014-02-08 13:22:13 +01:00
|
|
|
struct ArchivePlugin;
|
2013-11-28 11:50:54 +01:00
|
|
|
class ArchiveVisitor;
|
2014-05-11 15:34:48 +02:00
|
|
|
class InputStream;
|
2013-08-10 18:02:44 +02:00
|
|
|
|
2013-01-29 23:26:51 +01:00
|
|
|
class ArchiveFile {
|
|
|
|
public:
|
2014-02-08 13:22:13 +01:00
|
|
|
const ArchivePlugin &plugin;
|
2008-12-16 21:42:34 +01:00
|
|
|
|
2014-02-08 13:22:13 +01:00
|
|
|
ArchiveFile(const ArchivePlugin &_plugin)
|
2013-01-29 23:26:51 +01:00
|
|
|
:plugin(_plugin) {}
|
2013-01-29 23:36:58 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Use Close() instead of delete.
|
|
|
|
*/
|
|
|
|
~ArchiveFile() {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual void Close() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit all entries inside this archive.
|
|
|
|
*/
|
|
|
|
virtual void Visit(ArchiveVisitor &visitor) = 0;
|
|
|
|
|
|
|
|
/**
|
2013-10-23 22:08:59 +02:00
|
|
|
* Opens an InputStream of a file within the archive.
|
2013-01-29 23:36:58 +01:00
|
|
|
*
|
2016-09-09 15:37:06 +02:00
|
|
|
* Throws std::runtime_error on error.
|
|
|
|
*
|
2013-01-29 23:36:58 +01:00
|
|
|
* @param path the path within the archive
|
|
|
|
*/
|
2013-10-23 22:08:59 +02:00
|
|
|
virtual InputStream *OpenStream(const char *path,
|
2016-09-09 15:37:06 +02:00
|
|
|
Mutex &mutex, Cond &cond) = 0;
|
2013-01-29 23:26:51 +01:00
|
|
|
};
|
2009-12-16 16:28:26 +01:00
|
|
|
|
2008-12-16 21:42:34 +01:00
|
|
|
#endif
|