Mercurial > minori
diff include/core/http.h @ 369:47c9f8502269
*: clang-format all the things
I've edited the formatting a bit. Now pointer asterisks (and reference
ampersands) are on the variable instead of the type, as well as having
newlines for function braces (but nothing else)
author | Paper <paper@tflc.us> |
---|---|
date | Fri, 25 Jul 2025 10:16:02 -0400 |
parents | b1f4d1867ab1 |
children |
line wrap: on
line diff
--- a/include/core/http.h Fri Jul 25 10:05:23 2025 -0400 +++ b/include/core/http.h Fri Jul 25 10:16:02 2025 -0400 @@ -4,47 +4,48 @@ #include <QByteArray> #include <QThread> +#include <mutex> #include <string> #include <vector> -#include <mutex> namespace HTTP { /* calls libcurl to encode/decode */ -std::string UrlEncode(const std::string& data); -std::string UrlDecode(const std::string& data); +std::string UrlEncode(const std::string &data); +std::string UrlDecode(const std::string &data); -std::string EncodeParamsList(std::string base, const std::map<std::string, std::string>& params); +std::string EncodeParamsList(std::string base, const std::map<std::string, std::string> ¶ms); enum class Type { Get, Post }; -QByteArray Request(const std::string& url, const std::vector<std::string>& headers = {}, const std::string& data = "", Type type = Type::Get); +QByteArray Request(const std::string &url, const std::vector<std::string> &headers = {}, const std::string &data = "", + Type type = Type::Get); class RequestThread final : public QThread { Q_OBJECT public: - RequestThread(Type type = Type::Get, QObject* parent = nullptr); - RequestThread(const std::string& url, const std::vector<std::string>& headers = {}, - const std::string& data = "", Type type = Type::Get, QObject* parent = nullptr); + RequestThread(Type type = Type::Get, QObject *parent = nullptr); + RequestThread(const std::string &url, const std::vector<std::string> &headers = {}, const std::string &data = "", + Type type = Type::Get, QObject *parent = nullptr); ~RequestThread(); - void SetUrl(const std::string& url); - void SetHeaders(const std::vector<std::string>& headers); - void SetData(const std::string& data); + void SetUrl(const std::string &url); + void SetHeaders(const std::vector<std::string> &headers); + void SetData(const std::string &data); void SetType(Type type); void Stop(); signals: - void ReceivedData(const QByteArray& ba); + void ReceivedData(const QByteArray &ba); protected: void run() override; - static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userdata); + static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userdata); std::string url_; std::string data_;