xoreos  0.0.5
archive.cpp
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 #include "src/common/system.h"
26 
27 #include "src/aurora/archive.h"
28 
29 namespace Aurora {
30 
31 Archive::Resource::Resource() : hash(0), type(kFileTypeNone), index(0xFFFFFFFF) {
32 }
33 
35 }
36 
38 }
39 
41  return 0xFFFFFFFF;
42 }
43 
45  return Common::kHashNone;
46 }
47 
50  return 0xFFFFFFFF;
51 
52  for (ResourceList::const_iterator r = getResources().begin(); r != getResources().end(); ++r)
53  if (r->hash == hash)
54  return r->index;
55 
56  return 0xFFFFFFFF;
57 }
58 
60  for (ResourceList::const_iterator r = getResources().begin(); r != getResources().end(); ++r)
61  if ((r->type == type) && (r->name == name))
62  return r->index;
63 
64  return 0xFFFFFFFF;
65 }
66 
67 } // End of namespace Aurora
uint32 findResource(uint64 hash) const
Return the index of the resource matching the hash, or 0xFFFFFFFF if not found.
Definition: archive.cpp:48
A class holding an UTF-8 string.
Definition: ustring.h:48
uint64_t uint64
Definition: types.h:206
virtual const ResourceList & getResources() const =0
Return the list of resources.
Handling various archive files.
virtual uint32 getResourceSize(uint32 index) const
Return the size of a resource.
Definition: archive.cpp:40
#define UNUSED(x)
Definition: system.h:170
virtual Common::HashAlgo getNameHashAlgo() const
Return with which algorithm the name is hashed.
Definition: archive.cpp:44
HashAlgo
The algorithm used for hashing.
Definition: hash.h:37
uint32_t uint32
Definition: types.h:204
Low-level detection of architecture/system properties.
FileType
Various file types used by the Aurora engine and found in archives.
Definition: types.h:56
virtual ~Archive()
Definition: archive.cpp:37
No hashing at all.
Definition: hash.h:38