xoreos  0.0.5
version.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 ENGINES_KOTOR_VERSION_H
26 #define ENGINES_KOTOR_VERSION_H
27 
28 #include "src/common/types.h"
29 
30 #include "src/aurora/types.h"
31 
32 namespace Common {
33  class UString;
34 }
35 
36 namespace Engines {
37 
38 namespace KotOR {
39 
40 class Version {
41 public:
42  Version(Aurora::Platform platform);
43  ~Version();
44 
46  bool detect(const Common::UString &directory);
47 
49  bool hasVersion() const;
50 
52 
54 
55  uint16 getVersionMajor() const;
56  uint16 getVersionMinor() const;
57  uint32 getVersionBuild() const;
58 
60 
61  bool isTooOld() const;
62  bool isTooNew() const;
63 
66 
68 
69 private:
71 
75 
76  bool detectWindows(const Common::UString &directory);
77  bool detectMacOSX (const Common::UString &directory);
78  bool detectXbox (const Common::UString &directory);
79 
80  byte *readFile(const Common::UString &directory, const Common::UString &file, size_t &size);
81  byte *readFile(const Common::UString &path, size_t &size);
82 };
83 
84 } // End of namespace KotOR
85 
86 } // End of namespace Engines
87 
88 #endif // ENGINES_KOTOR_VERSION_H
bool isTooNew() const
Is this version newer than the optimum?
Definition: version.cpp:127
uint32 getVersionBuild() const
Return the build number.
Definition: version.cpp:75
Definition: 2dafile.h:39
A class holding an UTF-8 string.
Definition: ustring.h:48
bool detectWindows(const Common::UString &directory)
Definition: version.cpp:153
bool detect(const Common::UString &directory)
Try to detect the version of the KotOR installation in this directory.
Definition: version.cpp:133
bool detectXbox(const Common::UString &directory)
Definition: version.cpp:316
byte * readFile(const Common::UString &directory, const Common::UString &file, size_t &size)
Definition: version.cpp:370
Common::UString getPlatformName() const
Definition: version.cpp:63
bool isTooOld() const
Is this version older than the optimum?
Definition: version.cpp:122
Aurora::Platform _platform
Definition: version.h:70
Aurora::Platform getPlatform() const
Definition: version.cpp:59
bool hasVersion() const
Did we detect a version?
Definition: version.cpp:55
Version(Aurora::Platform platform)
Definition: version.cpp:47
uint16_t uint16
Definition: types.h:202
uint32 _versionBuild
v1.03.514078 -> 514078
Definition: version.h:74
uint16 getOptimumVersionMinor() const
Return the optimum minor version.
Definition: version.cpp:97
Low-level type definitions to handle fixed width types portably.
uint16 getVersionMinor() const
Return the minor version.
Definition: version.cpp:71
bool detectMacOSX(const Common::UString &directory)
Definition: version.cpp:242
uint16 getVersionMajor() const
Return the major version.
Definition: version.cpp:67
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
uint16 _versionMinor
v1.03.514078 -> 3
Definition: version.h:73
Common::UString getOptimumVersionString()
Definition: version.cpp:113
uint32_t uint32
Definition: types.h:204
uint16 _versionMajor
v1.03.514078 -> 1
Definition: version.h:72
Common::UString getVersionString() const
Definition: version.cpp:79
Platform
Definition: types.h:429
uint16 getOptimumVersionMajor() const
Return the optimum major version.
Definition: version.cpp:83
uint8 byte
Definition: types.h:209