ScummVM API documentation
archive.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 PINK_ARCHIVE_H
23#define PINK_ARCHIVE_H
24
25#include "common/hash-str.h"
26#include "common/str-array.h"
27#include "common/stream.h"
28
29namespace Common {
30
31class File;
32
33}
34
35namespace Pink {
36
37class Object;
38
39class Archive {
40public:
43
44 void mapObject(Object *obj);
45
46 byte readByte() { return _readStream->readByte(); }
47 uint32 readDWORD() { return _readStream->readUint32LE(); }
48 uint16 readWORD() { return _readStream->readUint16LE(); }
49
50 Common::String readString();
51 void skipString();
52
53 Object *readObject();
54
55 void write(const void *dataPtr, uint32 dataSize) { _writeStream->write(dataPtr, dataSize); }
56 void writeByte(byte val) { _writeStream->writeByte(val); }
57 void writeDWORD(uint32 val) { _writeStream->writeUint32LE(val); }
58 void writeWORD(uint16 val) { _writeStream->writeUint16LE(val); }
59
60 void writeString(const Common::String &string);
61
62private:
63 uint findObjectId(const char *name);
64
65 Object *parseObject(bool &isCopyReturned);
66
67 Common::Array<Object *> _objectMap;
68 Common::Array<uint> _objectIdMap;
69 Common::SeekableReadStream *_readStream;
70 Common::WriteStream *_writeStream;
71};
72
73} // End of namespace Pink
74
75#endif
uint16 readUint16LE()
Definition: stream.h:459
uint32 readUint32LE()
Definition: stream.h:473
byte readByte()
Definition: stream.h:434
Definition: stream.h:745
Definition: str.h:59
Definition: stream.h:77
void writeUint32LE(uint32 value)
Definition: stream.h:159
void writeUint16LE(uint16 value)
Definition: stream.h:152
void writeByte(byte value)
Definition: stream.h:140
virtual uint32 write(const void *dataPtr, uint32 dataSize)=0
Definition: archive.h:39
Definition: object.h:31
Definition: algorithm.h:29