commonlib/types.h

changeset 46
07578e081ae8
parent 44
d0bf58f3560f
child 48
e121ea9dba93
equal deleted inserted replaced
45:f5b526a3423a 46:07578e081ae8
1 /*
2 * ZCinema: Zandronum demo launcher
3 * Copyright (C) 2013-2015 Teemu Piippo
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #pragma once
20 #include <QString>
21 #include <QList>
22 #include <QVariant>
23
24 template<class T> using list = QList<T>;
25 template<class T> using initlist = std::initializer_list<T>;
26 using std::size_t;
27
28 typedef qint8 int8;
29 typedef qint16 int16;
30 typedef qint32 int32;
31 typedef qint64 int64;
32 typedef quint8 uint8;
33 typedef quint16 uint16;
34 typedef quint32 uint32;
35 typedef quint64 uint64;
36
37 struct ZandronumVersion
38 {
39 ZandronumVersion (QString name, bool isRelease, QString binaryPath) :
40 name (name),
41 binaryPath (binaryPath),
42 isRelease (isRelease) {}
43
44 ZandronumVersion() :
45 isRelease (false) {}
46
47 QString name;
48 QString binaryPath;
49 bool isRelease;
50 };
51
52 inline QDataStream& operator<< (QDataStream& out, const ZandronumVersion& version)
53 {
54 return (out << version.name << version.binaryPath << version.isRelease);
55 }
56
57 inline QDataStream& operator>> (QDataStream& in, ZandronumVersion& version)
58 {
59 return (in >> version.name >> version.binaryPath >> version.isRelease);
60 }
61
62 Q_DECLARE_METATYPE (ZandronumVersion)

mercurial