mirror-chatterino2/src/common/NetworkResult.hpp
Vilgot Fredenberg de04ff82a7
Clean up compiler warnings (#2027)
Fix the following compiler warning
../src/common/NetworkResult.hpp: In constructor ‘chatterino::NetworkResult::NetworkResult(const QByteArray&, int)’:
../src/common/NetworkResult.hpp:28:16: warning: ‘chatterino::NetworkResult::data_’ will be initialized after [-Wreorder]
   28 |     QByteArray data_;
      |                ^~~~~
../src/common/NetworkResult.hpp:27:9: warning:   ‘int chatterino::NetworkResult::status_’ [-Wreorder]
   27 |     int status_;
      |         ^~~~~~~
../src/common/NetworkResult.cpp:9:1: warning:   when initialized here [-Wreorder]
    9 | NetworkResult::NetworkResult(const QByteArray &data, int status)

* Clang compiler warnings

Fixes every instance of the following error:

In file included from ../src/widgets/settingspages/CommandPage.cpp:12:
In file included from ../src/controllers/commands/CommandModel.hpp:5:
../src/common/SignalVectorModel.hpp:242:10: warning: 'moveRows' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
    bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count,
         ^
../src/controllers/commands/CommandModel.hpp:12:29: note: in instantiation of template class 'chatterino::SignalVectorModel<chatterino::Command>' requested here
class CommandModel : public SignalVectorModel<Command>
2020-10-04 12:47:23 +02:00

31 lines
785 B
C++

#pragma once
#include <rapidjson/document.h>
#include <QJsonObject>
namespace chatterino {
class NetworkResult
{
public:
NetworkResult(const QByteArray &data, int status);
/// Parses the result as json and returns the root as an object.
/// Returns empty object if parsing failed.
QJsonObject parseJson() const;
/// 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.
rapidjson::Document parseRapidJson() const;
const QByteArray &getData() const;
int status() const;
static constexpr int timedoutStatus = -2;
private:
QByteArray data_;
int status_;
};
} // namespace chatterino