mirror of
https://github.com/Syping/dtranslatebot.git
synced 2026-04-01 13:20:40 +02:00
http_headers: improve memory management
This commit is contained in:
parent
3b7264c547
commit
b35070f788
2 changed files with 55 additions and 2 deletions
|
|
@ -31,11 +31,14 @@ namespace bot {
|
|||
class http_headers {
|
||||
public:
|
||||
http_headers();
|
||||
http_headers(const http_headers &headers);
|
||||
http_headers(const std::string &field, const std::string &value);
|
||||
http_headers(const http_header &header);
|
||||
http_headers(const std::initializer_list<http_header> &headers);
|
||||
http_headers(const std::vector<http_header> &headers);
|
||||
~http_headers();
|
||||
http_headers& operator=(const curl_slist *headers);
|
||||
http_headers& operator=(const http_headers &headers);
|
||||
void add(const std::string &field, const std::string &value);
|
||||
void add(const http_header &header);
|
||||
void add(const std::initializer_list<http_header> &headers);
|
||||
|
|
@ -45,6 +48,7 @@ namespace bot {
|
|||
const curl_slist* data() const;
|
||||
|
||||
private:
|
||||
static curl_slist* copy_from(const curl_slist *headers);
|
||||
curl_slist *instance;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue