ScummVM API documentation
archive_file.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 ULTIMA8_FILESYS_ARCHIVEFILE_H
23 #define ULTIMA8_FILESYS_ARCHIVEFILE_H
24 
25 #include "ultima/shared/std/string.h"
26 
27 namespace Ultima {
28 namespace Ultima8 {
29 
30 class ArchiveFile {
31 public:
32  virtual ~ArchiveFile() { }
33 
35  virtual bool isValid() const {
36  return _valid;
37  }
38 
43  virtual bool exists(uint32 index) = 0;
44 
49  virtual bool exists(const Std::string &name) = 0;
50 
51 
57  virtual uint8 *getObject(uint32 index, uint32 *size = 0) = 0;
58 
64  virtual uint8 *getObject(const Std::string &name, uint32 *size = 0) = 0;
65 
66 
70  virtual uint32 getSize(uint32 index) const = 0;
71 
75  virtual uint32 getSize(const Std::string &name) const = 0;
76 
79  Common::SeekableReadStream *getDataSource(uint32 index, bool is_text = false);
80 
83  Common::SeekableReadStream *getDataSource(const Std::string &name, bool is_text = false);
84 
88  virtual uint32 getCount() const = 0;
89 
93  virtual uint32 getIndexCount() const = 0;
94 
96  virtual bool isIndexed() const = 0;
97 
99  virtual bool isNamed() const = 0;
100 
101 protected:
102  static bool extractIndexFromName(const Std::string &name, uint32 &index);
103 
104  bool _valid;
105 };
106 
107 } // End of namespace Ultima8
108 } // End of namespace Ultima
109 
110 #endif
virtual uint32 getSize(uint32 index) const =0
virtual bool exists(uint32 index)=0
Common::SeekableReadStream * getDataSource(uint32 index, bool is_text=false)
Definition: archive_file.h:30
Definition: stream.h:652
virtual uint32 getIndexCount() const =0
Definition: detection.h:27
Definition: string.h:30
virtual bool isIndexed() const =0
is archive indexed?
virtual uint32 getCount() const =0
virtual bool isNamed() const =0
is archive named?
virtual uint8 * getObject(uint32 index, uint32 *size=0)=0
virtual bool isValid() const
Check if constructed object is indeed a valid archive.
Definition: archive_file.h:35