1 #ifndef _CONTENT_DOWNLOADER_H_ 2 #define _CONTENT_DOWNLOADER_H_ 3 4 #include "boost/thread/thread.hpp" 5 #include "base.h" 6 #include "SmartPtr.h" 7 #include "Singleton.h" 8 9 #ifndef MAX_PATH 10 #define MAX_PATH 4096 11 #endif 12 13 14 namespace ContentDownloader 15 { 16 17 /** 18 CContentDownloader. 19 Singleton class to handle downloading of sheep. 20 */ 21 class CContentDownloader : public Base::CSingleton<CContentDownloader> 22 { 23 friend class Base::CSingleton<CContentDownloader>; 24 25 // Private constructor accessible only to CSingleton. 26 CContentDownloader(); 27 28 // No copy constructor or assignment operator. 29 NO_CLASS_STANDARDS( CContentDownloader ); 30 31 // Downloader. 32 class SheepDownloader *m_gDownloader; 33 boost::thread *m_gDownloadThread; 34 35 public: 36 bool Startup( const bool _bPreview, bool _bReadOnlyInstance = false ); 37 bool Shutdown( void ); 38 Description()39 const char *Description() { return "Content Downloader"; }; 40 41 std::string ServerMessages(); 42 43 // Called if network said unauthorized, will fallback everything to unregistered server. 44 void ServerFallback(); 45 46 virtual ~CContentDownloader(); 47 }; 48 49 }; 50 51 /* 52 Helper for less typing... 53 54 */ g_ContentDownloader(void)55inline ContentDownloader::CContentDownloader &g_ContentDownloader( void ) { return( ContentDownloader::CContentDownloader::Instance() ); } 56 57 #endif 58