xref: /haiku/docs/user/app/Message.dox (revision e6b30aee0fd7a23d6a6baab9f3718945a0cd838a)
1/*
2 * Copyright 2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 * 		Niels Sascha Reedijk, niels.reedijk@gmail.com
7 *
8 * Corresponds to:
9 *		/trunk/headers/os/app/Message.h  rev 21562
10 *		/trunk/src/kits/app/Message.cpp  rev 22240
11 */
12
13
14/*!
15	\file Message.h
16	\brief Provides the BMessage class.
17*/
18
19///// Name lengths and Scripting specifiers /////
20
21/*!
22	\def B_FIELD_NAME_LENGTH
23	\brief Undocumented...
24*/
25
26
27/*!
28	\def B_PROPERTY_NAME_LENGTH
29	\brief Undocumented...
30*/
31
32
33/*!
34	\var B_NO_SPECIFIER
35	\brief Undocumented...
36*/
37
38
39/*!
40	\var B_DIRECT_SPECIFIER
41	\brief Undocumented...
42*/
43
44
45/*!
46	\var B_INDEX_SPECIFIER
47	\brief Undocumented...
48*/
49
50
51/*!
52	\var B_REVERSE_INDEX_SPECIFIER,
53	\brief Undocumented...
54*/
55
56
57/*!
58	\var B_RANGE_SPECIFIER
59	\brief Undocumented...
60*/
61
62
63/*!
64	\var B_REVERSE_RANGE_SPECIFIER
65	\brief Undocumented...
66*/
67
68
69/*!
70	\var B_NAME_SPECIFIER
71	\brief Undocumented...
72*/
73
74
75/*!
76	\var B_ID_SPECIFIER
77	\brief Undocumented...
78*/
79
80
81/*!
82	\var B_SPECIFIERS_END
83	\brief Undocumented...
84*/
85
86
87///// Class BMessage /////
88
89
90/*!
91	\class BMessage
92	\ingroup app
93	\brief A container that can be send and received using the Haiku messaging
94		subsystem.
95
96	This class is at the center of the web of messaging classes, in the sense
97	that it defines the actual structure of the messages. Messages have two
98	<b>important elements</b>: the #what identifer, and the data members. The
99	first can be directly manipulated, the latter can be manipulated through
100	AddData(), FindData() and ReplaceData() and their deratives. Neither of
101	these elements are mandatory.
102
103	The second important role of BMessage is that it stores <b>meta data</b>:
104	who sent the message and with what intention? The methods of BMessage will
105	disclose if the message was a reply (IsReply()), where it came from
106	(IsSourceRemote()), whether a reply is expected (IsSourceWaiting()), and in
107	case the message is a reply, what it's a reply to (Previous()).
108
109	Mostly, messages are used to pass information between the the objects in
110	your application, but because messages are such flexible data containers,
111	they are also often used for other <b>data storage purposes</b>. Many
112	applications store their settings as messages. Because messages can be
113	flattened to data streams (such as files), they provide an easy but
114	powerful tool for data storage.
115
116	All methods can be classified in these areas:
117	- Adding, Finding, Replacing and Removing Data.
118	- Statistics and Miscelanous information.
119	- Delivery information.
120	- Utilities to reply to messages.
121
122	To see how messages fit in with the greater picture, have a look at the
123	\ref app_messaging "Messaging Introduction".
124*/
125
126
127/*!
128	\var BMessage::what
129	\brief A 4-byte constant that determines the type of message.
130
131	You can directly manipulate this data member.
132*/
133
134
135/*!
136	\fn BMessage::BMessage()
137	\brief Construct an empty message, without any data members and with a
138		\c what constant set to zero (0).
139
140	\see BMessage(uint32 what)
141	\see BMessage(const BMessage &other)
142*/
143
144
145/*!
146	\fn BMessage::BMessage(uint32 what)
147	\brief Construct an empty message with the \c what member set tot the
148		specified value.
149
150	\see BMessage::BMessage()
151	\see BMessage::BMessage(const BMessage &other)
152*/
153
154
155/*!
156	\fn BMessage::BMessage(const BMessage &other)
157	\brief Construct a new message that is a copy of another message.
158
159	The \c what member and the data values are copied. The metadata, such as
160	whether or not the message is a drop message or reply information, is
161	not copied. So if the original message is a reply to a previous message,
162	which will make IsReply() return \c true, calling the same method on a copy
163	of the message will return \c false.
164
165	\remarks BeOS R5 did keep the metadata of the message. Haiku deviates from
166	this behaviour. Please use the Haiku implementation of message copying as
167	the default behavior. This will keep your applications backwards
168	compatible.
169
170	\see BMessage::BMessage()
171	\see BMessage(uint32 what)
172*/
173
174
175/*!
176	\fn BMessage::~BMessage()
177	\brief Free the data members associated with the message.
178
179	If there still is a sender waiting for a reply, the \c B_NO_REPLY message
180	will be sent to inform them that there won't be a reply.
181*/
182
183
184/*!
185	\fn BMessage &BMessage::operator=(const BMessage &other)
186	\brief Copy one message into another.
187
188	See the copy constructor, BMessage(const BMessage &other), for details on what is
189	copied, and what isn't.
190*/
191
192
193/*!
194	\name Statistics and Miscelanous Information
195*/
196
197
198//! @{
199
200
201/*!
202	\fn status_t BMessage::GetInfo(type_code typeRequested, int32 index,
203	 	char **nameFound, type_code *typeFound, int32 *countFound) const
204	\brief Retrieve the name, the type and the number of items in a message by
205		an \a index.
206
207	\param[in] typeRequested If you want to limit the search to only one type,
208	 	pass that type code here. If you don't care which type the data has,
209	 	you can pass \c B_ANY_TYPE.
210	\param[in] index The index of the data you want to investigate.
211	\param[out] nameFound The name of the item if it is found. Haiku will fill
212		in a pointer to the internal name buffer in the message. This means
213		that you should not manipulate this name. If you are not interested in
214		the name, you can safely pass \c NULL.
215	\param[out] typeFound The type of the item at \a index. If you are not
216		interested in the type (because you specifically asked for a type), you
217		can safely pass NULL.
218	\param[out] countFound The number of items at \a index. If data items have
219		the same name, they will be placed under the same index.
220
221	\return If the \a index is found, and matches the requested type, the
222		other parameters will be filled in. If this is not the case, the method
223		will return with an error.
224
225	\retval B_OK An match was found. The values have been filled in.
226	\retval B_BAD_INDEX The \a index was out of range. None of the passed
227		variables have been altered.
228	\retval B_BAD_TYPE The data field at \a index does not have the requested
229		type.
230*/
231
232
233/*!
234	\fn status_t BMessage::GetInfo(const char *name, type_code *typeFound,
235	 	int32 *countFound) const
236	\brief Retrieve the type and the number of data items in this message that
237		are associated with a \a name.
238
239	\param[in] name The name of the data member that you are looking for.
240	\param[out] typeFound In case of a match, the name of the data member will
241		be put in this parameter. In case you are not interested, you can pass
242		\c NULL.
243	\param[out] countFound In case of a match, the number of items at this
244		label will be in this parameter. In case you are not interested, you
245		can safely pass \c NULL.
246
247	\return If the message has data associated with the given \a name, the
248		other parameters will contain information associated with the data.
249		Else, the method will return with an error.
250
251	\retval B_OK A match was found. The other parameters have been filled in.
252	\retval B_BAD_VALUE You passed \c NULL as argument to \a name.
253	\retval B_NAME_NOT_FOUND There is no data with the label \a name.
254*/
255
256
257/*!
258	\fn status_t BMessage::GetInfo(const char *name, type_code *typeFound,
259	 	bool *fixedSize) const
260	\brief Retrieve the type and whether or not the size of the data is fixed
261		associated with a \a name.
262
263	This method is the same as GetInfo(const char *,type_code *, int32 *) const , with the difference that you can find out whether or
264	not the size of the data associated with the \a name is fixed. You will
265	get this value in the variable you passed as \a fixedSize parameter.
266*/
267
268
269/*!
270	\fn int32 BMessage::CountNames(type_code type) const
271	\brief Count the number of names of a certain \a type.
272
273	This method can be used to count the number of items of a certain type.
274	It's practical use is limited to debugging purposes.
275
276	\param type The type you want to find. If you pass \c B_ANY_TYPE, this
277		method will return the total number of data items.
278
279	\return The number of data items in this message with the specified
280		\a type, or zero in case no items match the type.
281*/
282
283
284/*!
285	\fn bool BMessage::IsEmpty() const
286	\brief Check if the message has data members.
287
288	\return If this message contains data members, this method will return
289		\c true, else it will return \c false.
290	\see MakeEmpty()
291*/
292
293
294/*!
295	\fn bool BMessage::IsSystem() const
296	\brief Check if the message is a system message.
297
298	\return If this message is a system message, the method will return
299		\c true.
300*/
301
302
303/*!
304	\fn bool BMessage::IsReply() const
305	\brief Check if the message is a reply to a (previous) message.
306
307	\return If this message is a reply, this method will return \c true.
308*/
309
310
311/*!
312	\fn void BMessage::PrintToStream() const
313	\brief Print the message to the standard output.
314
315	This method can be used to debug your application. It can be used to check
316	if it creates the messages properly, by checking if all the required fields
317	are present, and it can be used to debug your message handling routines,
318	especially the handling of those that are sent by external applications, to
319	see if you understand the semantics correctly.
320*/
321
322
323/*!
324	\fn status_t BMessage::Rename(const char *oldEntry, const char *newEntry)
325	\brief Rename a data label.
326
327	\param oldEntry The name of the label you want to rename.
328	\param newEntry The new name of the data entry.
329
330	\retval B_OK Renaming succeeded.
331	\retval B_BAD_VALUE Either the \a oldEntry or the \a newEntry pointers are
332		\c NULL.
333	\retval B_NAME_NOT_FOUND There is no data associated with the label
334		\a oldEntry.
335*/
336
337
338//! @}
339
340/*!
341	\name Delivery Info
342*/
343
344//! @{
345
346
347/*!
348	\fn bool BMessage::WasDelivered() const
349	\brief Check if this message was delivered through the delivery methods.
350
351	If this message is passed via a BMessenger or BLooper::PostMessage(), this
352	method will return \c true.
353
354	\warning This method should not be abused by a thread that sends a message
355		to track whether or not a message was delivered. This is because the
356		ownership of the message goes to the receiving looper, which will
357		delete the message as soon as it is done with it.
358
359	\warning If you need to check whether a message is delivered, you should
360		either ask for a reply, or use one of the synchronous
361		BMessenger::SendMessage() methods.
362*/
363
364
365/*!
366	\fn bool BMessage::IsSourceWaiting() const
367	\brief Check if the sender expects a reply.
368
369	This method will return \c true, if the sender flagged that it is waiting
370	for a reply, and such a reply has not yet been sent.
371*/
372
373
374/*!
375	\fn bool BMessage::IsSourceRemote() const
376	\brief Check if the message is sent by another application.
377*/
378
379
380/*!
381	\fn BMessenger BMessage::ReturnAddress() const
382	\brief Get a messenger that points to the sender of the message.
383
384	Using this method, you can fetch a BMessenger that can be used to deliver
385	replies to this message. This method works both for local and remote
386	deliveries.
387
388	For remote deliveries, this approach is preferred over sending the reply
389	using a standard BMessenger that is created with the signature of the
390	application. A standard BMessenger sends the messages to the main BLooper
391	of the application, the BApplication object. With the delivery data stored
392	in the messages, the reply using this messenger will be directed at a
393	specific looper that is able to handle the replies.
394
395	If this method is called on a message that has not been delivered (yet),
396	it will return an empty BMessenger object.
397*/
398
399
400/*!
401	\fn const BMessage *BMessage::Previous() const
402	\brief Get the message to which this message is a reply.
403
404	\return Returns a new BMessage with the same data stuctures as the message
405		to which this message is a reply. You get the ownership of this
406		message, so free it when you're done. If this message isn't a reply to
407		another message, this method will return \c NULL.
408*/
409
410
411/*!
412	\fn bool BMessage::WasDropped() const
413	\brief Check if the message was delivered through 'drag and drop'.
414
415	\return This method returns \c true if the message has been delivered
416		through drag and drop. It returns \c false if it has been delivered
417		through the regular messaging functions, or if the message has not
418		been delivered at all.
419	\see DropPoint()
420*/
421
422
423/*!
424	\fn BPoint BMessage::DropPoint(BPoint *offset) const
425	\brief Get the coordinates of the drop point of the message.
426
427	If the message has been delivered because of drag and drop, which can be
428	verified with the WasDropped() method, this method will return a BPoint to
429	where exactly the drop off was made.
430
431	Because drop messages are delivered to the BWindow in which they were
432	dropped, and BWindow is a subclass of BLooper, you can use BWindow to
433	determine based on the location, how you should react to it.
434
435	If this message was not delivered through drag and drop, it will return
436	a \c NULL pointer.
437
438	\see WasDropped()
439*/
440
441
442//! @}
443
444
445/*!
446	\name Replying
447*/
448
449
450//! @{
451
452
453/*!
454	\fn status_t BMessage::SendReply(uint32 command, BHandler *replyTo)
455	\brief Asynchronously send a reply to this message.
456
457	This is an overloaded member of SendReply(BMessage *, BMessenger, bigtime_t).
458	Use this variant if you want to send a message without data members.
459*/
460
461
462/*!
463	\fn status_t BMessage::SendReply(BMessage *reply, BHandler *replyTo,
464	 	bigtime_t timeout)
465	\brief Asynchronously send a reply to this message.
466
467	This is an overloaded member of SendReply(BMessage *, BMessenger, bigtime_t).
468	Use this variant if you want to send the message to a specific handler
469	(instead of a complete messenger).
470*/
471
472
473/*!
474	\fn status_t BMessage::SendReply(BMessage *reply, BMessenger replyTo,
475	 	bigtime_t timeout)
476	\brief Asynchronously send a reply to this message.
477
478	This method sends a reply to this message to the sender. On your turn,
479	you specify a messenger that handles a reply back to the message you
480	specify as the \a reply argument. You can set a timeout for the message
481	to be delivered. This method blocks until the message has been received,
482	or the \a timeout has been reached.
483
484	\param reply The message that is in reply to this message.
485	\param replyTo In case the receiver needs to reply to the message you are
486		sending, you can specify the return address with this argument.
487	\param timeout The maximum time in microseconds this delivery may take. The
488		\a timeout is a relative timeout. You can also use
489		\c B_INFINITE_TIMEOUT if you want to wait infinitely for the message
490		to be delivered.
491
492	\retval B_OK The message has been delivered.
493	\retval B_DUPLICATE_REPLY There already has been a reply to this message.
494	\retval B_BAD_PORT_ID The reply address is not valid (anymore).
495	\retval B_WOULD_BLOCK The delivery \a timeout was \c B_INFINITE_TIMEOUT
496		(zero) and the target port was full when trying to deliver the message.
497	\retval B_TIMED_OUT The timeout expired while trying to deliver the
498	  message.
499	\see SendReply(uint32 command, BHandler *replyTo)
500*/
501
502
503/*!
504	\fn status_t BMessage::SendReply(uint32 command, BMessage *replyToReply)
505	\brief Synchronously send a reply to this message, and wait for a reply
506	 	back.
507
508	This is an overloaded member of SendReply(BMessage *, BMessage *,
509	bigtime_t, bigtime_t) Use this variant if you want to send a message
510	without data members.
511*/
512
513
514/*!
515	\fn status_t BMessage::SendReply(BMessage *reply, BMessage *replyToReply,
516		bigtime_t sendTimeout, bigtime_t replyTimeout)
517	\brief 	Synchronously send a reply to this message, and wait for a reply
518		 back.
519
520	This method sends a reply to this message to the sender. The \a reply is
521	delivered, and then the method waits for a reply from the receiver. If a
522	reply is received, that reply is copied into the \a replyToReply argument.
523	If the message was delivered properly, but the receiver did not reply
524	within the specified \a replyTimeout, the \c what member of \a replyToReply
525	will be set to \c B_NO_REPLY.
526
527	\param reply The message that is in reply to this message.
528	\param[out] replyToReply The reply is copied into this argument.
529	\param sendTimeout The maximum time in microseconds this delivery may take.
530	 	The \a timeout is a relative timeout. You can also use
531		\c B_INFINITE_TIMEOUT if you want to wait infinitely for the message
532		to be delivered.
533	\param replyTimeout The maximum time in microseconds you want to wait for a
534		reply. Note that the timer starts when the message has been delivered.
535
536	\retval B_OK The message has been delivered.
537	\retval B_DUPLICATE_REPLY There already has been a reply to this message.
538	\retval B_BAD_VALUE Either \a reply or \a replyToReply is \c NULL.
539	\retval B_BAD_PORT_ID The reply address is not valid (anymore).
540	\retval B_WOULD_BLOCK The delivery \a timeout was \c B_INFINITE_TIMEOUT
541		(zero) and the target port was full when trying to deliver the message.
542	\retval B_TIMED_OUT The timeout expired while trying to deliver the
543	  message.
544	\retval B_NO_MORE_PORTS All reply ports are in use.
545	\see SendReply(uint32 command, BMessage *replyToReply)
546*/
547
548
549//! @}
550
551
552/*!
553	\name Flattening methods
554
555	Because of historical reasons and for binary compatibility, this class
556	provides a flattening API without inheriting the BFlattenable class. The
557	API is more or less the same, but you are inconvenienced when you want to
558	use messages in methods that handle BFlattenable objects.
559*/
560
561
562//! @{
563
564
565/*!
566	\fn ssize_t BMessage::FlattenedSize() const
567	\brief Return the size in bytes required when you want to flatten this
568		message to a stream of bytes.
569*/
570
571
572/*!
573	\fn status_t BMessage::Flatten(char *buffer, ssize_t size) const
574	\brief Flatten the message to a \a buffer.
575
576	\param buffer The buffer to write the data to.
577	\param size The size of the buffer.
578
579	\return \c B_OK in case of success, or an error code in case something went
580		awry.
581
582	\warning Make sure the buffer is large enough to hold the message. This
583	 	method does not double-check for you!
584	\see FlattenedSize()
585	\see Flatten(BDataIO *stream, ssize_t *size) const
586*/
587
588
589/*!
590	\fn status_t BMessage::Flatten(BDataIO *stream, ssize_t *size) const
591	\brief Flatten the message to a \a stream.
592
593	\param[in] stream The stream to flatten the message to.
594	\param[out] size The method writes the number of bytes actually written to
595		this argument.
596	\return \c B_OK in case of success, or an error code in case something went
597		awry.
598
599	\warning Make sure the subclass of the BDataIO interface either protects
600		against buffer overwrites, or check if the number of bytes that is
601		going to be written isn't larger than it can handle.
602	\see FlattenedSize()
603	\see Flatten(char *buffer, ssize_t size) const
604*/
605
606
607/*!
608	\fn status_t BMessage::Unflatten(const char *flatBuffer)
609	\brief Unflatten a message from a buffer and put it into the current
610	 	object.
611
612	This action clears the current contents of the message.
613
614	\param flatBuffer The buffer that contains the message.
615
616	\retval B_OK The buffer has been unflattened.
617	\retval B_BAD_VALUE The buffer does not contain a valid message.
618	\retval B_NO_MEMORY An error occured whilst allocating memory for the data
619		members.
620	\see Flatten(char *buffer, ssize_t size) const
621	\see Unflatten(BDataIO *stream)
622*/
623
624
625/*!
626	\fn status_t BMessage::Unflatten(BDataIO *stream)
627	\brief Unflatten a message from a stream and put it into the current
628	 	object.
629
630	This action clears the current contents of the message.
631
632	\param stream The stream that contains the message.
633
634	\retval B_OK The message has been unflattened.
635	\retval B_BAD_VALUE The stream does not contain a valid message.
636	\retval B_NO_MEMORY An error occured whilst allocating memory for the data
637		members.
638	\see Flatten(BDataIO *stream, ssize_t *size) const
639	\see Unflatten(const char *flatBuffer)
640*/
641
642
643//! @}
644
645/*!
646	\name Specifiers (Scripting)
647*/
648
649//! @{
650
651
652/*!
653	\fn status_t BMessage::AddSpecifier(const char *property)
654	\brief Undocumented.
655*/
656
657
658/*!
659	\fn status_t BMessage::AddSpecifier(const char *property, int32 index)
660	\brief Undocumented.
661*/
662
663
664/*!
665	\fn status_t BMessage::AddSpecifier(const char *property, int32 index,
666	 	int32 range)
667	\brief Undocumented.
668*/
669
670
671/*!
672	\fn status_t BMessage::AddSpecifier(const char *property, const char *name)
673	\brief Undocumented.
674*/
675
676
677/*!
678	\fn status_t BMessage::AddSpecifier(const BMessage *specifier)
679	\brief Undocumented.
680*/
681
682
683/*!
684	\fn status_t BMessage::SetCurrentSpecifier(int32 index)
685	\brief Undocumented.
686*/
687
688
689/*!
690	\fn status_t BMessage::GetCurrentSpecifier(int32 *index,
691	 	BMessage *specifier, int32 *what, const char **property) const
692	\brief Undocumented.
693*/
694
695
696/*!
697	\fn bool BMessage::HasSpecifiers() const
698	\brief Undocumented.
699*/
700
701
702/*!
703	\fn status_t BMessage::PopSpecifier()
704	\brief Undocumented.
705*/
706
707
708//! @}
709
710
711/*!
712	\name Adding Data
713*/
714
715
716//! @{
717
718
719/*!
720	\fn status_t BMessage::AddData(const char *name, type_code type,
721	 	const void *data, ssize_t numBytes, bool isFixedSize, int32 count)
722	\brief Add \a data of a certain \a type to the message.
723
724	The amount of \a numBytes is copied into the message. The data is stored
725	at the label specified in \a name. You are responsible for specifying the
726	correct \a type. The Haiku API already specifies many constants, such as
727	B_FLOAT_TYPE or B_RECT_TYPE. See TypeConstants.h for more information on
728	the system-wide defined types.
729
730	If the field with the \a name already exists, the data is added in an
731	array-like form. If you are adding a certain \a name for the first time,
732	you are able to specify some properties of this array. You can fix the size
733	of each data entry, and you can also instruct BMessage to allocate a
734	\a count of items. The latter does not mean that the number of items is
735	fixed; the array will grow nonetheless. Also, note that every \a name can
736	only be associated with one \a type of data. If consecutive method calls
737	specify a different \a type than the initial, these calls will fail.
738
739	There is no limit to the number of labels, or the amount of data, but
740	note that searching of data members is linear, as well as that some
741	messages will be copied whilst being passed around, so if the amount of
742	data you need to pass is too big, find another way to pass it.
743
744	\param name The label to which this data needs to be associated. If the
745		\a name already exists, the new data will be added in an array-like
746		style.
747	\param type The type of data. If you are adding data to the same \a name,
748		make sure it is the same type.
749	\param data The data buffer to copy the bytes from.
750	\param numBytes The number of bytes to be copied. If this is the first call
751		to this method for this type of data, and you set \a isFixedSize to
752		\c true, this will specify the size of all consecutive calls to this
753		method.
754	\param isFixedSize If this is the first call to this method with this
755		\a name, you can specify the whether or not all items in this array
756		should have the same fixed size.
757	\param count If this is the first call to this method with this
758		\a name, you can instruct this message to allocate a number of items in
759		advance. This does not limit the amount of items though. The array will
760		grow if needed.
761
762	\retval B_OK The \a data is succesfully added.
763	\retval B_BAD_VALUE The \a numBytes is less than, or equal to zero (0), or
764		the size of this item is larger than the \a name allows, since it has
765		been specified to have a fixed size.
766	\retval B_ERROR There was an error whilst creating the label with your
767		\a name.
768	\retval B_BAD_TYPE The \a type you specified is different than the one
769		already associated with \a name.
770*/
771
772
773/*!
774	\fn status_t BMessage::AddRect(const char *name, BRect aRect)
775	\brief Convenience method to add a BRect to the label \a name.
776
777	This method calls AddData() with the \c B_RECT_TYPE \a type.
778
779	\param name The label to associate the data with.
780	\param aRect The rectangle to store in the message.
781	\see AddData() for a more detailed overview of the inner workings.
782	\see FindRect()
783	\see ReplaceRect()
784*/
785
786
787/*!
788	\fn status_t BMessage::AddPoint(const char *name, BPoint aPoint)
789	\brief Convenience method to add a BPoint to the label \a name.
790
791	This method calls AddData() with the \c B_POINT_TYPE \a type.
792
793	\param name The label to associate the data with.
794	\param aPoint The point to store in the message.
795	\see AddData() for a more detailed overview of the inner workings.
796	\see FindPoint()
797	\see ReplacePoint()
798*/
799
800
801/*!
802	\fn status_t BMessage::AddString(const char *name, const char *aString)
803	\brief Convenience method to add a C-string to the label \a name.
804
805	This method calls AddData() with the \c B_STRING_TYPE \a type.
806
807	\param name The label to associate the data with.
808	\param aString The string to copy to the message.
809	\see AddData() for a more detailed overview of the inner workings.
810	\see FindString()
811	\see ReplaceString()
812*/
813
814
815/*!
816	\fn status_t BMessage::AddString(const char *name, const BString &aString)
817	\brief Convenience method to add a BString to the label \a name.
818
819	This method calls AddData() with the \c B_STRING_TYPE \a type.
820
821	\param name The label to associate the data with.
822	\param aString The string to copy to the message.
823	\see AddData() for a more detailed overview of the inner workings.
824	\see FindString()
825	\see ReplaceString()
826*/
827
828
829/*!
830	\fn status_t BMessage::AddInt8(const char *name, int8 value)
831	\brief Convenience method to add an \c int8 to the label \a name.
832
833	This method calls AddData() with the \c B_INT8_TYPE \a type.
834
835	\param name The label to associate the data with.
836	\param value The value to store in the message.
837	\see AddData() for a more detailed overview of the inner workings.
838	\see FindInt8()
839	\see ReplaceInt8()
840*/
841
842
843/*!
844	\fn status_t BMessage::AddInt16(const char *name, int16 value)
845	\brief Convenience method to add an \c int16 to the label \a name.
846
847	This method calls AddData() with the \c B_INT16_TYPE \a type.
848
849	\param name The label to associate the data with.
850	\param value The value to store in the message.
851	\see AddData() for a more detailed overview of the inner workings.
852	\see FindInt16()
853	\see ReplaceInt16()
854*/
855
856
857/*!
858	\fn status_t BMessage::AddInt32(const char *name, int32 value)
859	\brief Convenience method to add an \c int32 to the label \a name.
860
861	This method calls AddData() with the \c B_INT32_TYPE \a type.
862
863	\param name The label to associate the data with.
864	\param value The value to store in the message.
865	\see AddData() for a more detailed overview of the inner workings.
866	\see FindInt32()
867	\see ReplaceInt32()
868*/
869
870
871/*!
872	\fn status_t BMessage::AddInt64(const char *name, int64 value)
873	\brief Convenience method to add an \c int64 to the label \a name.
874
875	This method calls AddData() with the \c B_INT64_TYPE \a type.
876
877	\param name The label to associate the data with.
878	\param value The value to store in the message.
879	\see AddData() for a more detailed overview of the inner workings.
880	\see FindInt64()
881	\see ReplaceInt64()
882*/
883
884
885/*!
886	\fn status_t BMessage::AddBool(const char *name, bool aBoolean)
887	\brief Convenience method to add a \c bool to the label \a name.
888
889	This method calls AddData() with the \c B_BOOL_TYPE \a type.
890
891	\param name The label to associate the data with.
892	\param aBoolean The value to store in the message.
893	\see AddData() for a more detailed overview of the inner workings.
894	\see FindBool()
895	\see ReplaceBool()
896*/
897
898/*!
899	\fn status_t BMessage::AddFloat(const char *name, float aFloat)
900	\brief Convenience method to add a \c float to the label \a name.
901
902	This method calls AddData() with the \c B_FLOAT_TYPE \a type.
903
904	\param name The label to associate the data with.
905	\param aFloat The value to store in the message.
906	\see AddData() for a more detailed overview of the inner workings.
907	\see FindFloat()
908	\see ReplaceFloat()
909*/
910
911
912/*!
913	\fn status_t BMessage::AddDouble(const char *name, double aDouble)
914	\brief Convenience method to add a \c double to the label \a name.
915
916	This method calls AddData() with the \c B_DOUBLE_TYPE \a type.
917
918	\param name The label to associate the data with.
919	\param aDouble The value to store in the message.
920	\see AddData() for a more detailed overview of the inner workings.
921	\see FindDouble()
922	\see ReplaceDouble()
923*/
924
925
926/*!
927	\fn status_t BMessage::AddPointer(const char *name, const void *aPointer)
928	\brief Convenience method to add a \c pointer to the label \a name.
929
930	This method calls AddData() with the \c B_POINTER_TYPE \a type.
931
932	\warning If you want to share objects between applications, please remember
933		that each application has its own address space, and that it therefore
934		is useless to try to pass around objects by sending pointers in
935		messages. You should think about copying the entire object in the
936		message, or you should consider using shared memory.
937
938	\param name The label to associate the data with.
939	\param aPointer The value to store in the message.
940	\see AddData() for a more detailed overview of the inner workings.
941	\see FindPointer()
942	\see ReplacePointer()
943*/
944
945
946/*!
947	\fn status_t BMessage::AddMessenger(const char *name, BMessenger messenger)
948	\brief Convenience method to add a messenger to the label \a name.
949
950	This method calls AddData() with the \c B_MESSENGER_TYPE \a type.
951
952	\param name The label to associate the data with.
953	\param messenger The messenger to store in the message.
954	\see AddData() for a more detailed overview of the inner workings.
955	\see FindMessenger()
956	\see ReplaceMessenger()
957*/
958
959
960/*!
961	\fn status_t BMessage::AddRef(const char *name, const entry_ref *ref)
962	\brief Convenience method to add an \c entry_ref to the label \a name.
963
964	This method calls AddData() with the \c B_REF_TYPE \a type.
965
966	\param name The label to associate the data with.
967	\param ref The reference to store in the message.
968	\see AddData() for a more detailed overview of the inner workings.
969	\see FindRef()
970	\see ReplaceRef()
971*/
972
973
974/*!
975	\fn status_t BMessage::AddMessage(const char *name, const BMessage *message)
976	\brief Convenience method to add a message to the label \a name.
977
978	This method calls AddData() with the \c B_MESSAGE_TYPE \a type.
979
980	\param name The label to associate the data with.
981	\param message The message to store in this message.
982	\see AddData() for a more detailed overview of the inner workings.
983	\see FindMessage()
984	\see ReplaceMessage()
985*/
986
987
988/*!
989	\fn status_t BMessage::AddFlat(const char *name, BFlattenable *object,
990		int32 count = 1)
991	\brief Convenience method to add a flattenable to the label \a name.
992
993	This method uses BFlattenable::TypeCode() to determine the type. It also
994	uses BFlattenable::IsFixedSize() to determine whether or not the size of
995	the object is supposedly always the same. You can specify a \a count, to
996	pre-allocate more entries if you are going to add more than one of this
997	type.
998
999	\param name The label to associate the data with.
1000	\param object The object to flatten into the message.
1001	\param count The number of items to pre-allocate associated with this
1002		\a name.
1003	\see AddData() for a more detailed overview of the inner workings.
1004	\see FindFlat()
1005	\see ReplaceFlat()
1006*/
1007
1008
1009//! @}
1010
1011
1012/*!
1013	\name Removing Data
1014*/
1015
1016
1017//! @{
1018
1019
1020/*!
1021	\fn status_t BMessage::RemoveData(const char *name, int32 index)
1022	\brief Remove data associated with \a name at a specified \a index.
1023
1024	If this is the only instance of the data, then the entire label will be
1025	removed. This means you can recreate it with another type.
1026
1027	\param name The \a name of which the associated data should be cleared.
1028	\param index The \a index of the item that should be cleared.
1029	\retval B_OK The data has been removed.
1030	\retval B_BAD_VALUE The \a index is less than zero (0).
1031	\retval B_BAD_INDEX The \a index is out of bounds.
1032	\retval B_NAME_NOT_FOUND The \a name does not hava any data associated with
1033	 	it.
1034	\see RemoveName()
1035	\see MakeEmpty()
1036*/
1037
1038
1039/*!
1040	\fn status_t BMessage::RemoveName(const char *name)
1041	\brief Remove all data associated with a \a name.
1042
1043	This also removes the label, so that you can recreate it with another type,
1044	if you want to.
1045
1046	\param name The \a name that refers to the data you want to clear out.
1047	\retval B_OK All the data is removed.
1048	\retval B_BAD_VALUE The \a name pointer points to \c NULL.
1049	\retval B_NAME_NOT_FOUND The \a name does not exist in this message.
1050	\see RemoveData()
1051	\see MakeEmpty()
1052*/
1053
1054
1055/*!
1056	\fn status_t BMessage::MakeEmpty()
1057	\brief Clear all data and metadata in this message.
1058
1059	Everything is cleared out, all labels and all associated data, as well
1060	as metadata such as reply info.
1061
1062	\return This method always returns B_OK.
1063	\see RemoveData()
1064	\see RemoveName()
1065*/
1066
1067
1068//! @}
1069
1070
1071/*!
1072	\name Finding Data
1073
1074	Look at FindData() for a general introduction to finding data.
1075*/
1076
1077/* TODO:
1078	Quick overview:
1079
1080	<table>
1081		<tr><th>Type of data</th><th>Type code</th><th>Method</td></tr>
1082		<tr><td>BRect</td><td>B_RECT_TYPE</td><td>FindRect()</td></tr>
1083	</table>
1084*/
1085
1086
1087//! @{
1088
1089
1090/*!
1091	\fn status_t BMessage::FindData(const char *name, type_code type,
1092		int32 index, const void **data, ssize_t *numBytes) const
1093	\brief Find \a data that is stored in this message at an \a index.
1094
1095	This method matches the label \a name with the \a type you are asking for,
1096	and it looks for the data that is stored at a certain \a index number. If
1097	all these things match, you will get a pointer to the internal buffer, and
1098	the method will put the size of the item in \a numBytes.
1099
1100	Note that only this method, and FindString(const char *, const char **),
1101	pass a pointer to the internal buffer. The other more specific methods,
1102	such as FindBool() and FindRect() copy the data into a buffer you specify.
1103	This means that the data retrieved with this method is valid until the
1104	message is deleted.
1105
1106	\param name The label the data should be associated with.
1107	\param type The type of data you want to retrieve. You can pass
1108		\c B_ANY_TYPE if you don't mind which type the data is.
1109	\param index The index in the array of the data that you want to retrieve.
1110		Note that the array is zero-based.
1111	\param[out] data A pointer to a pointer where the data can point to.
1112	\param[out] numBytes The size of the data will be put in this parameter.
1113	\retval B_OK The \a name was found, matches the type, and the data at
1114		\a index has been put in \a data.
1115	\retval B_BAD_VALUE One of the output arguments were \c NULL.
1116	\retval B_BAD_INDEX The \a index does not exist.
1117	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1118	\see status_t FindData(const char *, type_code, int32,
1119	 	const void **, ssize_t *) const
1120*/
1121
1122
1123/*!
1124	\fn status_t BMessage::FindData(const char *name, type_code type,
1125	 	const void **data, ssize_t *numBytes) const
1126	\brief Find \a data that is stored in this message.
1127
1128	This is an overloaded method of FindData(const char *, type_code, int32,
1129	const void **, ssize_t *) const, where data is sought at \a index 0.
1130*/
1131
1132
1133/*!
1134	\fn status_t BMessage::FindRect(const char *name, BRect *rect) const
1135	\brief Find a rectangle at the label \a name.
1136
1137	This is an overloaded method of FindRect(const char *, int32, BRect *) const
1138	where the data is sought at \a index zero.
1139*/
1140
1141
1142/*!
1143	\fn status_t BMessage::FindRect(const char *name, int32 index, BRect *rect) const
1144	\brief Find a rectangle at the label \a name at an \a index.
1145
1146	This method looks for the data with the \a B_RECT_TYPE, and copies it into
1147	a provided buffer.
1148
1149	\param name The label to which the data is associated.
1150	\param index The index from which the data should be copied.
1151	\param rect The object in which the data should be copied.
1152	\retval B_OK The object now contains the requested data.
1153	\retval B_BAD_INDEX The \a index does not exist.
1154	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1155	\see FindRect(const char *, BRect *) const
1156*/
1157
1158
1159/*!
1160	\fn status_t BMessage::FindPoint(const char *name, BPoint *point) const
1161	\brief Find a point at the label \a name.
1162
1163	This is an overloaded method of FindPoint(const char *, int32, BPoint *) const
1164	where the data is sought at \a index zero.
1165*/
1166
1167
1168/*!
1169	\fn status_t BMessage::FindPoint(const char *name, int32 index, BPoint *point) const
1170	\brief Find a point at the label \a name at an \a index.
1171
1172	This method looks for the data with the \a B_POINT_TYPE, and copies it into
1173	a provided buffer.
1174
1175	\param name The label to which the data is associated.
1176	\param index The index from which the data should be copied.
1177	\param point The object in which the data should be copied.
1178	\retval B_OK The object now contains the requested data.
1179	\retval B_BAD_INDEX The \a index does not exist.
1180	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1181	\see FindPoint(const char *, BPoint *) const
1182*/
1183
1184
1185/*!
1186	\fn status_t BMessage::FindString(const char *name, const char **string) const
1187	\brief Find a string at the label \a name.
1188
1189	This is an overloaded method of FindString(const char *, int32, const char **) const
1190	where the data is sought at \a index zero.
1191*/
1192
1193
1194/*!
1195	\fn status_t BMessage::FindString(const char *name, int32 index,
1196		const char ** string) const
1197	\brief Find a string at the label \a name at an \a index.
1198
1199	This method looks for the data with the \a B_STRING_TYPE, and returns a
1200	pointer to the internal buffer of the message. Note that this pointer is
1201	valid, until the message is deleted.
1202
1203	\param name The label to which the data is associated.
1204	\param index The index from which the data should be copied.
1205	\param string The object in which the data should be copied.
1206	\retval B_OK The object now contains the requested data.
1207	\retval B_BAD_INDEX The \a index does not exist.
1208	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1209	\see FindString(const char *, const char **) const
1210	\see FindString(const char *, int32, BString *) const
1211*/
1212
1213
1214/*!
1215	\fn status_t BMessage::FindString(const char *name, BString *string) const
1216	\brief Find a string at the label \a name.
1217
1218	This is an overloaded method of FindString(const char *, int32, BString *) const
1219	where the data is sought at \a index zero.
1220*/
1221
1222
1223/*!
1224	\fn status_t BMessage::FindString(const char *name, int32 index,
1225	 	BString *string) const
1226	\brief Find a string at the label \a name at an \a index.
1227
1228	This method looks for the data with the \a B_STRING_TYPE, and copies it
1229	into the \a string object.
1230
1231	\param name The label to which the data is associated.
1232	\param index The index from which the data should be copied.
1233	\param string The object in which the data should be copied.
1234	\retval B_OK The object now contains the requested data.
1235	\retval B_BAD_INDEX The \a index does not exist.
1236	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1237	\see FindString(const char *, BString *) const
1238	\see FindString(const char *, int32, const char **) const
1239*/
1240
1241
1242/*!
1243	\fn status_t BMessage::FindInt8(const char *name, int8 *value) const
1244	\brief Find an integer at the label \a name.
1245
1246	This is an overloaded method of FindInt8(const char *, int32, int8 *) const
1247	where the data is sought at \a index zero.
1248*/
1249
1250
1251/*!
1252	\fn status_t BMessage::FindInt8(const char *name, int32 index, int8 *value) const
1253	\brief Find an integer at the label \a name at an \a index.
1254
1255	This method looks for the data with the \a B_INT8_TYPE, and copies it into
1256	a provided buffer.
1257
1258	\param name The label to which the data is associated.
1259	\param index The index from which the data should be copied.
1260	\param value The object in which the data should be copied.
1261	\retval B_OK The object now contains the requested data.
1262	\retval B_BAD_INDEX The \a index does not exist.
1263	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1264	\see FindInt8(const char *, int8 *) const
1265*/
1266
1267
1268/*!
1269	\fn status_t BMessage::FindInt16(const char *name, int16 *value) const
1270	\brief Find an integer at the label \a name.
1271
1272	This is an overloaded method of FindInt8(const char *, int32, int16 *) const
1273	where the data is sought at \a index zero.
1274*/
1275
1276
1277/*!
1278	\fn status_t BMessage::FindInt16(const char *name, int32 index, int16 *value) const
1279	\brief Find an integer at the label \a name at an \a index.
1280
1281	This method looks for the data with the \a B_INT16_TYPE, and copies it into
1282	a provided buffer.
1283
1284	\param name The label to which the data is associated.
1285	\param index The index from which the data should be copied.
1286	\param value The object in which the data should be copied.
1287	\retval B_OK The object now contains the requested data.
1288	\retval B_BAD_INDEX The \a index does not exist.
1289	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1290	\see FindInt16(const char *, int16 *) const
1291*/
1292
1293
1294/*!
1295	\fn status_t BMessage::FindInt32(const char *name, int32 *value) const
1296	\brief Find an integer at the label \a name.
1297
1298	This is an overloaded method of FindInt32(const char *, int32, int32 *) const
1299	where the data is sought at \a index zero.
1300*/
1301
1302
1303/*!
1304	\fn status_t BMessage::FindInt32(const char *name, int32 index, int32 *value) const
1305	\brief Find an integer at the label \a name at an \a index.
1306
1307	This method looks for the data with the \a B_INT32_TYPE, and copies it into
1308	a provided buffer.
1309
1310	\param name The label to which the data is associated.
1311	\param index The index from which the data should be copied.
1312	\param value The object in which the data should be copied.
1313	\retval B_OK The object now contains the requested data.
1314	\retval B_BAD_INDEX The \a index does not exist.
1315	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1316	\see FindInt32(const char *, int32 *) const
1317*/
1318
1319
1320/*!
1321	\fn status_t BMessage::FindInt64(const char *name, int64 *value) const
1322	\brief Find an integer at the label \a name.
1323
1324	This is an overloaded method of FindInt64(const char *, int32, int64 *) const
1325	where the data is sought at \a index zero.
1326*/
1327
1328
1329/*!
1330	\fn status_t BMessage::FindInt64(const char *name, int32 index, int64 *value) const
1331	\brief Find an integer at the label \a name at an \a index.
1332
1333	This method looks for the data with the \a B_INT64_TYPE, and copies it into
1334	a provided buffer.
1335
1336	\param name The label to which the data is associated.
1337	\param index The index from which the data should be copied.
1338	\param value The object in which the data should be copied.
1339	\retval B_OK The object now contains the requested data.
1340	\retval B_BAD_INDEX The \a index does not exist.
1341	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1342	\see FindInt64(const char *, int64 *) const
1343*/
1344
1345
1346/*!
1347	\fn status_t BMessage::FindBool(const char *name, bool *value) const
1348	\brief Find a boolean at the label \a name.
1349
1350	This is an overloaded method of FindBool(const char *, int32, bool *) const
1351	where the data is sought at \a index zero.
1352*/
1353
1354
1355/*!
1356	\fn status_t BMessage::FindBool(const char *name, int32 index, bool *value) const
1357	\brief Find a boolean at the label \a name at an \a index.
1358
1359	This method looks for the data with the \a B_BOOL_TYPE, and copies it into
1360	a provided buffer.
1361
1362	\param name The label to which the data is associated.
1363	\param index The index from which the data should be copied.
1364	\param value The object in which the data should be copied.
1365	\retval B_OK The object now contains the requested data.
1366	\retval B_BAD_INDEX The \a index does not exist.
1367	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1368	\see FindBool(const char *, bool *) const
1369*/
1370
1371
1372/*!
1373	\fn status_t BMessage::FindFloat(const char *name, float *value) const
1374	\brief Find a float at the label \a name.
1375
1376	This is an overloaded method of FindFloat(const char *, int32, float *) const
1377	where the data is sought at \a index zero.
1378*/
1379
1380
1381/*!
1382	\fn status_t BMessage::FindFloat(const char *name, int32 index, float *value) const
1383	\brief Find a float at the label \a name at an \a index.
1384
1385	This method looks for the data with the \a B_FLOAT_TYPE, and copies it into
1386	a provided buffer.
1387
1388	\param name The label to which the data is associated.
1389	\param index The index from which the data should be copied.
1390	\param value The object in which the data should be copied.
1391	\retval B_OK The object now contains the requested data.
1392	\retval B_BAD_INDEX The \a index does not exist.
1393	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1394	\see FindFloat(const char *, float *) const
1395*/
1396
1397
1398/*!
1399	\fn status_t BMessage::FindDouble(const char *name, double *value) const
1400	\brief Find a double at the label \a name.
1401
1402	This is an overloaded method of FindDouble(const char *, int32, double *) const
1403	where the data is sought at \a index zero.
1404*/
1405
1406
1407/*!
1408	\fn status_t BMessage::FindDouble(const char *name, int32 index, double *value) const
1409	\brief Find a double at the label \a name at an \a index.
1410
1411	This method looks for the data with the \a B_DOUBLE_TYPE, and copies it into
1412	a provided buffer.
1413
1414	\param name The label to which the data is associated.
1415	\param index The index from which the data should be copied.
1416	\param value The object in which the data should be copied.
1417	\retval B_OK The object now contains the requested data.
1418	\retval B_BAD_INDEX The \a index does not exist.
1419	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1420	\see FindDouble(const char *, double *) const
1421*/
1422
1423
1424/*!
1425	\fn status_t BMessage::FindPointer(const char *name, void **pointer) const
1426	\brief Find a pointer at the label \a name.
1427
1428	This is an overloaded method of FindPointer(const char *, int32, void *) const
1429	where the data is sought at \a index zero.
1430*/
1431
1432
1433/*!
1434	\fn status_t BMessage::FindPointer(const char *name, int32 index,  void **pointer) const
1435	\brief Find a pointer at the label \a name at an \a index.
1436
1437	This method looks for the data with the \a B_POINTER_TYPE, and copies it into
1438	a provided buffer.
1439
1440	\warning If you want to share objects between applications, please remember
1441		that each application has its own address space, and that it therefore
1442		is useless to try to pass around objects by sending pointers in
1443		messages. You should think about copying the entire object in the
1444		message, or you should consider using shared memory.
1445
1446	\param name The label to which the data is associated.
1447	\param index The index from which the data should be copied.
1448	\param pointer The object in which the data should be copied.
1449	\retval B_OK The object now contains the requested data.
1450	\retval B_BAD_INDEX The \a index does not exist.
1451	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1452	\see FindPointer(const char *, double *) const
1453*/
1454
1455
1456/*!
1457	\fn status_t BMessage::FindMessenger(const char *name, BMessenger *messenger) const
1458	\brief Find a messenger at the label \a name.
1459
1460	This is an overloaded method of FindMessenger(const char *, int32, BMessenger *) const
1461	where the data is sought at \a index zero.
1462*/
1463
1464
1465/*!
1466	\fn status_t BMessage::FindMessenger(const char *name, int32 index,
1467	 	BMessenger *messenger) const
1468	\brief Find a messenger at the label \a name at an \a index.
1469
1470	This method looks for the data with the \a B_MESSENGER_TYPE, and copies it into
1471	a provided buffer.
1472
1473	\param name The label to which the data is associated.
1474	\param index The index from which the data should be copied.
1475	\param messenger The object in which the data should be copied.
1476	\retval B_OK The object now contains the requested data.
1477	\retval B_BAD_INDEX The \a index does not exist.
1478	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1479	\see FindMessenger(const char *, BMessenger *) const
1480*/
1481
1482
1483/*!
1484	\fn status_t BMessage::FindRef(const char *name, entry_ref *ref) const
1485	\brief Find a reference to a file at the label \a name.
1486
1487	This is an overloaded method of FindRef(const char *, int32, entry_ref *) const
1488	where the data is sought at \a index zero.
1489*/
1490
1491
1492/*!
1493	\fn status_t BMessage::FindRef(const char *name, int32 index, entry_ref *ref) const
1494	\brief Find a reference to a file at the label \a name at an \a index.
1495
1496	This method looks for the data with the \a B_REF_TYPE, and copies it into
1497	a provided buffer.
1498
1499	\param name The label to which the data is associated.
1500	\param index The index from which the data should be copied.
1501	\param ref The object in which the data should be copied.
1502	\retval B_OK The object now contains the requested data.
1503	\retval B_BAD_INDEX The \a index does not exist.
1504	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1505	\see FindRef(const char *, entry_ref *) const
1506*/
1507
1508
1509/*!
1510	\fn status_t BMessage::FindMessage(const char *name, BMessage *message) const
1511	\brief Find a message at the label \a name.
1512
1513	This is an overloaded method of FindMessage(const char *, int32, BMessage *) const
1514	where the data is sought at \a index zero.
1515*/
1516
1517
1518/*!
1519	\fn status_t BMessage::FindMessage(const char *name, int32 index,
1520	 	BMessage *message) const
1521	\brief Find a message at the label \a name at an \a index.
1522
1523	This method looks for the data with the \a B_MESSAGE_TYPE, and copies it into
1524	a provided buffer.
1525
1526	\param name The label to which the data is associated.
1527	\param index The index from which the data should be copied.
1528	\param message The object in which the data should be copied.
1529	\retval B_OK The object now contains the requested data.
1530	\retval B_BAD_INDEX The \a index does not exist.
1531	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1532	\see FindMessage(const char *, BMessage *) const
1533*/
1534
1535
1536/*!
1537	\fn status_t BMessage::FindFlat(const char *name, BFlattenable *object) const
1538	\brief Find a flattened object at the label \a name.
1539
1540	This is an overloaded method of FindFlat(const char *, int32, BFlattenable *) const
1541	where the data is sought at \a index zero.
1542*/
1543
1544
1545/*!
1546	\fn status_t BMessage::FindFlat(const char *name, int32 index,
1547	 	BFlattenable *object) const
1548	\brief Find a flattened object at the label \a name at an \a index.
1549
1550	The type is determined by the type of the passed object. If that type is
1551	available at the specified label, then the Unflatten() method of that
1552	object will be called.
1553
1554	\param name The label to which the data is associated.
1555	\param index The index from which the data should be unflattened.
1556	\param object The object in which the data should be unflattened.
1557	\retval B_OK The object now contains the requested data.
1558	\retval B_BAD_INDEX The \a index does not exist.
1559	\retval B_NAME_NOT_FOUND There is no field with this \a name.
1560	\see FindFlat(const char *, BFlattenable *) const
1561*/
1562
1563
1564//! @}
1565
1566
1567/*!
1568	\name Replacing Data
1569
1570	Look at ReplaceData() for a general introduction to replacing data.
1571*/
1572
1573
1574//! @{
1575
1576
1577/*!
1578	\fn status_t BMessage::ReplaceData(const char *name, type_code type,
1579		const void *data, ssize_t numBytes)
1580	\brief Replace the data at label \a name.
1581
1582	This method is an overloaded method that replaces the data at \a index
1583	zero. See ReplaceData(const char *, type_code, int32, const void *, ssize_t).
1584*/
1585
1586
1587/*!
1588	\fn status_t BMessage::ReplaceData(const char *name, type_code type,
1589	 	int32 index, const void *data, ssize_t numBytes)
1590	\brief Replace the data at label \a name at a specified \a index.
1591
1592	The conditions for replacing data are that the \a name is correct, the
1593	\a type matches and the data entry at \a index exists.
1594
1595	There is also a collection of convenience methods, that allow you to
1596	efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()),
1597	and so on.
1598
1599	\param name The name associated with the data to replace.
1600	\param type The type of the data.
1601	\param index The index in the array to replace.
1602	\param data A pointer to the new data that needs to be copied into the
1603		message.
1604	\param numBytes The size of the new data.
1605
1606	\retval B_OK The operation succeeded.
1607	\retval B_BAD_VALUE One of the input parameters are invalid. Check that
1608		you did not pass \c NULL, and in case the field has fixed sized data,
1609		check that \a numBytes is the same as the specified fixed size.
1610	\retval B_BAD_INDEX The \a index is out of range.
1611*/
1612
1613
1614/*!
1615	\fn status_t BMessage::ReplaceRect(const char *name, BRect aRect)
1616	\brief Replace a rectangle at the label \a name.
1617
1618	This method is an overloaded method of ReplaceRect(const char *, int32, BRect).
1619	It replaces the data at \a index zero.
1620*/
1621
1622
1623/*!
1624	\fn status_t BMessage::ReplaceRect(const char *name, int32 index, BRect aRect)
1625	\brief Replace a rectangle at the label \a name at a specified \a index.
1626
1627	The data at the specified \a name and \a index will be replaced, if it
1628	matches the \c B_RECT_TYPE.
1629	\param name The name associated with the data to replace.
1630	\param index The index in the array to replace.
1631	\param aRect The object to store in the message.
1632	\retval B_OK The operation succeeded.
1633	\retval B_BAD_INDEX The index was out of range.
1634	\see ReplaceRect(const char*, BRect)
1635*/
1636
1637
1638/*!
1639	\fn status_t BMessage::ReplacePoint(const char *name, BPoint aPoint)
1640	\brief Replace a point at the label \a name.
1641
1642	This method is an overloaded method of ReplacePoint(const char *, int32, BPoint).
1643	It replaces the data at \a index zero.
1644*/
1645
1646
1647/*!
1648	\fn status_t BMessage::ReplacePoint(const char *name, int32 index, BPoint aPoint)
1649	\brief Replace a point at the label \a name at a specified \a index.
1650
1651	The data at the specified \a name and \a index will be replaced, if it
1652	matches the \c B_POINT_TYPE.
1653	\param name The name associated with the data to replace.
1654	\param index The index in the array to replace.
1655	\param aPoint The object to store in the message.
1656	\retval B_OK The operation succeeded.
1657	\retval B_BAD_INDEX The index was out of range.
1658	\see ReplacePoint(const char*, aPoint)
1659*/
1660
1661
1662/*!
1663	\fn status_t BMessage::ReplaceString(const char *name, const char *aString)
1664	\brief Replace a string at the label \a name.
1665
1666	This method is an overloaded method of ReplaceString(const char *, int32, const char *).
1667	It replaces the data at \a index zero.
1668*/
1669
1670
1671/*!
1672	\fn status_t BMessage::ReplaceString(const char *name, int32 index, const char *aString)
1673	\brief Replace a string at the label \a name at a specified \a index.
1674
1675	The data at the specified \a name and \a index will be replaced, if it
1676	matches the \c B_STRING_TYPE.
1677	\param name The name associated with the data to replace.
1678	\param index The index in the array to replace.
1679	\param aString The object to store in the message.
1680	\retval B_OK The operation succeeded.
1681	\retval B_BAD_INDEX The index was out of range.
1682	\see ReplaceString(const char*, const char *)
1683*/
1684
1685
1686/*!
1687	\fn status_t BMessage::ReplaceString(const char *name, const BString &aString)
1688	\brief Replace a string at the label \a name.
1689
1690	This method is an overloaded method of ReplaceString(const char *, int32, BString &).
1691	It replaces the data at \a index zero.
1692*/
1693
1694
1695/*!
1696	\fn status_t BMessage::ReplaceString(const char *name, int32 index, const BString &aString)
1697	\brief Replace a string at the label \a name at a specified \a index.
1698
1699	The data at the specified \a name and \a index will be replaced, if it
1700	matches the \c B_STRING_TYPE.
1701	\param name The name associated with the data to replace.
1702	\param index The index in the array to replace.
1703	\param aString The object to store in the message.
1704	\retval B_OK The operation succeeded.
1705	\retval B_BAD_INDEX The index was out of range.
1706	\see ReplaceString(const char*, BString &)
1707*/
1708
1709
1710/*!
1711	\fn status_t BMessage::ReplaceInt8(const char *name, int8 value)
1712	\brief Replace an integer at the label \a name.
1713
1714	This method is an overloaded method of ReplaceInt8(const char *, int32, int8).
1715	It replaces the data at \a index zero.
1716*/
1717
1718
1719/*!
1720	\fn status_t BMessage::ReplaceInt8(const char *name, int32 index, int8 value)
1721	\brief Replace an integer at the label \a name at a specified \a index.
1722
1723	The data at the specified \a name and \a index will be replaced, if it
1724	matches the \c B_INT8_TYPE.
1725	\param name The name associated with the data to replace.
1726	\param index The index in the array to replace.
1727	\param value The object to store in the message.
1728	\retval B_OK The operation succeeded.
1729	\retval B_BAD_INDEX The index was out of range.
1730	\see ReplaceInt8(const char*, int8)
1731*/
1732
1733
1734/*!
1735	\fn status_t BMessage::ReplaceInt16(const char *name, int16 value)
1736	\brief Replace an integer at the label \a name.
1737
1738	This method is an overloaded method of ReplaceInt16(const char *, int32, int16).
1739	It replaces the data at \a index zero.
1740*/
1741
1742
1743/*!
1744	\fn status_t BMessage::ReplaceInt16(const char *name, int32 index, int16 value)
1745	\brief Replace an integer at the label \a name at a specified \a index.
1746
1747	The data at the specified \a name and \a index will be replaced, if it
1748	matches the \c B_INT16_TYPE.
1749	\param name The name associated with the data to replace.
1750	\param index The index in the array to replace.
1751	\param value The object to store in the message.
1752	\retval B_OK The operation succeeded.
1753	\retval B_BAD_INDEX The index was out of range.
1754	\see ReplaceInt16(const char*, int16)
1755*/
1756
1757
1758/*!
1759	\fn status_t BMessage::ReplaceInt32(const char *name, int32 value)
1760	\brief Replace an integer at the label \a name.
1761
1762	This method is an overloaded method of ReplaceInt8(const char *, int32, int32).
1763	It replaces the data at \a index zero.
1764*/
1765
1766
1767/*!
1768	\fn status_t BMessage::ReplaceInt32(const char *name, int32 index, int32 value)
1769	\brief Replace an integer at the label \a name at a specified \a index.
1770
1771	The data at the specified \a name and \a index will be replaced, if it
1772	matches the \c B_INT32_TYPE.
1773	\param name The name associated with the data to replace.
1774	\param index The index in the array to replace.
1775	\param value The object to store in the message.
1776	\retval B_OK The operation succeeded.
1777	\retval B_BAD_INDEX The index was out of range.
1778	\see ReplaceInt32(const char*, int32)
1779*/
1780
1781
1782/*!
1783	\fn status_t BMessage::ReplaceInt64(const char *name, int64 value)
1784	\brief Replace an integer at the label \a name.
1785
1786	This method is an overloaded method of ReplaceInt8(const char *, int32, int64).
1787	It replaces the data at \a index zero.
1788*/
1789
1790
1791/*!
1792	\fn status_t BMessage::ReplaceInt64(const char *name, int32 index, int64 value)
1793	\brief Replace an integer at the label \a name at a specified \a index.
1794
1795	The data at the specified \a name and \a index will be replaced, if it
1796	matches the \c B_INT64_TYPE.
1797	\param name The name associated with the data to replace.
1798	\param index The index in the array to replace.
1799	\param value The object to store in the message.
1800	\retval B_OK The operation succeeded.
1801	\retval B_BAD_INDEX The index was out of range.
1802	\see ReplaceInt64(const char*, int64)
1803*/
1804
1805
1806/*!
1807	\fn status_t BMessage::ReplaceBool(const char *name, bool aBoolean)
1808	\brief Replace a boolean at the label \a name.
1809
1810	This method is an overloaded method of ReplaceBool(const char *, int32, bool).
1811	It replaces the data at \a index zero.
1812*/
1813
1814
1815/*!
1816	\fn status_t BMessage::ReplaceBool(const char *name, int32 index, bool aBoolean)
1817	\brief Replace a boolean at the label \a name at a specified \a index.
1818
1819	The data at the specified \a name and \a index will be replaced, if it
1820	matches the \c B_BOOL_TYPE.
1821	\param name The name associated with the data to replace.
1822	\param index The index in the array to replace.
1823	\param aBoolean The object to store in the message.
1824	\retval B_OK The operation succeeded.
1825	\retval B_BAD_INDEX The index was out of range.
1826	\see ReplaceBool(const char*, bool)
1827*/
1828
1829
1830/*!
1831	\fn status_t BMessage::ReplaceFloat(const char *name, float aFloat)
1832	\brief Replace a float at the label \a name.
1833
1834	This method is an overloaded method of ReplaceFloat(const char *, int32, float).
1835	It replaces the data at \a index zero.
1836*/
1837
1838
1839/*!
1840	\fn status_t BMessage::ReplaceFloat(const char *name, int32 index, float aFloat)
1841	\brief Replace a float at the label \a name at a specified \a index.
1842
1843	The data at the specified \a name and \a index will be replaced, if it
1844	matches the \c B_FLOAT_TYPE.
1845	\param name The name associated with the data to replace.
1846	\param index The index in the array to replace.
1847	\param aFloat The object to store in the message.
1848	\retval B_OK The operation succeeded.
1849	\retval B_BAD_INDEX The index was out of range.
1850	\see ReplaceFloat(const char*, float)
1851*/
1852
1853
1854/*!
1855	\fn status_t BMessage::ReplaceDouble(const char *name, double aDouble)
1856	\brief Replace a double at the label \a name.
1857
1858	This method is an overloaded method of ReplaceDouble(const char *, int32, double).
1859	It replaces the data at \a index zero.
1860*/
1861
1862
1863/*!
1864	\fn status_t BMessage::ReplaceDouble(const char *name, int32 index, double aDouble)
1865	\brief Replace a double at the label \a name at a specified \a index.
1866
1867	The data at the specified \a name and \a index will be replaced, if it
1868	matches the \c B_DOUBLE_TYPE.
1869	\param name The name associated with the data to replace.
1870	\param index The index in the array to replace.
1871	\param aDouble The object to store in the message.
1872	\retval B_OK The operation succeeded.
1873	\retval B_BAD_INDEX The index was out of range.
1874	\see ReplaceDouble(const char*, double)
1875*/
1876
1877
1878/*!
1879	\fn status_t BMessage::ReplacePointer(const char *name, const void *pointer)
1880	\brief Replace a pointer at the label \a name.
1881
1882	This method is an overloaded method of ReplacePointer(const char *, int32, const void *).
1883	It replaces the data at \a index zero.
1884*/
1885
1886
1887/*!
1888	\fn status_t BMessage::ReplacePointer(const char *name,int32 index,const void *pointer)
1889	\brief Replace a pointer at the label \a name at a specified \a index.
1890
1891	The data at the specified \a name and \a index will be replaced, if it
1892	matches the \c B_POINTER_TYPE.
1893	\param name The name associated with the data to replace.
1894	\param index The index in the array to replace.
1895	\param pointer The object to store in the message.
1896	\retval B_OK The operation succeeded.
1897	\retval B_BAD_INDEX The index was out of range.
1898	\see ReplacePointer(const char*, const void *)
1899*/
1900
1901
1902/*!
1903	\fn status_t BMessage::ReplaceMessenger(const char *name, BMessenger messenger)
1904	\brief Replace a messenger at the label \a name.
1905
1906	This method is an overloaded method of ReplaceMessenger(const char *, int32, BMessenger).
1907	It replaces the data at \a index zero.
1908*/
1909
1910
1911/*!
1912	\fn status_t BMessage::ReplaceMessenger(const char *name, int32 index, BMessenger messenger)
1913	\brief Replace a messenger at the label \a name at a specified \a index.
1914
1915	The data at the specified \a name and \a index will be replaced, if it
1916	matches the \c B_MESSENGER_TYPE.
1917	\param name The name associated with the data to replace.
1918	\param index The index in the array to replace.
1919	\param messenger The object to store in the message.
1920	\retval B_OK The operation succeeded.
1921	\retval B_BAD_INDEX The index was out of range.
1922	\see ReplaceMessenger(const char*, BMessenger)
1923*/
1924
1925
1926/*!
1927	\fn status_t BMessage::ReplaceRef(const char *name,const entry_ref *ref)
1928	\brief Replace a reference to a file at the label \a name.
1929
1930	This method is an overloaded method of ReplaceRef(const char *, int32, entry_ref *).
1931	It replaces the data at \a index zero.
1932*/
1933
1934
1935/*!
1936	\fn status_t BMessage::ReplaceRef(	const char *name, int32 index, const entry_ref *ref)
1937	\brief Replace a reference to a file at the label \a name at a specified
1938	 	\a index.
1939
1940	The data at the specified \a name and \a index will be replaced, if it
1941	matches the \c B_REF_TYPE.
1942	\param name The name associated with the data to replace.
1943	\param index The index in the array to replace.
1944	\param ref The object to store in the message.
1945	\retval B_OK The operation succeeded.
1946	\retval B_BAD_INDEX The index was out of range.
1947	\see ReplaceRef(const char*, entry_ref *)
1948*/
1949
1950
1951/*!
1952	\fn status_t BMessage::ReplaceMessage(const char *name, const BMessage *message)
1953	\brief Replace a message at the label \a name.
1954
1955	This method is an overloaded method of ReplaceMessage(const char *, int32, BMessage *).
1956	It replaces the data at \a index zero.
1957*/
1958
1959
1960/*!
1961	\fn status_t BMessage::ReplaceMessage(const char *name, int32 index, const BMessage *message)
1962	\brief Replace a message at the label \a name at a specified \a index.
1963
1964	The data at the specified \a name and \a index will be replaced, if it
1965	matches the \c B_MESSAGE_TYPE.
1966	\param name The name associated with the data to replace.
1967	\param index The index in the array to replace.
1968	\param message The object to store in the message.
1969	\retval B_OK The operation succeeded.
1970	\retval B_BAD_INDEX The index was out of range.
1971	\see ReplaceMessage(const char*, BMessage *)
1972*/
1973
1974
1975/*!
1976	\fn status_t BMessage::ReplaceFlat(const char *name, BFlattenable *object)
1977	\brief Replace a flattened object at the label \a name.
1978
1979	This method is an overloaded method of ReplaceFlat(const char *, int32, BFlattenable *).
1980	It replaces the data at \a index zero.
1981*/
1982
1983
1984/*!
1985	\fn status_t BMessage::ReplaceFlat(const char *name, int32 index, BFlattenable *object)
1986	\brief Replace a flattened object at the label \a name at a specified
1987	 	\a index.
1988
1989	The data at the specified \a name and \a index will be replaced, if it
1990	matches the type returned by your object. This method uses
1991	BFlattenable::TypeCode() to determine the type of the object.
1992
1993	\param name The name associated with the data to replace.
1994	\param index The index in the array to replace.
1995	\param object The object to store in the message.
1996	\retval B_OK The operation succeeded.
1997	\retval B_BAD_INDEX The index was out of range.
1998	\see ReplaceFlat(const char*, BFlattenable *)
1999*/
2000
2001
2002//! @}
2003
2004
2005/*!
2006	\name Deprecated methods
2007
2008	These methods are <em>very</em> likely to disappear, and they have been
2009	replaced by safer and more powerful methods. These methods are still
2010	implemented for binary compatibility, but they are not documented.
2011*/
2012
2013
2014//! @{
2015
2016
2017/*!
2018	\fn void *BMessage::operator new(size_t size)
2019	\brief Internal operator.
2020*/
2021
2022
2023/*!
2024	\fn void *BMessage::operator new(size_t, void *pointer)
2025	\brief Internal operator.
2026*/
2027
2028
2029/*!
2030	\fn void BMessage::operator delete(void *pointer, size_t size)
2031	\brief Internal operator.
2032*/
2033
2034
2035/*!
2036	\fn bool BMessage::HasRect(const char *, int32) const
2037	\brief Deprecated.
2038*/
2039
2040
2041/*!
2042	\fn bool BMessage::HasPoint(const char *, int32) const
2043	\brief Deprecated.
2044*/
2045
2046
2047/*!
2048	\fn bool BMessage::HasString(const char *, int32) const
2049	\brief Deprecated.
2050*/
2051
2052
2053/*!
2054	\fn bool BMessage::HasInt8(const char *, int32) const
2055	\brief Deprecated.
2056*/
2057
2058
2059/*!
2060	\fn bool BMessage::HasInt16(const char *, int32) const
2061	\brief Deprecated.
2062*/
2063
2064
2065/*!
2066	\fn	bool BMessage::HasInt32(const char *, int32) const
2067	\brief Deprecated.
2068*/
2069
2070
2071/*!
2072	\fn bool BMessage::HasInt64(const char *, int32) const
2073	\brief Deprecated.
2074*/
2075
2076
2077/*!
2078	\fn bool BMessage::HasBool(const char *, int32) const
2079	\brief Deprecated.
2080*/
2081
2082
2083/*!
2084	\fn bool BMessage::HasFloat(const char *, int32) const
2085	\brief Deprecated.
2086*/
2087
2088
2089/*!
2090	\fn bool BMessage::HasDouble(const char *, int32) const
2091	\brief Deprecated.
2092*/
2093
2094
2095/*!
2096	\fn bool BMessage::HasPointer(const char *, int32) const
2097	\brief Deprecated.
2098*/
2099
2100
2101/*!
2102	\fn bool BMessage::HasMessenger(const char *, int32) const
2103	\brief Deprecated.
2104*/
2105
2106
2107/*!
2108	\fn bool BMessage::HasRef(const char *, int32) const
2109	\brief Deprecated.
2110*/
2111
2112
2113/*!
2114	\fn bool BMessage::HasMessage(const char *, int32) const
2115	\brief Deprecated.
2116*/
2117
2118
2119/*!
2120	\fn bool BMessage::HasFlat(const char *, const BFlattenable *) const
2121	\brief Deprecated.
2122*/
2123
2124
2125/*!
2126	\fn bool BMessage::HasFlat(const char *, int32, const BFlattenable *) const
2127	\brief Deprecated.
2128*/
2129
2130
2131/*!
2132	\fn	bool BMessage::HasData(const char *, type_code , int32) const
2133	\brief Deprecated.
2134*/
2135
2136
2137/*!
2138	\fn	BRect BMessage::FindRect(const char *, int32) const
2139	\brief Deprecated.
2140*/
2141
2142
2143/*!
2144	\fn BPoint BMessage::FindPoint(const char *, int32) const
2145	\brief Deprecated.
2146*/
2147
2148
2149/*!
2150	\fn const char *BMessage::FindString(const char *, int32) const
2151	\brief Deprecated.
2152*/
2153
2154
2155/*!
2156	\fn int8 BMessage::FindInt8(const char *, int32) const
2157	\brief Deprecated.
2158*/
2159
2160
2161/*!
2162	\fn	int16 BMessage::FindInt16(const char *, int32) const
2163	\brief Deprecated.
2164*/
2165
2166
2167/*!
2168	\fn int32 BMessage::FindInt32(const char *, int32) const
2169	\brief Deprecated.
2170*/
2171
2172
2173/*!
2174	\fn	int64 BMessage::FindInt64(const char *, int32) const
2175	\brief Deprecated.
2176*/
2177
2178
2179/*!
2180	\fn bool BMessage::FindBool(const char *, int32) const
2181	\brief Deprecated.
2182*/
2183
2184
2185/*!
2186	\fn float BMessage::FindFloat(const char *, int32) const
2187	\brief Deprecated.
2188*/
2189
2190
2191/*!
2192	\fn double BMessage::FindDouble(const char *, int32) const
2193	\brief Deprecated.
2194*/
2195
2196
2197//! @}
2198