xoreos  0.0.5
herffile.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_HERFFILE_H
26 #define AURORA_HERFFILE_H
27 
28 #include <vector>
29 #include <map>
30 
31 #include "src/common/types.h"
32 #include "src/common/scopedptr.h"
33 #include "src/common/ustring.h"
34 
35 #include "src/aurora/types.h"
36 #include "src/aurora/archive.h"
37 
38 namespace Common {
39  class SeekableReadStream;
40 }
41 
42 namespace Aurora {
43 
53 class HERFFile : public Archive {
54 public:
57  ~HERFFile();
58 
60  const ResourceList &getResources() const;
61 
63  uint32 getResourceSize(uint32 index) const;
64 
66  Common::SeekableReadStream *getResource(uint32 index, bool tryNoCopy = false) const;
67 
70 
71 private:
73  struct IResource {
76  };
77 
78  typedef std::vector<IResource> IResourceList;
79 
81 
84 
87 
90 
91  void load(Common::SeekableReadStream &herf);
93  void readDictionary(Common::SeekableReadStream &herf, std::map<uint32, Common::UString> &dict);
95 
96  void readNames();
97 
98  const IResource &getIResource(uint32 index) const;
99 };
100 
101 } // End of namespace Aurora
102 
103 #endif // AURORA_HERFFILE_H
uint32 _dictOffset
The offset of the dict file (if available).
Definition: herffile.h:88
Common::HashAlgo getNameHashAlgo() const
Return with which algorithm the name is hashed.
Definition: herffile.cpp:170
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource&#39;s contents.
Definition: herffile.cpp:159
uint32 getResourceSize(uint32 index) const
Return the size of a resource.
Definition: herffile.cpp:155
Definition: 2dafile.h:39
Internal resource information.
Definition: herffile.h:73
Class to hold resource data of an HERF archive file.
Definition: herffile.h:53
Handling various archive files.
A simple scoped smart pointer template.
const IResource & getIResource(uint32 index) const
Definition: herffile.cpp:148
Common::ScopedPtr< Common::SeekableReadStream > _herf
Definition: herffile.h:80
void readDictionary(Common::SeekableReadStream &herf, std::map< uint32, Common::UString > &dict)
Definition: herffile.cpp:88
std::list< Resource > ResourceList
Definition: archive.h:57
const ResourceList & getResources() const
Return the list of resources.
Definition: herffile.cpp:144
HashAlgo
The algorithm used for hashing.
Definition: hash.h:37
Low-level type definitions to handle fixed width types portably.
HERFFile(Common::SeekableReadStream *herf)
Take over this stream and read an HERF file out of it.
Definition: herffile.cpp:39
void readResList(Common::SeekableReadStream &herf)
Definition: herffile.cpp:113
ResourceList _resources
External list of resource names and types.
Definition: herffile.h:83
void load(Common::SeekableReadStream &herf)
Definition: herffile.cpp:48
Unicode string handling.
uint32 size
The resource&#39;s size.
Definition: herffile.h:75
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
IResourceList _iResources
Internal list of resource offsets and sizes.
Definition: herffile.h:86
uint32_t uint32
Definition: types.h:204
uint32 offset
The offset of the resource within the HERF.
Definition: herffile.h:74
std::vector< IResource > IResourceList
Definition: herffile.h:78
An abstract file archive.
Definition: archive.h:45
Interface for a seekable & readable data stream.
Definition: readstream.h:265
uint32 _dictSize
The size of the dict file (if available).
Definition: herffile.h:89
void searchDictionary(Common::SeekableReadStream &herf, uint32 resCount)
Definition: herffile.cpp:69