2018-07-07 13:08:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
2020-12-26 12:42:39 +01:00
|
|
|
#include <QJsonArray>
|
2018-07-07 13:08:57 +02:00
|
|
|
#include <QJsonObject>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <rapidjson/document.h>
|
2018-07-07 13:08:57 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class NetworkResult
|
|
|
|
{
|
|
|
|
public:
|
2019-09-19 19:03:50 +02:00
|
|
|
NetworkResult(const QByteArray &data, int status);
|
2018-07-07 13:08:57 +02:00
|
|
|
|
2019-09-03 23:32:22 +02:00
|
|
|
/// Parses the result as json and returns the root as an object.
|
|
|
|
/// Returns empty object if parsing failed.
|
2018-07-07 13:08:57 +02:00
|
|
|
QJsonObject parseJson() const;
|
2019-09-03 23:32:22 +02:00
|
|
|
/// Parses the result as json and returns the root as an array.
|
|
|
|
/// Returns empty object if parsing failed.
|
|
|
|
QJsonArray parseJsonArray() const;
|
|
|
|
/// Parses the result as json and returns the document.
|
2018-07-07 13:08:57 +02:00
|
|
|
rapidjson::Document parseRapidJson() const;
|
2018-08-02 14:23:27 +02:00
|
|
|
const QByteArray &getData() const;
|
2019-09-19 19:03:50 +02:00
|
|
|
int status() const;
|
|
|
|
|
|
|
|
static constexpr int timedoutStatus = -2;
|
2018-08-02 14:23:27 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QByteArray data_;
|
2020-10-04 12:47:23 +02:00
|
|
|
int status_;
|
2018-07-07 13:08:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|