00001 #ifndef hpp_CPP_UZIDownloadJob_CPP_hpp
00002 #define hpp_CPP_UZIDownloadJob_CPP_hpp
00003
00004
00005 #include "../Cache/CacheEngine.hpp"
00006
00007 #include "HTTPClient.hpp"
00008
00009 #include "UZIBase.hpp"
00010
00011 namespace UZI
00012 {
00015 class DownloadJob : public juce::ThreadPoolJob
00016 {
00017
00018 public:
00020 DownloadJob() : ThreadPoolJob(JUCE_T("Waiting for download")), item(0), communication(0) {}
00024 ~DownloadJob() { if (item) item->Suicide(); item = 0; }
00025
00026
00027 public:
00029 virtual juce::ThreadPoolJob::JobStatus runJob ();
00032 inline bool queueItemToFetch(volatile Cache::Item * _item, juce::String * commTo = 0) { if (isRunning() || item) return false; item = _item; communication = commTo; return true; }
00033
00034
00035 private:
00037 volatile Cache::Item * item;
00039 HTTPClient client;
00041 juce::String * communication;
00042
00043 };
00044 }
00045
00046 #endif