00001 /* -*- Mode: c++ -*- */ 00002 /* 00003 * this is part of Spm 00004 * 00005 * Copyright (c) 2005 Guillaume Chevallereau 00006 * 00007 * This program is free software. You can redistribute it and/or modify it 00008 * under the terms of the GNU General Public License as published by the 00009 * Free Software Foundation. Either version 2 of the license or (at your 00010 * option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be usefull but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00015 * more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 #ifndef __DOWNLOAD_INTERFACE_H__ 00022 #define __DOWNLOAD_INTERFACE_H__ 00023 00024 #include <string> 00025 #include <map> 00026 #include "interface.h" 00027 #include <boost/filesystem/path.hpp> 00028 #include <util/net.h> 00029 00030 namespace Spm 00031 { 00032 namespace Plugin 00033 { 00034 typedef enum{FILE_TYPE, 00035 DIRECTORY_TYPE} element_type; 00040 class DownloadInterface : public Interface 00041 { 00042 protected : 00043 double fractionDone; 00044 Util::urlDetails url; 00045 00046 DownloadInterface () 00047 { 00048 __description.__pluginType = DOWNLOAD_TYPE; 00049 } 00050 00051 DownloadInterface (const Util::urlDetails & u) 00052 { 00053 url = u; 00054 fractionDone = -1; 00055 __description.__pluginType = DOWNLOAD_TYPE; 00056 } 00057 00058 public : 00059 virtual ~DownloadInterface (){}; 00066 virtual void download (const std::string & uri, 00067 const boost::filesystem::path & to) = 0; 00073 virtual bool handle (const std::string & uri) = 0; 00074 00075 double getFractionDone () 00076 { 00077 return fractionDone; 00078 } 00079 }; 00080 } 00081 } 00082 00083 #endif