xref: /haiku/headers/private/app/MessagePrivate.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 //------------------------------------------------------------------------------
2 //	MessagePrivate.h
3 //
4 //------------------------------------------------------------------------------
5 
6 #ifndef MESSAGEPRIVATE_H
7 #define MESSAGEPRIVATE_H
8 
9 // Standard Includes -----------------------------------------------------------
10 
11 // System Includes -------------------------------------------------------------
12 #include <Message.h>
13 #include <Messenger.h>
14 #include <MessengerPrivate.h>
15 
16 // Project Includes ------------------------------------------------------------
17 
18 // Local Includes --------------------------------------------------------------
19 
20 // Local Defines ---------------------------------------------------------------
21 
22 // Globals ---------------------------------------------------------------------
23 
24 extern "C" void		_msg_cache_cleanup_();
25 extern "C" int		_init_message_();
26 extern "C" int		_delete_message_();
27 
28 class BMessage::Private
29 {
30 	public:
31 		Private(BMessage* msg) : fMessage(msg) {;}
32 		Private(BMessage& msg) : fMessage(&msg) {;}
33 
34 		inline void SetTarget(int32 token, bool preferred)
35 		{
36 			fMessage->fTarget = token;
37 			fMessage->fPreferred = preferred;
38 		}
39 		inline void SetReply(BMessenger messenger)
40 		{
41 			BMessenger::Private mp(messenger);
42 			fMessage->fReplyTo.port = mp.Port();
43 			fMessage->fReplyTo.target = mp.Token();
44 			fMessage->fReplyTo.team = mp.Team();
45 			fMessage->fReplyTo.preferred = mp.IsPreferredTarget();
46 		}
47 		inline int32 GetTarget()
48 		{
49 			return fMessage->fTarget;
50 		}
51 		inline bool UsePreferredTarget()
52 		{
53 			return fMessage->fPreferred;
54 		}
55 
56 	private:
57 		BMessage*	fMessage;
58 };
59 
60 #endif	// MESSAGEPRIVATE_H
61 
62 /*
63  * $Log $
64  *
65  * $Id  $
66  *
67  */
68 
69