ScummVM API documentation
serializer.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 
23 
24 #ifndef SCUMM_SERIALIZER_H
25 #define SCUMM_SERIALIZER_H
26 
27 
28 #include "common/serializer.h"
29 
30 
31 namespace Scumm {
32 
34 public:
36  : Common::Serializer(stream, writeStream), _seekableSaveStr(writeStream) {
37  }
38  ~Serializer() override {
39  }
40  int64 pos() const {
41  return _loadStream ? _loadStream->pos() : (_saveStream ? _saveStream->pos() : 0);
42  }
43  int seek(int64 offset, int whence = 0) {
44  return _loadStream ? _loadStream->seek(offset, whence) : (_seekableSaveStr ? _seekableSaveStr->seek(offset, whence) : -1);
45  }
46  int64 size() const {
47  return _loadStream ? _loadStream->size() : (_seekableSaveStr ? _seekableSaveStr->size() : 0);
48  }
49 
50 private:
51  Common::SeekableWriteStream *_seekableSaveStr;
52 };
53 
54 
55 } // End of namespace Audio
56 
57 #endif // #ifndef SCUMM_CDDA_H
virtual int64 size() const =0
virtual int64 pos() const =0
virtual bool seek(int64 offset, int whence=SEEK_SET)=0
virtual bool seek(int64 offset, int whence=SEEK_SET)=0
Definition: stream.h:745
Definition: serializer.h:79
virtual int64 size() const =0
virtual int64 pos() const =0
Definition: stream.h:351
Definition: serializer.h:33
Definition: actor.h:30