xref: /haiku/src/apps/icon-o-matic/import_export/Exporter.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2  * Copyright 2006-2007, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 #ifndef EXPORTER_H
9 #define EXPORTER_H
10 
11 
12 #include <Entry.h>
13 #include <OS.h>
14 
15 class BPositionIO;
16 class Document;
17 
18 namespace BPrivate {
19 namespace Icon {
20 
21 class Icon;
22 
23 }	// namespace Icon
24 }	// namespace BPrivate
25 
26 using namespace BPrivate::Icon;
27 
28 class Exporter {
29  public:
30 								Exporter();
31 	virtual						~Exporter();
32 
33 			status_t			Export(Document* document,
34 									   const entry_ref& ref);
35 
36 	virtual	status_t			Export(const Icon* icon,
37 									   BPositionIO* stream) = 0;
38 
39 	virtual	const char*			MIMEType() = 0;
40 
41 			void				SetSelfDestroy(bool selfDestroy);
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