ScummVM API documentation
powerpacker.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef COMMON_POWERPACKER_H
23#define COMMON_POWERPACKER_H
24
25#include "common/stream.h"
26
27namespace Common {
29
30 SeekableReadStream *_stream;
31 bool _dispose;
32
33private:
34 static int ppDecrunchBuffer(const byte *src, byte *dest, uint32 src_len, uint32 dest_len);
35 static uint16 getCrunchType(uint32 signature);
36
37public:
39
40 static byte *unpackBuffer(const byte *input, uint32 input_len, uint32 &output_len);
41
42 ~PowerPackerStream() override {
43 if (_dispose) delete _stream;
44 }
45
46 int64 size() const override {
47 return _stream->size();
48 }
49
50 int64 pos() const override {
51 return _stream->pos();
52 }
53
54 bool eos() const override {
55 return _stream->eos();
56 }
57
58 bool seek(int64 offs, int whence = SEEK_SET) override {
59 return _stream->seek(offs, whence);
60 }
61
62 uint32 read(void *dataPtr, uint32 dataSize) override {
63 return _stream->read(dataPtr, dataSize);
64 }
65
66};
67} // End of namespace Common
68
69#endif
Definition: powerpacker.h:28
bool eos() const override
Definition: powerpacker.h:54
uint32 read(void *dataPtr, uint32 dataSize) override
Definition: powerpacker.h:62
int64 size() const override
Definition: powerpacker.h:46
int64 pos() const override
Definition: powerpacker.h:50
bool seek(int64 offs, int whence=SEEK_SET) override
Definition: powerpacker.h:58
virtual bool eos() const =0
virtual uint32 read(void *dataPtr, uint32 dataSize)=0
Definition: stream.h:745
virtual int64 pos() const =0
virtual int64 size() const =0
virtual bool seek(int64 offset, int whence=SEEK_SET)=0
Definition: algorithm.h:29