xref: /haiku/headers/build/private/storage/mime/MimeUpdateThread.h (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
1 //----------------------------------------------------------------------
2 //  This software is part of the Haiku distribution and is covered
3 //  by the MIT License.
4 //---------------------------------------------------------------------
5 /*!
6 	\file MimeUpdateThread.h
7 	MimeUpdateThread interface declaration
8 */
9 
10 #ifndef _MIME_UPDATE_THREAD_H
11 #define _MIME_UPDATE_THREAD_H
12 
13 #include <Entry.h>
14 #include <Messenger.h>
15 //#include <RegistrarThread.h>
16 #include <SupportDefs.h>
17 
18 #include <list>
19 #include <utility>
20 
21 struct entry_ref;
22 class BMessage;
23 
24 namespace BPrivate {
25 namespace Storage {
26 namespace Mime {
27 
28 class MimeUpdateThread /*: public RegistrarThread*/ {
29 public:
30 	MimeUpdateThread(const char *name, int32 priority,
31 		BMessenger managerMessenger, const entry_ref *root, bool recursive,
32 		int32 force, BMessage *replyee);
33 	virtual ~MimeUpdateThread();
34 
35 	virtual status_t InitCheck();
36 
37 	status_t DoUpdate()	{ return ThreadFunction(); }
38 
39 protected:
40 	virtual status_t ThreadFunction();
41 	virtual status_t DoMimeUpdate(const entry_ref *entry, bool *entryIsDir) = 0;
42 
43 	const entry_ref fRoot;
44 	const bool fRecursive;
45 	const int32 fForce;
46 	BMessage *fReplyee;
47 
48 	bool DeviceSupportsAttributes(dev_t device);
49 
50 private:
51 	std::list< std::pair<dev_t, bool> > fAttributeSupportList;
52 
53 	status_t UpdateEntry(const entry_ref *ref);
54 
55 	status_t fStatus;
56 };
57 
58 }	// namespace Mime
59 }	// namespace Storage
60 }	// namespace BPrivate
61 
62 #endif	// _MIME_UPDATE_THREAD_H
63