tv_rename/network.hpp

39 lines
590 B
C++
Raw Normal View History

2019-01-19 12:40:10 +00:00
#ifndef NETWORK_HPP
#define NETWORK_HPP
2019-02-04 16:39:48 +00:00
#ifdef _WIN32
2019-06-07 11:12:59 +00:00
#include <WinInet.h>
#include <Windows.h>
2019-02-04 16:39:48 +00:00
using string = std::wstring;
#else
2019-01-19 12:40:10 +00:00
#include <curl/curl.h>
#include <string>
2019-01-19 12:40:10 +00:00
2019-02-04 16:39:48 +00:00
using string = std::string;
#endif
2019-01-19 12:40:10 +00:00
class Curl {
public:
Curl();
~Curl();
std::string get( const string &url );
std::string post( const std::string &url, const std::string &data );
void addHeader( const std::string &header );
void clearHeader();
2019-02-04 16:39:48 +00:00
2019-01-19 12:40:10 +00:00
private:
2019-02-04 16:39:48 +00:00
#ifdef _WIN32
HINTERNET connect = nullptr;
#else
2019-01-19 12:40:10 +00:00
CURL *curl_handle;
struct curl_slist *chunk = NULL;
2019-02-04 16:39:48 +00:00
#endif
2019-01-19 12:40:10 +00:00
};
#endif