HttpGetの実装に向けてHttpBaseの実装

This commit is contained in:
keita
2021-03-10 22:34:20 +09:00
parent ccdb26b18d
commit 00a568c016
3 changed files with 34 additions and 13 deletions
+25
View File
@@ -0,0 +1,25 @@
#ifndef COCOATWEET_API_INTERFACE_HTTPBASE_H_
#define COCOATWEET_API_INTERFACE_HTTPBASE_H_
#include <functional>
#include "cocoatweet/oauth/oauth.h"
namespace CocoaTweet::API::Interface {
class HttpBase {
public:
protected:
std::weak_ptr<CocoaTweet::OAuth::OAuth1> oauth_;
std::map<std::string, std::string> bodyParam_;
std::string url_;
std::string contentType_;
virtual void process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
std::function<void(const unsigned int, const std::string&)> _callback) = 0;
static size_t curlCallback_(char* _ptr, size_t _size, size_t _nmemb, std::string* _stream){
int realsize = _size * _nmemb;
_stream->append(_ptr, realsize);
return realsize;
}
};
} // namespace CocoaTweet::API::Interface
#endif