jigdo API
Last update by Admin on 2010-05-23
job/jigdodownload.hh
Go to the documentation of this file.00001 /* $Id: jigdodownload.hh,v 1.1.1.1 2003/07/04 22:29:52 atterer Exp $ -*- C++ -*- 00002 __ _ 00003 |_) /| Copyright (C) 2003 | richard@ 00004 | \/�| Richard Atterer | atterer.net 00005 � '` � 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License, version 2. See 00008 the file COPYING for details. 00009 00010 */ 00016 #ifndef JIGDODOWNLOAD_HH 00017 #define JIGDODOWNLOAD_HH 00018 00019 #include <config.h> 00020 00021 #include <makeimagedl.hh> 00022 //______________________________________________________________________ 00023 00024 // PRIVATE stuff, internal to MakeImageDl 00025 00035 class Job::MakeImageDl::JigdoDownload 00036 : SingleUrl, // This object is a special kind of SingleUrl 00037 DataSource::IO, 00038 Gunzip::IO { 00039 public: 00044 JigdoDownload(MakeImageDl* m, JigdoDownload* p, const string& jigdoUrl, 00045 ConfigFile::iterator destPos); 00046 virtual ~JigdoDownload(); 00047 00048 void run(); 00049 00051 virtual IOPtr<DataSource::IO>& io(); 00052 virtual const IOPtr<DataSource::IO>& io() const; 00053 00054 private: 00058 virtual void job_deleted(); 00059 virtual void job_succeeded(); 00060 virtual void job_failed(string* message); 00061 virtual void job_message(string* message); 00062 virtual void dataSource_dataSize(uint64 n); 00063 virtual void dataSource_data(const byte* data, unsigned size, 00064 uint64 currentSize); 00066 00067 // Virtual methods from Gunzip::IO 00068 virtual void gunzip_deleted(); 00069 virtual void gunzip_data(Gunzip*, byte* decompressed, unsigned size); 00070 virtual void gunzip_needOut(Gunzip*); 00071 virtual void gunzip_failed(string* message); 00072 00073 // Convenience helper function 00074 inline ConfigFile& configFile() const; 00075 00076 MakeImageDl* master; // Ptr to the MakeImageDl which owns us 00077 JigdoDownload* parent; // Ptr to the download which [Include]d us, or null 00078 // IO for this SingleUrl, given by master. Points to e.g. a GtkSingleUrl 00079 IOPtr<Job::DataSource::IO> ioVal; 00080 00081 /* Transparent gunzipping of .jigdo file. GUNZIP_BUF_SIZE is also the max 00082 size a single line in the .jigdo is allowed to have */ 00083 static const unsigned GUNZIP_BUF_SIZE = 16384; 00084 byte gunzipBuf[GUNZIP_BUF_SIZE]; 00085 Gunzip gunzip; 00086 00087 // Where to put .jigdo data. Points somewhere inside configFile() 00088 ConfigFile::iterator insertPos; 00089 }; 00090 00091 ConfigFile& Job::MakeImageDl::JigdoDownload::configFile() const { 00092 return master->mi.configFile(); 00093 } 00094 00095 #endif
Generated on Tue Sep 23 14:27:41 2008 for jigdo by
