1 /* 2 * Copyright 2006, 2007, 2011, Stephan Aßmus <superstippi@gmx.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef EXPORTER_H 6 #define EXPORTER_H 7 8 9 #include <Entry.h> 10 #include <OS.h> 11 12 #include "IconBuild.h" 13 14 15 class BPositionIO; 16 class Document; 17 18 19 _BEGIN_ICON_NAMESPACE 20 class Icon; 21 _END_ICON_NAMESPACE 22 23 _USING_ICON_NAMESPACE 24 25 26 class Exporter { 27 public: 28 Exporter(); 29 virtual ~Exporter(); 30 31 status_t Export(Document* document, 32 const entry_ref& ref); 33 34 virtual status_t Export(const Icon* icon, 35 BPositionIO* stream) = 0; 36 37 virtual const char* MIMEType() = 0; 38 39 void SetSelfDestroy(bool selfDestroy); 40 41 void WaitForExportThread(); 42 43 private: 44 static int32 _ExportThreadEntry(void* cookie); 45 int32 _ExportThread(); 46 status_t _Export(const Icon* icon, 47 const entry_ref* docRef); 48 49 Document* fDocument; 50 Icon* fClonedIcon; 51 entry_ref fRef; 52 thread_id fExportThread; 53 bool fSelfDestroy; 54 }; 55 56 #endif // EXPORTER_H 57