2008-06-01 11:43:20 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COMMON_UNARJ_H
|
|
|
|
#define COMMON_UNARJ_H
|
|
|
|
|
|
|
|
#include "common/file.h"
|
|
|
|
#include "common/hash-str.h"
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
|
2008-11-07 09:46:12 +00:00
|
|
|
struct ArjHeader;
|
2008-06-01 11:43:20 +00:00
|
|
|
|
|
|
|
typedef HashMap<String, int, IgnoreCase_Hash, IgnoreCase_EqualTo> ArjFilesMap;
|
|
|
|
|
2008-11-07 10:14:57 +00:00
|
|
|
// TODO: Get rid of this class, by implementing an ArjArchive subclass of Common::Archive.
|
|
|
|
// Then ArjFile can be substituted by a SearchSet full of ArjArchives plus SearchMan.
|
2008-09-29 10:49:36 +00:00
|
|
|
class ArjFile : public SeekableReadStream, public NonCopyable {
|
2008-06-01 11:43:20 +00:00
|
|
|
public:
|
|
|
|
ArjFile();
|
|
|
|
~ArjFile();
|
|
|
|
|
2008-06-01 21:10:29 +00:00
|
|
|
void enableFallback(bool val) { _fallBack = val; }
|
|
|
|
|
2008-06-01 11:43:20 +00:00
|
|
|
void registerArchive(const String &filename);
|
|
|
|
|
2008-07-29 16:09:10 +00:00
|
|
|
bool open(const Common::String &filename);
|
2008-06-01 11:43:20 +00:00
|
|
|
void close();
|
|
|
|
|
|
|
|
uint32 read(void *dataPtr, uint32 dataSize);
|
2008-09-29 10:49:36 +00:00
|
|
|
bool eos() const;
|
|
|
|
int32 pos() const;
|
|
|
|
int32 size() const;
|
2008-09-13 16:51:46 +00:00
|
|
|
bool seek(int32 offset, int whence = SEEK_SET);
|
2008-11-07 09:50:51 +00:00
|
|
|
bool isOpen() { return _uncompressed != 0; }
|
2008-06-01 11:43:20 +00:00
|
|
|
|
|
|
|
private:
|
2008-06-01 21:10:29 +00:00
|
|
|
bool _fallBack;
|
|
|
|
|
2008-06-01 11:43:20 +00:00
|
|
|
Array<ArjHeader *> _headers;
|
|
|
|
ArjFilesMap _fileMap;
|
|
|
|
StringMap _archMap;
|
2008-11-07 09:46:12 +00:00
|
|
|
|
2008-06-01 21:10:29 +00:00
|
|
|
SeekableReadStream *_uncompressed;
|
2008-06-01 11:43:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Common
|
|
|
|
|
|
|
|
#endif
|