xoreos  0.0.5
aurorafile.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_AURORAFILE_H
26 #define AURORA_AURORAFILE_H
27 
28 #include "src/common/types.h"
29 
30 namespace Common {
31  class ReadStream;
32 }
33 
34 namespace Aurora {
35 
52 class AuroraFile {
53 public:
54  AuroraFile();
55 
56  void clear();
57 
59  uint32 getID() const;
60 
62  uint32 getVersion() const;
63 
65  bool isUTF16LE() const;
66 
67  // .--- Static base header readers
69  static void readHeader(Common::ReadStream &stream, uint32 &id, uint32 &version, bool &utf16le);
71  static void readHeader(Common::ReadStream &stream, uint32 &id, uint32 &version);
73  static uint32 readHeaderID(Common::ReadStream &stream);
74  // '---
75 
76 protected:
79  bool _utf16le;
80 
81  void readHeader(Common::ReadStream &stream);
82 
83  static uint32 convertUTF16LE(uint32 x1, uint32 x2);
84 };
85 
86 } // End of namespace Aurora
87 
88 #endif // AURORA_AURORAFILE_H
Generic interface for a readable data stream.
Definition: readstream.h:64
Definition: 2dafile.h:39
bool _utf16le
The file&#39;s ID and version are in little-endian UTF-16.
Definition: aurorafile.h:79
uint32 getVersion() const
Return the file&#39;s version.
Definition: aurorafile.cpp:45
static void readHeader(Common::ReadStream &stream, uint32 &id, uint32 &version, bool &utf16le)
Read the header out of a stream.
Definition: aurorafile.cpp:53
Low-level type definitions to handle fixed width types portably.
uint32 _id
The file&#39;s ID.
Definition: aurorafile.h:77
uint32 _version
The file&#39;s version.
Definition: aurorafile.h:78
static uint32 convertUTF16LE(uint32 x1, uint32 x2)
Definition: aurorafile.cpp:88
uint32_t uint32
Definition: types.h:204
Base class for most files found in games using BioWare&#39;s Aurora engine.
Definition: aurorafile.h:52
static uint32 readHeaderID(Common::ReadStream &stream)
Read the ID out of a stream.
Definition: aurorafile.cpp:77
bool isUTF16LE() const
Were the ID and version encoded in little-endian UTF-16 in the file?
Definition: aurorafile.cpp:49
uint32 getID() const
Return the file&#39;s ID.
Definition: aurorafile.cpp:41