LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
networkresult.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <variant>
12#include <QNetworkReply>
13#include "../threadsconfig.h"
14
15namespace LC::Util
16{
18 {
19 QNetworkReply::NetworkError Error_;
22 };
23
25
32
33 using NRBase_t = std::variant<NetworkReplyError, NetworkReplySuccess>;
34
35 class UTIL_THREADS_API NetworkReplyErrorException : public std::runtime_error
36 {
37 NetworkReplyError Error_;
38 public:
40
41 const NetworkReplyError& GetError () const;
42 };
43
45
46 template<typename, typename>
47 class Either;
48
50 {
51 public:
52 using NRBase_t::variant;
53
54 std::optional<NetworkReplyError> IsError () const;
55 QByteArray GetReplyData () const;
56
57 Either<QString, QByteArray> ToEither (const QString& errorContext) const;
58 };
59
61}
Container< T > Filter(const Container< T > &c, F f)
Definition prelude.h:118
QDebug operator<<(QDebug dbg, const CtString< N, Char > &str)
std::variant< NetworkReplyError, NetworkReplySuccess > NRBase_t
QNetworkReply::NetworkError Error_
#define UTIL_THREADS_API