cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / src / common / serializers / serializers.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2022 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
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 2 of the License, or     *
8  *   (at your option) version 3.                                           *
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, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20
21 #pragma once
22
23 #include <QDataStream>
24 #include <QHostAddress>
25 #include <QTime>
26 #include <QVariantList>
27 #include <QtEndian>
28
29 #include "bufferinfo.h"
30 #include "identity.h"
31 #include "message.h"
32 #include "network.h"
33 #include "peer.h"
34
35 namespace Serializers {
36 namespace Types {
37 enum class VariantType : quint32
38 {
39     Void = 0,
40     Bool = 1,
41     Int = 2,
42     UInt = 3,
43
44     QChar = 7,
45     QVariantMap = 8,
46     QVariantList = 9,
47     QString = 10,
48     QStringList = 11,
49     QByteArray = 12,
50
51     QDate = 14,
52     QTime = 15,
53     QDateTime = 16,
54
55     Long = 129,
56     Short = 130,
57     Char = 131,
58     ULong = 132,
59     UShort = 133,
60     UChar = 134,
61
62     QVariant = 138,
63
64     UserType = 127
65 };
66
67 enum class QuasselType
68 {
69     Invalid,
70     BufferId,
71     BufferInfo,
72     Identity,
73     IdentityId,
74     Message,
75     MsgId,
76     NetworkId,
77     NetworkInfo,
78     Network_Server,
79     PeerPtr
80 };
81
82 VariantType variantType(QuasselType type);
83 QString toName(QuasselType type);
84 Types::QuasselType fromName(::QByteArray& name);
85 }  // namespace Types
86
87 bool deserialize(QDataStream& stream, const Quassel::Features& features, QVariant& data);
88 bool deserialize(QDataStream& stream, const Quassel::Features& features, QVariantList& list);
89 bool deserialize(QDataStream& stream, const Quassel::Features& features, QVariantMap& data);
90 bool deserialize(QDataStream& stream, const Quassel::Features& features, QVariant& data, Types::VariantType type);
91 bool deserialize(QDataStream& stream, const Quassel::Features& features, QVariant& data, Types::QuasselType type);
92 bool deserialize(QDataStream& stream, const Quassel::Features& features, bool& data);
93 bool deserialize(QDataStream& stream, const Quassel::Features& features, int8_t& data);
94 bool deserialize(QDataStream& stream, const Quassel::Features& features, uint8_t& data);
95 bool deserialize(QDataStream& stream, const Quassel::Features& features, int16_t& data);
96 bool deserialize(QDataStream& stream, const Quassel::Features& features, uint16_t& data);
97 bool deserialize(QDataStream& stream, const Quassel::Features& features, int32_t& data);
98 bool deserialize(QDataStream& stream, const Quassel::Features& features, uint32_t& data);
99 bool deserialize(QDataStream& stream, const Quassel::Features& features, qlonglong& data);
100 bool deserialize(QDataStream& stream, const Quassel::Features& features, qulonglong& data);
101 bool deserialize(QDataStream& stream, const Quassel::Features& features, Types::VariantType& data);
102 bool deserialize(QDataStream& stream, const Quassel::Features& features, QChar& data);
103 bool deserialize(QDataStream& stream, const Quassel::Features& features, QString& data);
104 bool deserialize(QDataStream& stream, const Quassel::Features& features, QTime& data);
105 bool deserialize(QDataStream& stream, const Quassel::Features& features, QDate& data);
106 bool deserialize(QDataStream& stream, const Quassel::Features& features, QDateTime& data);
107 bool deserialize(QDataStream& stream, const Quassel::Features& features, QByteArray& data);
108 bool deserialize(QDataStream& stream, const Quassel::Features& features, QStringList& data);
109 bool deserialize(QDataStream& stream, const Quassel::Features& features, Message& data);
110 bool deserialize(QDataStream& stream, const Quassel::Features& features, BufferInfo& data);
111 bool deserialize(QDataStream& stream, const Quassel::Features& features, BufferId& data);
112 bool deserialize(QDataStream& stream, const Quassel::Features& features, IdentityId& data);
113 bool deserialize(QDataStream& stream, const Quassel::Features& features, NetworkId& data);
114 bool deserialize(QDataStream& stream, const Quassel::Features& features, MsgId& data);
115 bool deserialize(QDataStream& stream, const Quassel::Features& features, PeerPtr& data);
116 bool deserialize(QDataStream& stream, const Quassel::Features& features, NetworkInfo& data);
117 bool deserialize(QDataStream& stream, const Quassel::Features& features, Identity& data);
118 bool deserialize(QDataStream& stream, const Quassel::Features& features, Network::Server& data);
119 }  // namespace Serializers