QXmpp  Version: 1.10.4
QXmppStreamError_p.h
1 // SPDX-FileCopyrightText: 2024 Linus Jahn <lnj@kaidan.im>
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 
5 #ifndef QXMPPSTREAMERROR_P_H
6 #define QXMPPSTREAMERROR_P_H
7 
8 #include "QXmppError.h"
9 #include "QXmppStreamError.h"
10 
11 #include <variant>
12 
13 class QDomElement;
14 class QXmlStreamWriter;
15 
16 namespace QXmpp::Private {
17 
18 // implemented in Stream.cpp
19 struct StreamErrorElement {
20  struct SeeOtherHost {
21  QString host;
22  quint16 port;
23 
24  bool operator==(const SeeOtherHost &o) const { return host == o.host && port == o.port; }
25  };
26 
27  using Condition = std::variant<StreamError, SeeOtherHost>;
28 
29  static QString streamErrorToString(StreamError);
30  static std::variant<StreamErrorElement, QXmppError> fromDom(const QDomElement &);
31 
32  Condition condition;
33  QString text;
34 
35  bool operator==(const StreamErrorElement &o) const { return condition == o.condition && text == o.text; }
36 };
37 
38 } // namespace QXmpp::Private
39 
40 #endif // QXMPPSTREAMERROR_P_H
StreamError
Definition: QXmppStreamError.h:15
Definition: Algorithms.h:12