xref: /haiku/headers/private/notification/AppUsage.h (revision 71452e98334eaac603bf542d159e24788a46bebb)
1 /*
2  * Copyright 2010, Haiku, Inc. All Rights Reserved.
3  * Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
4  * Copyright 2004-2008, Michael Davidson. All Rights Reserved.
5  * Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
6  * Distributed under the terms of the MIT License.
7  */
8 #ifndef _APP_USAGE_H
9 #define _APP_USAGE_H
10 
11 #include <map>
12 
13 #include <Entry.h>
14 #include <Flattenable.h>
15 #include <Notification.h>
16 #include <Roster.h>
17 #include <String.h>
18 
19 class BMessage;
20 class NotificationReceived;
21 
22 typedef std::map<BString, NotificationReceived*> notification_t;
23 
24 class AppUsage : public BFlattenable {
25 public:
26 										AppUsage();
27 										AppUsage(const char* name,
28 											bool allow = true);
29 										~AppUsage();
30 
31 	virtual	bool						AllowsTypeCode(type_code code) const;
32 	virtual	status_t					Flatten(void* buffer, ssize_t numBytes) const;
33 	virtual	ssize_t						FlattenedSize() const;
34 	virtual	bool						IsFixedSize() const;
35 	virtual	type_code					TypeCode() const;
36 	virtual	status_t					Unflatten(type_code code, const void* buffer,
37 											ssize_t numBytes);
38 
39 			const char*					Name();
40 			bool						Allowed(const char* title, notification_type type);
41 			bool						Allowed();
42 			NotificationReceived*		NotificationAt(int32 index);
43 			int32						Notifications();
44 			void						AddNotification(NotificationReceived* notification);
45 
46 private:
47 			BString						fName;
48 			bool						fAllow;
49 			notification_t				fNotifications;
50 };
51 
52 #endif	// _APP_USAGE_H
53