grive2/libgrive/src/http/Agent.hh

95 lines
2.2 KiB
C++
Raw Normal View History

2012-04-25 20:13:17 +04:00
/*
grive: an GPL program to sync a local directory with Google Drive
Copyright (C) 2012 Wan Wai Ho
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 2
of the License.
2012-04-25 20:13:17 +04:00
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
#include <string>
#include "ResponseLog.hh"
#include "util/Types.hh"
#include "util/ProgressBar.hh"
2012-04-25 20:13:17 +04:00
2012-07-16 21:58:16 +04:00
namespace gr {
class SeekStream ;
2013-04-28 14:40:21 +04:00
class File ;
2012-07-16 21:58:16 +04:00
namespace http {
2012-05-05 18:39:18 +04:00
2012-06-10 19:11:32 +04:00
class Header ;
2012-05-05 21:12:44 +04:00
2012-05-05 18:39:18 +04:00
class Agent
{
protected:
unsigned mMaxUpload, mMaxDownload ;
2012-05-05 18:39:18 +04:00
public :
Agent() ;
2013-04-28 14:40:21 +04:00
virtual ~Agent() {}
virtual ResponseLog* GetLog() const = 0 ;
virtual void SetLog( ResponseLog* ) = 0 ;
2012-06-10 19:11:32 +04:00
virtual long Put(
const std::string& url,
const std::string& data,
DataStream *dest,
const Header& hdr ) ;
2012-05-05 18:39:18 +04:00
2012-07-16 21:58:16 +04:00
virtual long Put(
const std::string& url,
File *file,
DataStream *dest,
const Header& hdr ) ;
2012-07-16 21:58:16 +04:00
2012-06-10 19:11:32 +04:00
virtual long Get(
const std::string& url,
DataStream *dest,
const Header& hdr,
2016-09-28 12:35:55 +03:00
const long downloadFileBytes = 0 ) ;
2012-06-10 19:11:32 +04:00
virtual long Post(
const std::string& url,
const std::string& data,
DataStream *dest,
const Header& hdr ) ;
virtual long Request(
const std::string& method,
const std::string& url,
SeekStream *in,
DataStream *dest,
const Header& hdr,
2016-09-28 12:35:55 +03:00
const long downloadFileBytes = 0 ) = 0 ;
virtual void SetUploadSpeed( unsigned kbytes ) ;
virtual void SetDownloadSpeed( unsigned kbytes ) ;
virtual std::string LastError() const = 0 ;
virtual std::string LastErrorHeaders() const = 0 ;
2012-06-10 19:11:32 +04:00
virtual std::string RedirLocation() const = 0 ;
2012-05-28 20:31:29 +04:00
2012-06-10 19:11:32 +04:00
virtual std::string Escape( const std::string& str ) = 0 ;
virtual std::string Unescape( const std::string& str ) = 0 ;
virtual void SetProgressBar( ProgressBar* ) = 0;
2012-05-05 18:39:18 +04:00
} ;
2012-05-05 18:39:18 +04:00
} } // end of namespace