ScummVM API documentation
rawfile.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  * VGMTrans (c) 2002-2019
23  * Licensed under the zlib license,
24  * refer to the included VGMTrans_LICENSE.txt file
25  */
26 
27 #ifndef AUDIO_SOUNDFONT_RAWFILE_H
28 #define AUDIO_SOUNDFONT_RAWFILE_H
29 
30 #include "common/stream.h"
31 #include "common/str.h"
32 
33 class VGMFile;
34 
35 class RawFile {
36 public:
37  virtual ~RawFile() {};
38 
39  virtual size_t size() const = 0;
40 
41  bool IsValidOffset(uint32 ofs) { return ofs < size(); }
42 
43  const char *begin() const { return data(); }
44  const char *end() { return data() + size(); }
45  virtual const char *data() const = 0;
46 
47  virtual uint8 GetByte(size_t offset) const = 0;
48  virtual uint16 GetShort(size_t offset) const = 0;
49  virtual uint32 GetWord(size_t offset) const = 0;
50 
51  uint32 GetBytes(size_t offset, uint32 nCount, void *pBuffer) const;
52 
53 private:
54 };
55 
56 class MemFile : public RawFile {
57 private:
58  Common::SeekableReadStream *_seekableReadStream;
59  const byte *_data;
60 
61 public:
62  MemFile(const byte *data, uint32 size);
63  ~MemFile() override;
64 
65  const char *data() const override;
66 
67  uint8 GetByte(size_t offset) const override;
68  uint16 GetShort(size_t offset) const override;
69  uint32 GetWord(size_t offset) const override;
70 
71  size_t size() const override;
72 };
73 
74 #endif // AUDIO_SOUNDFONT_RAWFILE_H
Definition: rawfile.h:35
Definition: stream.h:745
Definition: rawfile.h:56
Definition: vgmitem.h:89