xref: /haiku/headers/private/storage/mime/SupportingApps.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 SupportingApps.h
7 	SupportingApps class declarations
8 */
9 
10 #ifndef _MIME_SUPPORTING_APPS_H
11 #define _MIME_SUPPORTING_APPS_H
12 
13 #include <SupportDefs.h>
14 
15 #include <map>
16 #include <set>
17 #include <string>
18 
19 class BMessage;
20 
21 namespace BPrivate {
22 namespace Storage {
23 namespace Mime {
24 
25 
26 class DatabaseLocation;
27 
28 
29 class SupportingApps {
30 public:
31 	SupportingApps(DatabaseLocation* databaseLocation);
32 	~SupportingApps();
33 
34 	status_t GetSupportingApps(const char *type, BMessage *apps);
35 
36 	status_t SetSupportedTypes(const char *app, const BMessage *types, bool fullSync);
37 	status_t DeleteSupportedTypes(const char *app, bool fullSync);
38 private:
39 	status_t AddSupportingApp(const char *type, const char *app);
40 	status_t RemoveSupportingApp(const char *type, const char *app);
41 
42 	status_t BuildSupportingAppsTable();
43 
44 	std::map<std::string, std::set<std::string> > fSupportedTypes;	// app sig => set of supported types
45 	std::map<std::string, std::set<std::string> > fSupportingApps;	// mime type => set of supporting apps
46 	std::map<std::string, std::set<std::string> > fStrandedTypes;	// app sig => set of no longer supported types for whom the
47 																	//            given app is still listed as a supporting app
48 
49 private:
50 	DatabaseLocation* fDatabaseLocation;
51 	bool fHaveDoneFullBuild;
52 };
53 
54 } // namespace Mime
55 } // namespace Storage
56 } // namespace BPrivate
57 
58 #endif	// _MIME_SUPPORTING_APPS_H
59