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 <SupportDefs.h>
15
16#include <list>
17#include <utility>
18
19#include "RegistrarThread.h"
20
21struct entry_ref;
22class BMessage;
23
24namespace BPrivate {
25namespace Storage {
26namespace Mime {
27
28class Database;
29
30class MimeUpdateThread : public RegistrarThread {
31public:
32	MimeUpdateThread(const char *name, int32 priority, Database *database,
33		BMessenger managerMessenger, const entry_ref *root, bool recursive,
34		int32 force, BMessage *replyee);
35	virtual ~MimeUpdateThread();
36
37	virtual status_t InitCheck();
38
39protected:
40	virtual status_t ThreadFunction();
41	virtual status_t DoMimeUpdate(const entry_ref *entry, bool *entryIsDir) = 0;
42
43	Database* fDatabase;
44	const entry_ref fRoot;
45	const bool fRecursive;
46	const int32 fForce;
47	BMessage *fReplyee;
48
49	bool DeviceSupportsAttributes(dev_t device);
50
51private:
52	std::list< std::pair<dev_t, bool> > fAttributeSupportList;
53
54	status_t UpdateEntry(const entry_ref *ref);
55
56	status_t fStatus;
57};
58
59}	// namespace Mime
60}	// namespace Storage
61}	// namespace BPrivate
62
63#endif	// _MIME_UPDATE_THREAD_H
64