root/src/curlresult.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef CURLRESULT_H
#define CURLRESULT_H

#include <curl/curl.h>
#include <sstream>
#include <QList>

class CurlResult {
public:
    CurlResult(void* userData = NULL);
    virtual ~CurlResult();
    std::stringstream data;
    void* userData;
    CURLcode curlError;

    static CURL* defaultClient();
    CURL* curlClient(QString url);
    void print();

    static size_t write_data(void *buffer, size_t characterSize, size_t bufferSize, void *userp);

    // This is fucking stupid and it makes no sense to
    // tack memory management onto the userdata, but whatever fuck the world
    QList<struct curl_slist*> slists; // memory management purposes
};

#endif // CURLRESULT_H