xoreos  0.0.5
biffile.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef AURORA_BIFFILE_H
26 #define AURORA_BIFFILE_H
27 
28 #include <vector>
29 
30 #include "src/common/types.h"
31 #include "src/common/scopedptr.h"
32 
33 #include "src/aurora/types.h"
34 #include "src/aurora/keydatafile.h"
35 #include "src/aurora/aurorafile.h"
36 
37 namespace Common {
38  class SeekableReadStream;
39 }
40 
41 namespace Aurora {
42 
43 class KEYFile;
44 
71 class BIFFile : public KEYDataFile, public AuroraFile {
72 public:
75  ~BIFFile();
76 
78  const ResourceList &getResources() const;
79 
81  uint32 getResourceSize(uint32 index) const;
82 
84  Common::SeekableReadStream *getResource(uint32 index, bool tryNoCopy = false) const;
85 
94  void mergeKEY(const KEYFile &key, uint32 dataFileIndex);
95 
96 private:
98  struct IResource {
100 
103  };
104 
105  typedef std::vector<IResource> IResourceList;
106 
108 
111 
114 
115  void load(Common::SeekableReadStream &bif);
117 
118  const IResource &getIResource(uint32 index) const;
119 };
120 
121 } // End of namespace Aurora
122 
123 #endif // AURORA_BIFFILE_H
void load(Common::SeekableReadStream &bif)
Definition: biffile.cpp:54
Definition: 2dafile.h:39
Class to hold resource data information of a BIF file.
Definition: biffile.h:71
IResourceList _iResources
Internal list of resource offsets and sizes.
Definition: biffile.h:113
uint32 size
The resource&#39;s size.
Definition: biffile.h:102
Class to hold resource index information of a KEY file.
Definition: keyfile.h:70
A simple scoped smart pointer template.
void readVarResTable(Common::SeekableReadStream &bif, uint32 offset)
Definition: biffile.cpp:84
void mergeKEY(const KEYFile &key, uint32 dataFileIndex)
Merge information from the KEY into the data file.
Definition: biffile.cpp:99
std::list< Resource > ResourceList
Definition: archive.h:57
Base for BioWare&#39;s Aurora engine files.
Low-level type definitions to handle fixed width types portably.
Internal resource information.
Definition: biffile.h:98
const IResource & getIResource(uint32 index) const
Definition: biffile.cpp:130
uint32 offset
The offset of the resource within the BIF.
Definition: biffile.h:101
const ResourceList & getResources() const
Return the list of resources.
Definition: biffile.cpp:126
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
BIFFile(Common::SeekableReadStream *bif)
Take over this stream and read a BIF file out of it.
Definition: biffile.cpp:45
FileType type
The resource&#39;s type.
Definition: biffile.h:99
An abstract KEY data file (BIF or BZF).
ResourceList _resources
External list of resource names and types.
Definition: biffile.h:110
uint32_t uint32
Definition: types.h:204
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource&#39;s contents.
Definition: biffile.cpp:141
Base class for most files found in games using BioWare&#39;s Aurora engine.
Definition: aurorafile.h:52
FileType
Various file types used by the Aurora engine and found in archives.
Definition: types.h:56
uint32 getResourceSize(uint32 index) const
Return the size of a resource.
Definition: biffile.cpp:137
std::vector< IResource > IResourceList
Definition: biffile.h:105
Interface for a seekable & readable data stream.
Definition: readstream.h:265
Common::ScopedPtr< Common::SeekableReadStream > _bif
Definition: biffile.h:107