MimeUpdateThread.h revision b6f76ebe
1//----------------------------------------------------------------------
2//  This software is part of the OpenBeOS 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
21struct entry_ref;
22class BMessage;
23
24namespace BPrivate {
25namespace Storage {
26namespace Mime {
27
28class MimeUpdateThread /*: public RegistrarThread*/ {
29public:
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
39protected:
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
50private:
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