add loguploadcallback for writing curl callback

This commit is contained in:
doitux
2012-11-01 15:20:24 +01:00
parent 7b1abab3a3
commit c01dc0d821
2 changed files with 56 additions and 0 deletions
@@ -0,0 +1,36 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#include "loguploadcallback.h"
LogUploadCallback::LogUploadCallback()
{
}
size_t
LogUploadCallback::writeCallback(char* buf, size_t size, size_t nmemb, void* up)
{
data = "";
for (int c = 0; c<size*nmemb; c++)
{
data.push_back(buf[c]);
}
return size*nmemb;
}
@@ -0,0 +1,20 @@
#ifndef LOGUPLOADCALLBACK_H
#define LOGUPLOADCALLBACK_H
#include <iostream>
class LogUploadCallback
{
public:
LogUploadCallback();
size_t writeCallback(char* buf, size_t size, size_t nmemb, void* up);
std::string getData() { return data; }
private:
std::string data;
};
#endif // LOGUPLOADCALLBACK_H