duncan
Mom and Dad were wrong!
/home/malcolm/tmp/duncan/prototype/0/dl/downloader.h
00001 #ifndef DL_DOWNLOADER_H_
00002 #define DL_DOWNLOADER_H_
00003 
00004 #include <curlpp/cURLpp.hpp>
00005 #include <curlpp/Easy.hpp>
00006 #include <curlpp/Options.hpp>
00007 #include <curlpp/Multi.hpp>
00008 #include <fstream>
00009 #include <string>
00010 #include "downloadlistener.h"
00011 
00012 namespace dl {
00013 
00022 class Downloader {
00023         private:
00024                 curlpp::Cleanup clean_;
00025                 curlpp::Easy request_;
00026                 curlpp::Multi multi_;
00027                 curlpp::types::ProgressFunctionFunctor prog_func_;
00028                 std::fstream output_;
00029                 bool downloading_;
00030 
00031                 double dlsize_, dlcur_;
00032 
00033                 dl::DownloadListener* listener_;
00034 
00035                 std::string url_;
00036 
00037                 void finish_download();
00038         public:
00039                 Downloader(dl::DownloadListener* l=0);
00040 
00041                 void set_listener(dl::DownloadListener*);
00042 
00043                 void set_url(const std::string&);
00044                 void start_download(const std::string&,const std::string&);
00045                 void abort_download();
00046                 bool downloading();
00047 
00048                 double dlsize();
00049                 double dlcur();
00050 
00051                 bool update();
00052 
00053                 double progress_callback(double,double,double,double);
00054 };
00055 
00056 }
00057 
00058 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations