2 * Copyright 2007-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Niels Sascha Reedijk, niels.reedijk@gmail.com
7 * John Scipione, jscpione@gmail.com
10 * headers/os/app/Message.h hrev47355
11 * src/kits/app/Message.cpp hrev47355
19 \brief Provides the BMessage class.
23 ///// Name lengths and Scripting specifiers /////
27 \def B_FIELD_NAME_LENGTH
28 \brief Undocumented...
35 \def B_PROPERTY_NAME_LENGTH
36 \brief Undocumented...
44 \brief Undocumented...
51 \var B_DIRECT_SPECIFIER
52 \brief Undocumented...
59 \var B_INDEX_SPECIFIER
60 \brief Undocumented...
67 \var B_REVERSE_INDEX_SPECIFIER,
68 \brief Undocumented...
75 \var B_RANGE_SPECIFIER
76 \brief Undocumented...
83 \var B_REVERSE_RANGE_SPECIFIER
84 \brief Undocumented...
92 \brief Undocumented...
100 \brief Undocumented...
107 \var B_SPECIFIERS_END
108 \brief Undocumented...
114 ///// Class BMessage /////
121 \brief A container that can be send and received using the Haiku messaging
124 This class is at the center of the web of messaging classes, in the sense
125 that it defines the actual structure of the messages. Messages have two
126 <b>important elements</b>: the #what identifier, and the data members. The
127 first can be directly manipulated, the latter can be manipulated through
128 AddData(), FindData() and ReplaceData() and their derivatives. Neither of
129 these elements are mandatory.
131 The second important role of BMessage is that it stores <b>meta data</b>:
132 who sent the message and with what intention? The methods of BMessage will
133 disclose if the message was a reply (IsReply()), where it came from
134 (IsSourceRemote()), whether a reply is expected (IsSourceWaiting()), and in
135 case the message is a reply, what it's a reply to (Previous()).
137 Mostly, messages are used to pass information between the the objects in
138 your application, but because messages are such flexible data containers,
139 they are also often used for other <b>data storage purposes</b>. Many
140 applications store their settings as messages. Because messages can be
141 flattened to data streams (such as files), they provide an easy but
142 powerful tool for data storage.
144 All methods can be classified in these areas:
145 - Adding, Finding, Replacing and Removing Data.
146 - Statistics and Miscellaneous information.
147 - Delivery information.
148 - Utilities to reply to messages.
150 To see how messages fit in with the greater picture, have a look at the
151 \ref app_messaging "Messaging Introduction".
159 \brief A 4-byte constant that determines the type of message.
161 You can directly manipulate this data member.
168 \fn BMessage::BMessage()
169 \brief Construct an empty message, without any data members and with a
170 \a what constant set to \c 0.
172 \see BMessage(uint32 what)
173 \see BMessage(const BMessage& other)
180 \fn BMessage::BMessage(uint32 what)
181 \brief Construct an empty message with the \a what member set to the
184 \see BMessage::BMessage()
185 \see BMessage::BMessage(const BMessage& other)
192 \fn BMessage::BMessage(const BMessage& other)
193 \brief Construct a new message that is a copy of another message.
195 The \a what member and the data values are copied. The metadata, such as
196 whether or not the message is a drop message or reply information is
197 not copied. If the original message is a reply to a previous message
198 this will make IsReply() return \c true, while calling the same method on
199 a copy of the message will return \c false.
201 \remark BeOS kept the metadata of the message while Haiku deviates from
202 this behavior. Use the Haiku implementation of message copying
203 as the default behavior to keep your applications backwards
206 \see BMessage::BMessage()
207 \see BMessage(uint32 what)
214 \fn BMessage::~BMessage()
215 \brief Free the data members associated with the message.
217 If there still is a sender waiting for a reply, the \c B_NO_REPLY message
218 will be sent to inform them that there won't be a reply.
225 \name Statistics and Miscellaneous Information
233 \fn status_t BMessage::GetInfo(type_code typeRequested, int32 index,
234 char** nameFound, type_code* typeFound, int32* countFound) const
235 \brief Retrieve the name, the type and the number of items in a message by
238 \param[in] typeRequested If you want to limit the search to only one type,
239 pass that type code here. If you don't care which type the data
240 has, you can pass \c B_ANY_TYPE.
241 \param[in] index The index of the data you want to investigate.
242 \param[out] nameFound The name of the item if it is found. Haiku will fill
243 in a pointer to the internal name buffer in the message. This
244 means that you should not manipulate this name. If you are not
245 interested in the name, you can safely pass \c NULL.
246 \param[out] typeFound The type of the item at \a index. If you are
247 not interested in the type (because you specifically asked for
248 a type), you can safely pass \c NULL.
249 \param[out] countFound The number of items at \a index. If data
250 items have the same name, they will be placed under the same
253 \return If the \a index is found, and matches the requested type,
254 then the other parameters will be filled in. If this is not the
255 case, the method will return with an error.
256 \retval B_OK An match was found. The values have been filled in.
257 \retval B_BAD_INDEX The \a index was out of range. None of the
258 passed variables have been altered.
259 \retval B_BAD_TYPE The data field at \a index does not have the
267 \fn status_t BMessage::GetInfo(const char* name, type_code* typeFound,
268 int32* countFound) const
269 \brief Retrieve the type and the number of data items in this message that
270 are associated with a \a name.
272 \param[in] name The name of the data member that you are looking for.
273 \param[out] typeFound In case of a match, the name of the data member will
274 be put in this parameter. In case you are not interested, you
276 \param[out] countFound In case of a match, the number of items at this
277 label will be in this parameter. In case you are not
278 interested, you can safely pass \c NULL.
280 \return If the message has data associated with the given \a name,
281 the other parameters will contain information associated with the
282 data, else, the method will return with an error.
283 \retval B_OK A match was found. The other parameters have been filled in.
284 \retval B_BAD_VALUE You passed \c NULL as argument to \a name.
285 \retval B_NAME_NOT_FOUND There is no data with the label \a name.
292 \fn status_t BMessage::GetInfo(const char* name, type_code* typeFound,
293 bool* fixedSize) const
294 \brief Retrieve the type and whether or not the size of the data is fixed
295 associated with a \a name.
297 This method is the same as GetInfo(const char*, type_code*, int32*) const,
298 with the difference that you can find out whether or not the size of the
299 data associated with the \a name is fixed. You will get this value
300 in the variable you passed as \a fixedSize parameter.
307 \fn int32 BMessage::CountNames(type_code type) const
308 \brief Count the number of names of a certain \a type.
310 This method can be used to count the number of items of a certain type.
311 It's practical use is limited to debugging purposes.
313 \param type The type you want to find. If you pass \c B_ANY_TYPE, this
314 method will return the total number of data items.
316 \return The number of data items in this message with the specified
317 \a type, or \c 0 in case no items match the type.
324 \fn bool BMessage::IsEmpty() const
325 \brief Check if the message has data members.
327 \return If this message contains data members, this method will return
328 \c true, else it will return \c false.
337 \fn bool BMessage::IsSystem() const
338 \brief Check if the message is a system message.
340 \return If this message is a system message, the method will return
348 \fn bool BMessage::IsReply() const
349 \brief Check if the message is a reply to a (previous) message.
351 \return If this message is a reply, this method will return \c true.
358 \fn void BMessage::PrintToStream() const
359 \brief Print the message to the standard output.
361 This method can be used to debug your application. It can be used to check
362 if it creates the messages properly, by checking if all the required fields
363 are present, and it can be used to debug your message handling routines,
364 especially the handling of those that are sent by external applications, to
365 see if you understand the semantics correctly.
372 \fn status_t BMessage::Rename(const char* oldEntry, const char* newEntry)
373 \brief Rename a data label.
375 \param oldEntry The name of the label you want to rename.
376 \param newEntry The new name of the data entry.
378 \returns A status code, \c B_OK on success or an error code.
379 \retval B_OK Renaming succeeded.
380 \retval B_BAD_VALUE Either the \a oldEntry or the
381 \a newEntry pointers are \c NULL.
382 \retval B_NAME_NOT_FOUND There is no data associated with the label
401 \fn bool BMessage::WasDelivered() const
402 \brief Check if this message was delivered through the delivery methods.
404 If this message is passed via a BMessenger or BLooper::PostMessage(), this
405 method will return \c true.
407 \warning This method should not be abused by a thread that sends a message
408 to track whether or not a message was delivered. This is because
409 the ownership of the message goes to the receiving looper, which
410 will delete the message as soon as it is done with it.
412 \warning If you need to check whether a message is delivered, you should
413 either ask for a reply, or use one of the synchronous
414 BMessenger::SendMessage() methods.
421 \fn bool BMessage::IsSourceWaiting() const
422 \brief Check if the sender expects a reply.
424 This method will return \c true, if the sender flagged that it is waiting
425 for a reply, and such a reply has not yet been sent.
432 \fn bool BMessage::IsSourceRemote() const
433 \brief Check if the message is sent by another application.
440 \fn BMessenger BMessage::ReturnAddress() const
441 \brief Get a messenger that points to the sender of the message.
443 Using this method, you can fetch a BMessenger that can be used to deliver
444 replies to this message. This method works both for local and remote
447 For remote deliveries, this approach is preferred over sending the reply
448 using a standard BMessenger that is created with the signature of the
449 application. A standard BMessenger sends the messages to the main BLooper
450 of the application, the BApplication object. With the delivery data stored
451 in the messages, the reply using this messenger will be directed at a
452 specific looper that is able to handle the replies.
454 If this method is called on a message that has not been delivered (yet),
455 it will return an empty BMessenger object.
462 \fn const BMessage* BMessage::Previous() const
463 \brief Get the message to which this message is a reply.
465 \return Returns a new BMessage with the same data stuctures as the message
466 to which this message is a reply. You get the ownership of this
467 message, so free it when you're done. If this message isn't a
468 reply to another message, this method will return \c NULL.
475 \fn bool BMessage::WasDropped() const
476 \brief Check if the message was delivered through 'drag and drop'.
478 \return This method returns \c true if the message has been delivered
479 through drag and drop. It returns \c false if it has been delivered
480 through the regular messaging functions, or if the message has not
481 been delivered at all.
490 \fn BPoint BMessage::DropPoint(BPoint* offset) const
491 \brief Get the coordinates of the drop point of the message.
493 If the message has been delivered because of drag and drop, which can be
494 verified with the WasDropped() method, this method will return a BPoint to
495 where exactly the drop off was made.
497 Because drop messages are delivered to the BWindow in which they were
498 dropped, and BWindow is a subclass of BLooper, you can use BWindow to
499 determine based on the location, how you should react to it.
501 If this message was not delivered through drag and drop, it will return
522 \fn status_t BMessage::SendReply(uint32 command, BHandler* replyTo)
523 \brief Asynchronously send a reply to this message.
525 This is an overloaded member of
526 SendReply(BMessage*, BMessenger, bigtime_t). Use this variant if you
527 want to send a message without data members.
534 \fn status_t BMessage::SendReply(BMessage* reply, BHandler* replyTo,
536 \brief Asynchronously send a reply to this message.
538 This is an overloaded member of SendReply(BMessage*, BMessenger, bigtime_t).
539 Use this variant if you want to send the message to a specific handler
540 (instead of a complete messenger).
547 \fn status_t BMessage::SendReply(BMessage* reply, BMessenger replyTo,
549 \brief Asynchronously send a reply to this message.
551 This method sends a reply to this message to the sender. On your turn,
552 you specify a messenger that handles a reply back to the message you
553 specify as the \a reply argument. You can set a timeout for the
554 message to be delivered. This method blocks until the message has been
555 received, or the \a timeout has been reached.
557 \param reply The message that is in reply to this message.
558 \param replyTo In case the receiver needs to reply to the message you are
559 sending, you can specify the return address with this argument.
560 \param timeout The maximum time in microseconds this delivery may take. The
561 \a timeout is a relative timeout. You can also use
562 \c B_INFINITE_TIMEOUT if you want to wait infinitely for the message
565 \returns A status code, \c B_OK on success or an error code.
566 \retval B_OK The message has been delivered.
567 \retval B_DUPLICATE_REPLY There already has been a reply to this message.
568 \retval B_BAD_PORT_ID The reply address is not valid (anymore).
569 \retval B_WOULD_BLOCK The delivery \a timeout was
570 \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when
571 trying to deliver the message.
572 \retval B_TIMED_OUT The timeout expired while trying to deliver the
575 \see SendReply(uint32 command, BHandler* replyTo)
582 \fn status_t BMessage::SendReply(uint32 command, BMessage* replyToReply)
583 \brief Synchronously send a reply to this message, and wait for a reply
586 This is an overloaded member of
587 SendReply(BMessage*, BMessage*, bigtime_t, bigtime_t)
588 Use this variant if you want to send a message without data members.
595 \fn status_t BMessage::SendReply(BMessage* reply, BMessage* replyToReply,
596 bigtime_t sendTimeout, bigtime_t replyTimeout)
597 \brief Synchronously send a reply to this message, and wait for a reply
600 This method sends a reply to this message to the sender. The
601 \a reply is delivered, and then the method waits for a reply from
602 the receiver. If a reply is received, that reply is copied into the
603 \a replyToReply argument.
604 If the message was delivered properly, but the receiver did not reply
605 within the specified \a replyTimeout, the \a what member of
606 \a replyToReply will be set to \c B_NO_REPLY.
608 \param reply The message that is in reply to this message.
609 \param[out] replyToReply The reply is copied into this argument.
610 \param sendTimeout The maximum time in microseconds this delivery may take.
611 The \a timeout is a relative timeout. You can also use
612 \c B_INFINITE_TIMEOUT if you want to wait infinitely for the message
614 \param replyTimeout The maximum time in microseconds you want to wait for a
615 reply. Note that the timer starts when the message has been
618 \returns A status code, \c B_OK on success or an error code.
619 \retval B_OK The message has been delivered.
620 \retval B_DUPLICATE_REPLY There already has been a reply to this message.
621 \retval B_BAD_VALUE Either \a reply or \a replyToReply is \c NULL.
622 \retval B_BAD_PORT_ID The reply address is not valid (anymore).
623 \retval B_WOULD_BLOCK The delivery \a timeout was
624 \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when
625 trying to deliver the message.
626 \retval B_TIMED_OUT The timeout expired while trying to deliver the
628 \retval B_NO_MORE_PORTS All reply ports are in use.
630 \see SendReply(uint32 command, BMessage* replyToReply)
642 Because of historical reasons and for binary compatibility, this class
643 provides a flattening API without inheriting the BFlattenable class. The
644 API is more or less the same, but you are inconvenienced when you want to
645 use messages in methods that handle BFlattenable objects.
653 \fn ssize_t BMessage::FlattenedSize() const
654 \brief Return the size in bytes required when you want to flatten this
655 message to a stream of bytes.
662 \fn status_t BMessage::Flatten(char* buffer, ssize_t size) const
663 \brief Flatten the message to a \a buffer.
665 \param buffer The buffer to write the data to.
666 \param size The size of the buffer.
668 \return \c B_OK in case of success, or an error code in case something
671 \warning Make sure the buffer is large enough to hold the message. This
672 method does not double-check for you!
675 \see Flatten(BDataIO* stream, ssize_t* size) const
682 \fn status_t BMessage::Flatten(BDataIO* stream, ssize_t* size) const
683 \brief Flatten the message to a \a stream.
685 \param[in] stream The stream to flatten the message to.
686 \param[out] size The method writes the number of bytes actually written
688 \return \c B_OK in case of success, or an error code in case something
691 \warning Make sure the subclass of the BDataIO interface either protects
692 against buffer overwrites, or check if the number of bytes that
693 is going to be written isn't larger than it can handle.
696 \see Flatten(char* buffer, ssize_t size) const
703 \fn status_t BMessage::Unflatten(const char* flatBuffer)
704 \brief Unflatten a message from a buffer and put it into the current
707 This action clears the current contents of the message.
709 \param flatBuffer The buffer that contains the message.
711 \returns A status code, \c B_OK on success or an error code.
712 \retval B_OK The buffer has been unflattened.
713 \retval B_BAD_VALUE The buffer does not contain a valid message.
714 \retval B_NO_MEMORY An error occured whilst allocating memory for the data
717 \see Flatten(char* buffer, ssize_t size) const
718 \see Unflatten(BDataIO* stream)
725 \fn status_t BMessage::Unflatten(BDataIO* stream)
726 \brief Unflatten a message from a stream and put it into the current
729 This action clears the current contents of the message.
731 \param stream The stream that contains the message.
733 \returns A status code, \c B_OK on success or an error code.
734 \retval B_OK The message has been unflattened.
735 \retval B_BAD_VALUE The stream does not contain a valid message.
736 \retval B_NO_MEMORY An error occured whilst allocating memory for the
739 \see Flatten(BDataIO* stream, ssize_t* size) const
740 \see Unflatten(const char*)
750 \name Specifiers (Scripting)
758 \fn status_t BMessage::AddSpecifier(const char* property)
766 \fn status_t BMessage::AddSpecifier(const char* property, int32 index)
774 \fn status_t BMessage::AddSpecifier(const char* property, int32 index,
783 \fn status_t BMessage::AddSpecifier(const char* property, const char* name)
791 \fn status_t BMessage::AddSpecifier(const BMessage* specifier)
799 \fn status_t BMessage::SetCurrentSpecifier(int32 index)
807 \fn status_t BMessage::GetCurrentSpecifier(int32* index,
808 BMessage* specifier, int32* what, const char** property) const
816 \fn bool BMessage::HasSpecifiers() const
824 \fn status_t BMessage::PopSpecifier()
843 \fn status_t BMessage::AddData(const char* name, type_code type,
844 const void* data, ssize_t numBytes, bool isFixedSize, int32 count)
845 \brief Add \a data of a certain \a type to the message.
847 The amount of \a numBytes is copied into the message. The data is
848 stored at the label specified in \a name. You are responsible for
849 specifying the correct \a type. The Haiku API already specifies
850 many constants, such as \c B_FLOAT_TYPE or \c B_RECT_TYPE. See
851 TypeConstants.h for more information on the system-wide defined types.
853 If the field with the \a name already exists, the data is added in
854 an array-like form. If you are adding a certain \a name for the
855 first time, you are able to specify some properties of this array. You can
856 fix the size of each data entry, and you can also instruct BMessage to
857 allocate a \a count of items. The latter does not mean that the
858 number of items is fixed; the array will grow nonetheless. Also, note that
859 every \a name can only be associated with one \a type of
862 If consecutive method calls specify a different \a type than the
863 initial, these calls will fail.
865 There is no limit to the number of labels, or the amount of data, but
866 note that searching of data members is linear, as well as that some
867 messages will be copied whilst being passed around, so if the amount of
868 data you need to pass is too big, find another way to pass it.
870 \param name The label to which this data needs to be associated. If the
871 \a name already exists, the new data will be added in an
873 \param type The type of data. If you are adding data to the same
874 \a name, make sure it is the same type.
875 \param data The data buffer to copy the bytes from.
876 \param numBytes The number of bytes to be copied. If this is the first
877 call to this method for this type of data, and you set
878 \a isFixedSize to \c true, this will specify the size of all
879 consecutive calls to this method.
880 \param isFixedSize If this is the first call to this method with this
881 \a name, you can specify the whether or not all items in this
882 array should have the same fixed size.
883 \param count If this is the first call to this method with this
884 \a name, you can instruct this message to allocate a number of
885 items in advance. This does not limit the amount of items though.
886 The array will grow if needed.
888 \returns A status code, \c B_OK on success or an error code.
889 \retval B_OK The \a data is succesfully added.
890 \retval B_BAD_VALUE The \a numBytes is less than, or equal to \c 0,
891 or the size of this item is larger than the \a name allows,
892 since it has been specified to have a fixed size.
893 \retval B_ERROR There was an error whilst creating the label with
895 \retval B_BAD_TYPE The \a type you specified is different than the
896 one already associated with \a name.
903 \fn status_t BMessage::AddRect(const char* name, BRect aRect)
904 \brief Convenience method to add a BRect to the label \a name.
906 This method calls AddData() with the \c B_RECT_TYPE \a type.
908 \param name The label to associate the data with.
909 \param aRect The rectangle to store in the message.
911 \returns A status code, \c B_OK on success or an error code.
913 \see AddData() for a more detailed overview of the inner workings.
923 \fn status_t BMessage::AddPoint(const char* name, BPoint aPoint)
924 \brief Convenience method to add a BPoint to the label \a name.
926 This method calls AddData() with the \c B_POINT_TYPE \a type.
928 \param name The label to associate the data with.
929 \param aPoint The point to store in the message.
931 \returns A status code, \c B_OK on success or an error code.
933 \see AddData() for a more detailed overview of the inner workings.
943 \fn status_t BMessage::AddString(const char* name, const char* aString)
944 \brief Convenience method to add a C-string to the label \a name.
946 This method calls AddData() with the \c B_STRING_TYPE \a type.
948 \param name The label to associate the data with.
949 \param aString The string to copy to the message.
951 \returns A status code, \c B_OK on success or an error code.
953 \see AddData() for a more detailed overview of the inner workings.
963 \fn status_t BMessage::AddString(const char* name, const BString& aString)
964 \brief Convenience method to add a BString to the label \a name.
966 This method calls AddData() with the \c B_STRING_TYPE \a type.
968 \param name The label to associate the data with.
969 \param aString The string to copy to the message.
971 \returns A status code, \c B_OK on success or an error code.
973 \see AddData() for a more detailed overview of the inner workings.
983 \fn status_t BMessage::AddInt8(const char* name, int8 value)
984 \brief Convenience method to add an \c int8 to the label \a name.
986 This method calls AddData() with the \c B_INT8_TYPE \a type.
988 \param name The label to associate the data with.
989 \param value The value to store in the message.
991 \returns A status code, \c B_OK on success or an error code.
993 \see AddData() for a more detailed overview of the inner workings.
1003 \fn status_t BMessage::AddInt16(const char* name, int16 value)
1004 \brief Convenience method to add an \c int16 to the label \a name.
1006 This method calls AddData() with the \c B_INT16_TYPE \a type.
1008 \param name The label to associate the data with.
1009 \param value The value to store in the message.
1011 \returns A status code, \c B_OK on success or an error code.
1013 \see AddData() for a more detailed overview of the inner workings.
1023 \fn status_t BMessage::AddInt32(const char* name, int32 value)
1024 \brief Convenience method to add an \c int32 to the label \a name.
1026 This method calls AddData() with the \c B_INT32_TYPE \a type.
1028 \param name The label to associate the data with.
1029 \param value The value to store in the message.
1031 \returns A status code, \c B_OK on success or an error code.
1033 \see AddData() for a more detailed overview of the inner workings.
1043 \fn status_t BMessage::AddInt64(const char* name, int64 value)
1044 \brief Convenience method to add an \c int64 to the label \a name.
1046 This method calls AddData() with the \c B_INT64_TYPE \a type.
1048 \param name The label to associate the data with.
1049 \param value The value to store in the message.
1051 \returns A status code, \c B_OK on success or an error code.
1053 \see AddData() for a more detailed overview of the inner workings.
1063 \fn status_t BMessage::AddBool(const char* name, bool aBoolean)
1064 \brief Convenience method to add a \c bool to the label \a name.
1066 This method calls AddData() with the \c B_BOOL_TYPE \a type.
1068 \param name The label to associate the data with.
1069 \param aBoolean The value to store in the message.
1071 \returns A status code, \c B_OK on success or an error code.
1073 \see AddData() for a more detailed overview of the inner workings.
1083 \fn status_t BMessage::AddFloat(const char* name, float aFloat)
1084 \brief Convenience method to add a \c float to the label \a name.
1086 This method calls AddData() with the \c B_FLOAT_TYPE \a type.
1088 \param name The label to associate the data with.
1089 \param aFloat The value to store in the message.
1091 \returns A status code, \c B_OK on success or an error code.
1093 \see AddData() for a more detailed overview of the inner workings.
1103 \fn status_t BMessage::AddDouble(const char* name, double aDouble)
1104 \brief Convenience method to add a \c double to the label \a name.
1106 This method calls AddData() with the \c B_DOUBLE_TYPE \a type.
1108 \param name The label to associate the data with.
1109 \param aDouble The value to store in the message.
1111 \returns A status code, \c B_OK on success or an error code.
1113 \see AddData() for a more detailed overview of the inner workings.
1116 \see ReplaceDouble()
1123 \fn status_t BMessage::AddColor(const char* name, rgb_color aColor)
1124 \brief Convenience method to add a \c rgb_color to the label \a name.
1126 This method calls AddData() with the \c B_RGB_32_BIT_TYPE \a type.
1128 \param name The label to associate the data with.
1129 \param aColor The value to store in the message.
1131 \returns A status code, \c B_OK on success or an error code.
1133 \see AddColor() for a more detailed overview of the inner workings.
1143 \fn status_t BMessage::AddPointer(const char* name, const void* aPointer)
1144 \brief Convenience method to add a \c pointer to the label \a name.
1146 This method calls AddData() with the \c B_POINTER_TYPE \a type.
1148 \warning If you want to share objects between applications, remember
1149 that each application has its own address space, and that it
1150 therefore is useless to try to pass around objects by sending
1151 pointers in messages. You should think about copying the
1152 entire object in the message, or you should consider using
1155 \param name The label to associate the data with.
1156 \param aPointer The value to store in the message.
1158 \returns A status code, \c B_OK on success or an error code.
1160 \see AddData() for a more detailed overview of the inner workings.
1162 \see ReplacePointer()
1169 \fn status_t BMessage::AddMessenger(const char* name, BMessenger messenger)
1170 \brief Convenience method to add a messenger to the label \a name.
1172 This method calls AddData() with the \c B_MESSENGER_TYPE \a type.
1174 \param name The label to associate the data with.
1175 \param messenger The messenger to store in the message.
1177 \returns A status code, \c B_OK on success or an error code.
1179 \see AddData() for a more detailed overview of the inner workings.
1180 \see FindMessenger()
1181 \see ReplaceMessenger()
1188 \fn status_t BMessage::AddRef(const char* name, const entry_ref* ref)
1189 \brief Convenience method to add an \c entry_ref to the label
1192 This method calls AddData() with the \c B_REF_TYPE \a type.
1194 \param name The label to associate the data with.
1195 \param ref The reference to store in the message.
1197 \returns A status code, \c B_OK on success or an error code.
1199 \see AddData() for a more detailed overview of the inner workings.
1208 \fn status_t BMessage::AddMessage(const char* name,
1209 const BMessage* message)
1210 \brief Convenience method to add a message to the label \a name.
1212 This method calls AddData() with the \c B_MESSAGE_TYPE \a type.
1214 \param name The label to associate the data with.
1215 \param message The message to store in this message.
1217 \returns A status code, \c B_OK on success or an error code.
1219 \see AddData() for a more detailed overview of the inner workings.
1221 \see ReplaceMessage()
1228 \fn status_t BMessage::AddFlat(const char* name, BFlattenable* object,
1230 \brief Convenience method to add a flattenable to the label \a name.
1232 This method uses BFlattenable::TypeCode() to determine the type. It also
1233 uses BFlattenable::IsFixedSize() to determine whether or not the size of
1234 the object is supposedly always the same. You can specify a
1235 \a count, to pre-allocate more entries if you are going to add
1236 more than one of this type.
1238 \param name The label to associate the data with.
1239 \param object The object to flatten into the message.
1240 \param count The number of items to pre-allocate associated with this
1243 \returns A status code, \c B_OK on success or an error code.
1245 \see AddData() for a more detailed overview of the inner workings.
1265 \fn status_t BMessage::RemoveData(const char* name, int32 index)
1266 \brief Remove data associated with \a name at a specified
1269 If this is the only instance of the data, then the entire label will be
1270 removed. This means you can recreate it with another type.
1272 \param name The \a name of which the associated data should be cleared.
1273 \param index The \a index of the item that should be cleared.
1275 \returns A status code, \c B_OK on success or an error code.
1276 \retval B_OK The data has been removed.
1277 \retval B_BAD_VALUE The \a index is less than \c 0.
1278 \retval B_BAD_INDEX The \a index is out of bounds.
1279 \retval B_NAME_NOT_FOUND The \a name does not have any data associated
1290 \fn status_t BMessage::RemoveName(const char* name)
1291 \brief Remove all data associated with a \a name.
1293 This also removes the label, so that you can recreate it with another type,
1296 \param name The \a name that refers to the data you want to clear out.
1298 \returns A status code, \c B_OK on success or an error code.
1299 \retval B_OK All the data is removed.
1300 \retval B_BAD_VALUE The \a name pointer points to \c NULL.
1301 \retval B_NAME_NOT_FOUND The \a name does not exist in this message.
1311 \fn status_t BMessage::MakeEmpty()
1312 \brief Clear all data and metadata in this message.
1314 Everything is cleared out, all labels and all associated data, as well
1315 as metadata such as reply info.
1317 \return This method always returns \c B_OK.
1332 Look at FindData() for a general introduction to finding data.
1339 <tr><th>Type of data</th><th>Type code</th><th>Method</td></tr>
1340 <tr><td>BRect</td><td>\c B_RECT_TYPE</td><td>FindRect()</td></tr>
1349 \fn status_t BMessage::FindData(const char* name, type_code type,
1350 int32 index, const void** data, ssize_t* numBytes) const
1351 \brief Find \a data that is stored in this message at an
1354 This method matches the label \a name with the \a type you
1355 are asking for, and it looks for the data that is stored at a certain
1356 \a index number. If all these things match, you will get a pointer
1357 to the internal buffer, and the method will put the size of the item in
1360 Note that only this method, and FindString(const char*, const char**),
1361 pass a pointer to the internal buffer. The other more specific methods,
1362 such as FindBool() and FindRect() copy the data into a buffer you specify.
1363 This means that the data retrieved with this method is valid until the
1366 \param name The label the data should be associated with.
1367 \param type The type of data you want to retrieve. You can pass
1368 \c B_ANY_TYPE if you don't mind which type the data is.
1369 \param index The index in the array of the data that you want to retrieve.
1370 Note that the array is zero-based.
1371 \param[out] data A pointer to a pointer where the data can point to.
1372 \param[out] numBytes The size of the data will be put in this parameter.
1374 \returns A status code, \c B_OK on success or an error code.
1375 \retval B_OK The \a name was found, matches the type, and the data
1376 at \a index has been put in \a data.
1377 \retval B_BAD_VALUE One of the output arguments were \c NULL.
1378 \retval B_BAD_INDEX The \a index does not exist.
1379 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1381 \see status_t FindData(const char*, type_code, int32,
1382 const void**, ssize_t*) const
1389 \fn status_t BMessage::FindData(const char* name, type_code type,
1390 const void** data, ssize_t* numBytes) const
1391 \brief Find \a data that is stored in this message.
1393 This is an overloaded version of
1394 FindData(const char*, type_code, int32, const void**, ssize_t*) const
1395 where data is sought at \a index \c 0.
1402 \fn status_t BMessage::FindRect(const char* name, BRect* rect) const
1403 \brief Find a rectangle at the label \a name.
1405 This is an overloaded version of
1406 FindRect(const char*, int32, BRect*) const
1407 where the data is sought at \a index \c 0.
1414 \fn status_t BMessage::FindRect(const char* name, int32 index,
1416 \brief Find a rectangle at the label \a name at an \a index.
1418 This method looks for the data with the \c B_RECT_TYPE, and copies it into
1421 \param name The label to which the data is associated.
1422 \param index The index from which the data should be copied.
1423 \param rect The object in which the data should be copied.
1425 \returns A status code, \c B_OK on success or an error code.
1426 \retval B_OK The object now contains the requested data.
1427 \retval B_BAD_INDEX The \a index does not exist.
1428 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1430 \see FindRect(const char*, BRect*) const
1437 \fn status_t BMessage::FindPoint(const char* name, BPoint* point) const
1438 \brief Find a point at the label \a name.
1440 This is an overloaded version of
1441 FindPoint(const char*, int32, BPoint*) const
1442 where the data is sought at \a index \c 0.
1449 \fn status_t BMessage::FindPoint(const char* name, int32 index,
1450 BPoint* point) const
1451 \brief Find a point at the label \a name at an \a index.
1453 This method looks for the data with the \c B_POINT_TYPE, and copies it into
1456 \param name The label to which the data is associated.
1457 \param index The index from which the data should be copied.
1458 \param point The object in which the data should be copied.
1460 \returns A status code, \c B_OK on success or an error code.
1461 \retval B_OK The object now contains the requested data.
1462 \retval B_BAD_INDEX The \a index does not exist.
1463 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1465 \see FindPoint(const char*, BPoint*) const
1472 \fn status_t BMessage::FindString(const char* name,
1473 const char** string) const
1474 \brief Find a string at the label \a name.
1476 This is an overloaded version of
1477 FindString(const char*, int32, const char**) const
1478 where the data is sought at \a index \c 0.
1485 \fn status_t BMessage::FindString(const char* name, int32 index,
1486 const char** string) const
1487 \brief Find a string at the label \a name at an \a index.
1489 This method looks for the data with the \c B_STRING_TYPE, and returns a
1490 pointer to the internal buffer of the message. Note that this pointer is
1491 valid, until the message is deleted.
1493 \param name The label to which the data is associated.
1494 \param index The index from which the data should be copied.
1495 \param string The object in which the data should be copied.
1497 \returns A status code, \c B_OK on success or an error code.
1498 \retval B_OK The object now contains the requested data.
1499 \retval B_BAD_INDEX The \a index does not exist.
1500 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1502 \see FindString(const char*, const char**) const
1503 \see FindString(const char*, int32, BString*) const
1510 \fn status_t BMessage::FindString(const char* name, BString* string) const
1511 \brief Find a string at the label \a name.
1513 This is an overloaded version of
1514 FindString(const char*, int32, BString*) const
1515 where the data is sought at \a index \c 0.
1522 \fn status_t BMessage::FindString(const char* name, int32 index,
1523 BString* string) const
1524 \brief Find a string at the label \a name at an \a index.
1526 This method looks for the data with the \c B_STRING_TYPE, and copies it
1527 into the \a string object.
1529 \param name The label to which the data is associated.
1530 \param index The index from which the data should be copied.
1531 \param string The object in which the data should be copied.
1533 \returns A status code, \c B_OK on success or an error code.
1534 \retval B_OK The object now contains the requested data.
1535 \retval B_BAD_INDEX The \a index does not exist.
1536 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1538 \see FindString(const char*, BString*) const
1539 \see FindString(const char*, int32, const char**) const
1546 \fn status_t BMessage::FindInt8(const char* name, int8* value) const
1547 \brief Find an integer at the label \a name.
1549 This is an overloaded version of
1550 FindInt8(const char*, int32, int8*) const
1551 where the data is sought at \a index \c 0.
1558 \fn status_t BMessage::FindInt8(const char* name, int32 index,
1560 \brief Find an integer at the label \a name at an \a index.
1562 This method looks for the data with the \c B_INT8_TYPE, and copies it into
1565 \param name The label to which the data is associated.
1566 \param index The index from which the data should be copied.
1567 \param value The object in which the data should be copied.
1569 \returns A status code, \c B_OK on success or an error code.
1570 \retval B_OK The object now contains the requested data.
1571 \retval B_BAD_INDEX The \a index does not exist.
1572 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1574 \see FindInt8(const char*, int8*) const
1581 \fn status_t BMessage::FindInt16(const char* name, int16* value) const
1582 \brief Find an integer at the label \a name.
1584 This is an overloaded version of FindInt8(const char*, int32, int16*) const
1585 where the data is sought at \a index \c 0.
1587 \param name The label to which the data is associated.
1588 \param value The object in which the data should be copied.
1590 \returns A status code, \c B_OK on success or an error code.
1591 \retval B_OK The object now contains the requested data.
1592 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1599 \fn status_t BMessage::FindInt16(const char* name, int32 index,
1601 \brief Find an integer at the label \a name at an \a index.
1603 This method looks for the data with the \c B_INT16_TYPE, and copies it into
1606 \param name The label to which the data is associated.
1607 \param index The index from which the data should be copied.
1608 \param value The object in which the data should be copied.
1610 \returns A status code, \c B_OK on success or an error code.
1611 \retval B_OK The object now contains the requested data.
1612 \retval B_BAD_INDEX The \a index does not exist.
1613 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1615 \see FindInt16(const char*, int16*) const
1622 \fn status_t BMessage::FindInt32(const char* name, int32* value) const
1623 \brief Find an integer at the label \a name.
1625 This is an overloaded version of
1626 FindInt32(const char*, int32, int32*) const
1627 where the data is sought at \a index \c 0.
1629 \param name The label to which the data is associated.
1630 \param value The object in which the data should be copied.
1632 \returns A status code, \c B_OK on success or an error code.
1633 \retval B_OK The object now contains the requested data.
1634 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1641 \fn status_t BMessage::FindInt32(const char* name, int32 index,
1643 \brief Find an integer at the label \a name at an \a index.
1645 This method looks for the data with the \c B_INT32_TYPE, and copies
1646 it into a provided buffer.
1648 \param name The label to which the data is associated.
1649 \param index The index from which the data should be copied.
1650 \param value The object in which the data should be copied.
1652 \returns A status code, \c B_OK on success or an error code.
1653 \retval B_OK The object now contains the requested data.
1654 \retval B_BAD_INDEX The \a index does not exist.
1655 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1657 \see FindInt32(const char*, int32*) const
1664 \fn status_t BMessage::FindInt64(const char* name, int64* value) const
1665 \brief Find an integer at the label \a name.
1667 This is an overloaded version of
1668 FindInt64(const char*, int32, int64*) const
1669 where the data is sought at \a index \c 0.
1671 \param name The label to which the data is associated.
1672 \param value The object in which the data should be copied.
1674 \returns A status code, \c B_OK on success or an error code.
1675 \retval B_OK The object now contains the requested data.
1676 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1683 \fn status_t BMessage::FindInt64(const char* name, int32 index,
1685 \brief Find an integer at the label \a name at an \a index.
1687 This method looks for the data with the \c B_INT64_TYPE, and copies
1688 it into a provided buffer.
1690 \param name The label to which the data is associated.
1691 \param index The index from which the data should be copied.
1692 \param value The object in which the data should be copied.
1694 \returns A status code, \c B_OK on success or an error code.
1695 \retval B_OK The object now contains the requested data.
1696 \retval B_BAD_INDEX The \a index does not exist.
1697 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1699 \see FindInt64(const char*, int64*) const
1706 \fn status_t BMessage::FindBool(const char* name, bool* value) const
1707 \brief Find a boolean at the label \a name.
1709 This is an overloaded version of
1710 FindBool(const char*, int32, bool*) const
1711 where the data is sought at \a index \c 0.
1713 \param name The label to which the data is associated.
1714 \param value The object in which the data should be copied.
1716 \returns A status code, \c B_OK on success or an error code.
1717 \retval B_OK The object now contains the requested data.
1718 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1725 \fn status_t BMessage::FindBool(const char* name, int32 index,
1727 \brief Find a boolean at the label \a name at an \a index.
1729 This method looks for the data with the \c B_BOOL_TYPE, and copies it into
1732 \param name The label to which the data is associated.
1733 \param index The index from which the data should be copied.
1734 \param value The object in which the data should be copied.
1736 \returns A status code, \c B_OK on success or an error code.
1737 \retval B_OK The object now contains the requested data.
1738 \retval B_BAD_INDEX The \a index does not exist.
1739 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1741 \see FindBool(const char*, bool*) const
1748 \fn status_t BMessage::FindFloat(const char* name, float* value) const
1749 \brief Find a float at the label \a name.
1751 This is an overloaded version of
1752 FindFloat(const char*, int32, float*) const
1753 where the data is sought at \a index \c 0.
1755 \param name The label to which the data is associated.
1756 \param value The object in which the data should be copied.
1758 \returns A status code, \c B_OK on success or an error code.
1759 \retval B_OK The object now contains the requested data.
1760 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1767 \fn status_t BMessage::FindFloat(const char* name, int32 index,
1769 \brief Find a float at the label \a name at an \a index.
1771 This method looks for the data with the \c B_FLOAT_TYPE, and copies
1772 it into a provided buffer.
1774 \param name The label to which the data is associated.
1775 \param index The index from which the data should be copied.
1776 \param value The object in which the data should be copied.
1778 \returns A status code, \c B_OK on success or an error code.
1779 \retval B_OK The object now contains the requested data.
1780 \retval B_BAD_INDEX The \a index does not exist.
1781 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1783 \see FindFloat(const char*, float*) const
1790 \fn status_t BMessage::FindDouble(const char* name, double* value) const
1791 \brief Find a double at the label \a name.
1793 This is an overloaded version of
1794 FindDouble(const char*, int32, double*) const
1795 where the data is sought at \a index \c 0.
1797 \param name The label to which the data is associated.
1798 \param value The object in which the data should be copied.
1800 \returns A status code, \c B_OK on success or an error code.
1801 \retval B_OK The object now contains the requested data.
1802 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1809 \fn status_t BMessage::FindDouble(const char* name, int32 index,
1810 double* value) const
1811 \brief Find a double at the label \a name at an \a index.
1813 This method looks for the data with the \c B_DOUBLE_TYPE, and copies it into
1816 \param name The label to which the data is associated.
1817 \param index The index from which the data should be copied.
1818 \param value The object in which the data should be copied.
1820 \returns A status code, \c B_OK on success or an error code.
1821 \retval B_OK The object now contains the requested data.
1822 \retval B_BAD_INDEX The \a index does not exist.
1823 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1825 \see FindDouble(const char*, double*) const
1832 \fn status_t BMessage::FindColor(const char* name, rgb_color* value) const
1833 \brief Find a color with the label \a name.
1835 This is an overloaded version of
1836 FindColor(const char*, int32, rgb_color*) const
1837 where the data is sought at \a index \c 0.
1839 \param name The label to which the data is associated.
1840 \param value The object in which the data should be copied.
1842 \returns A status code, \c B_OK on success or an error code.
1843 \retval B_OK The object now contains the requested data.
1844 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1851 \fn status_t BMessage::FindColor(const char* name, int32 index,
1852 rgb_color* value) const
1853 \brief Find a color at the label \a name at an \a index.
1855 This method looks for the data with the \c B_RGB_32_BIT_TYPE, and copies
1856 it into a provided buffer.
1858 \param name The label to which the data is associated.
1859 \param index The index from which the data should be copied.
1860 \param value The object in which the data should be copied.
1862 \returns A status code, \c B_OK on success or an error code.
1863 \retval B_OK The object now contains the requested data.
1864 \retval B_BAD_INDEX The \a index does not exist.
1865 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1867 \see FindColor(const char*, rgb_color*) const
1874 \fn status_t BMessage::FindPointer(const char* name, void** pointer) const
1875 \brief Find a pointer at the label \a name.
1877 This is an overloaded version of
1878 FindPointer(const char*, int32, void*) const
1879 where the data is sought at \a index \c 0.
1881 \param name The label to which the data is associated.
1882 \param pointer The object in which the data should be copied.
1884 \returns A status code, \c B_OK on success or an error code.
1885 \retval B_OK The object now contains the requested data.
1886 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1893 \fn status_t BMessage::FindPointer(const char* name, int32 index,
1894 void** pointer) const
1895 \brief Find a pointer at the label \a name at an \a index.
1897 This method looks for the data with the \c B_POINTER_TYPE, and copies
1898 it into a provided buffer.
1900 \warning If you want to share objects between applications, remember
1901 that each application has its own address space, and that it
1902 therefore is useless to try to pass around objects by sending
1903 pointers in messages. You should think about copying the entire
1904 object in the message, or you should consider using shared memory.
1906 \param name The label to which the data is associated.
1907 \param index The index from which the data should be copied.
1908 \param pointer The object in which the data should be copied.
1910 \returns A status code, \c B_OK on success or an error code.
1911 \retval B_OK The object now contains the requested data.
1912 \retval B_BAD_INDEX The \a index does not exist.
1913 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1915 \see FindPointer(const char*, void*) const
1922 \fn status_t BMessage::FindMessenger(const char* name,
1923 BMessenger* messenger) const
1924 \brief Find a messenger at the label \a name.
1926 This is an overloaded version of
1927 FindMessenger(const char*, int32, BMessenger*) const
1928 where the data is sought at \a index \c 0.
1930 \param name The label to which the data is associated.
1931 \param messenger The object in which the data should be copied.
1933 \returns A status code, \c B_OK on success or an error code.
1934 \retval B_OK The object now contains the requested data.
1935 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1942 \fn status_t BMessage::FindMessenger(const char* name, int32 index,
1943 BMessenger* messenger) const
1944 \brief Find a messenger at the label \a name at an \a index.
1946 This method looks for the data with the \c B_MESSENGER_TYPE, and copies it
1947 into a provided buffer.
1949 \param name The label to which the data is associated.
1950 \param index The index from which the data should be copied.
1951 \param messenger The object in which the data should be copied.
1953 \returns A status code, \c B_OK on success or an error code.
1954 \retval B_OK The object now contains the requested data.
1955 \retval B_BAD_INDEX The \a index does not exist.
1956 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1958 \see FindMessenger(const char*, BMessenger*) const
1965 \fn status_t BMessage::FindRef(const char* name, entry_ref* ref) const
1966 \brief Find a reference to a file at the label \a name.
1968 This is an overloaded version of
1969 FindRef(const char*, int32, entry_ref*) const
1970 where the data is sought at \a index \c 0.
1972 \param name The label to which the data is associated.
1973 \param ref The object in which the data should be copied.
1975 \returns A status code, \c B_OK on success or an error code.
1976 \retval B_OK The object now contains the requested data.
1977 \retval B_NAME_NOT_FOUND There is no field with this \a name.
1984 \fn status_t BMessage::FindRef(const char* name, int32 index,
1985 entry_ref* ref) const
1986 \brief Find a reference to a file at the label \a name at an
1989 This method looks for the data with the \c B_REF_TYPE, and copies it into
1992 \param name The label to which the data is associated.
1993 \param index The index from which the data should be copied.
1994 \param ref The object in which the data should be copied.
1996 \returns A status code, \c B_OK on success or an error code.
1997 \retval B_OK The object now contains the requested data.
1998 \retval B_BAD_INDEX The \a index does not exist.
1999 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2001 \see FindRef(const char*, entry_ref*) const
2008 \fn status_t BMessage::FindMessage(const char* name,
2009 BMessage* message) const
2010 \brief Find a message at the label \a name.
2012 This is an overloaded version of
2013 FindMessage(const char*, int32, BMessage*) const
2014 where the data is sought at \a index \c 0.
2016 \param name The label to which the data is associated.
2017 \param message The object in which the data should be copied.
2019 \returns A status code, \c B_OK on success or an error code.
2020 \retval B_OK The object now contains the requested data.
2021 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2028 \fn status_t BMessage::FindMessage(const char* name, int32 index,
2029 BMessage* message) const
2030 \brief Find a message at the label \a name at an \a index.
2032 This method looks for the data with the \c B_MESSAGE_TYPE, and
2033 copies it into a provided buffer.
2035 \param name The label to which the data is associated.
2036 \param index The index from which the data should be copied.
2037 \param message The object in which the data should be copied.
2039 \returns A status code, \c B_OK on success or an error code.
2040 \retval B_OK The object now contains the requested data.
2041 \retval B_BAD_INDEX The \a index does not exist.
2042 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2044 \see FindMessage(const char*, BMessage*) const
2051 \fn status_t BMessage::FindFlat(const char* name,
2052 BFlattenable* object) const
2053 \brief Find a flattened object at the label \a name.
2055 This is an overloaded version of
2056 FindFlat(const char*, int32, BFlattenable*) const
2057 where the data is sought at \a index \c 0.
2059 \param name The label to which the data is associated.
2060 \param object The object in which the data should be unflattened.
2062 \returns A status code, \c B_OK on success or an error code.
2063 \retval B_OK The object now contains the requested data.
2064 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2071 \fn status_t BMessage::FindFlat(const char* name, int32 index,
2072 BFlattenable* object) const
2073 \brief Find a flattened object at the label \a name at an
2076 The type is determined by the type of the passed object. If that type is
2077 available at the specified label, then the Unflatten() method of that
2078 object will be called.
2080 \param name The label to which the data is associated.
2081 \param index The index from which the data should be unflattened.
2082 \param object The object in which the data should be unflattened.
2084 \returns A status code, \c B_OK on success or an error code.
2085 \retval B_OK The object now contains the requested data.
2086 \retval B_BAD_INDEX The \a index does not exist.
2087 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2089 \see FindFlat(const char*, BFlattenable*) const
2099 \name Replacing Data
2101 Look at ReplaceData() for a general introduction to replacing data.
2109 \fn status_t BMessage::ReplaceData(const char* name, type_code type,
2110 const void* data, ssize_t numBytes)
2111 \brief Replace the data at label \a name.
2113 This method is an overloaded method that replaces the data at
2115 ReplaceData(const char*, type_code, int32, const void*, ssize_t).
2117 \param name The name associated with the data to replace.
2118 \param type The type of the data.
2119 \param data A pointer to the new data that needs to be copied into
2121 \param numBytes The size of the new data.
2123 \returns A status code, \c B_OK on success or an error code.
2130 \fn status_t BMessage::ReplaceData(const char* name, type_code type,
2131 int32 index, const void* data, ssize_t numBytes)
2132 \brief Replace the data at label \a name at a specified
2135 The conditions for replacing data are that the\a name is correct,
2136 the \a type matches and the data entry at \a index exists.
2138 There is also a collection of convenience methods, that allow you to
2139 efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()),
2142 \param name The name associated with the data to replace.
2143 \param type The type of the data.
2144 \param index The index in the array to replace.
2145 \param data A pointer to the new data that needs to be copied into
2147 \param numBytes The size of the new data.
2149 \returns A status code, \c B_OK on success or an error code.
2150 \retval B_OK The operation succeeded.
2151 \retval B_BAD_VALUE One of the input parameters are invalid. Check that
2152 you did not pass \c NULL, and in case the field has fixed sized
2153 data, check that \a numBytes is the same as the specified fixed
2155 \retval B_BAD_INDEX The \a index is out of range.
2162 \fn status_t BMessage::ReplaceRect(const char* name, BRect aRect)
2163 \brief Replace a rectangle at the label \a name.
2165 This method is an overloaded method of
2166 ReplaceRect(const char*, int32, BRect).
2167 It replaces the data at \a index \c 0.
2169 \param name The name associated with the data to replace.
2170 \param aRect The object to store in the message.
2172 \returns A status code, \c B_OK on success or an error code.
2173 \retval B_OK The object now contains the requested data.
2174 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2181 \fn status_t BMessage::ReplaceRect(const char* name, int32 index,
2183 \brief Replace a rectangle at the label \a name at a specified
2186 The data at the specified \a name and \a index will be replaced, if it
2187 matches the \c B_RECT_TYPE.
2189 \param name The name associated with the data to replace.
2190 \param index The index in the array to replace.
2191 \param aRect The object to store in the message.
2193 \returns A status code, \c B_OK on success or an error code.
2194 \retval B_OK The operation succeeded.
2195 \retval B_BAD_INDEX The index was out of range.
2196 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2198 \see ReplaceRect(const char*, BRect)
2205 \fn status_t BMessage::ReplacePoint(const char* name, BPoint aPoint)
2206 \brief Replace a point at the label \a name.
2208 This method is an overloaded method of
2209 ReplacePoint(const char*, int32, BPoint).
2210 It replaces the data at \a index \c 0.
2212 \param name The name associated with the data to replace.
2213 \param aPoint The object to store in the message.
2215 \returns A status code, \c B_OK on success or an error code.
2216 \retval B_OK The object now contains the requested data.
2217 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2224 \fn status_t BMessage::ReplacePoint(const char* name, int32 index,
2226 \brief Replace a point at the label \a name at a specified
2229 The data at the specified \a name and \a index will be replaced, if it
2230 matches the \c B_POINT_TYPE.
2232 \param name The name associated with the data to replace.
2233 \param index The index in the array to replace.
2234 \param aPoint The object to store in the message.
2236 \returns A status code, \c B_OK on success or an error code.
2237 \retval B_OK The operation succeeded.
2238 \retval B_BAD_INDEX The index was out of range.
2239 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2241 \see ReplacePoint(const char*, aPoint)
2248 \fn status_t BMessage::ReplaceString(const char* name, const char* aString)
2249 \brief Replace a string at the label \a name.
2251 This method is an overloaded method of
2252 ReplaceString(const char*, int32, const char*).
2253 It replaces the data at \a index \c 0.
2255 \param name The name associated with the data to replace.
2256 \param aString The object to store in the message.
2258 \returns A status code, \c B_OK on success or an error code.
2259 \retval B_OK The operation succeeded.
2260 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2267 \fn status_t BMessage::ReplaceString(const char* name, int32 index,
2268 const char* aString)
2269 \brief Replace a string at the label \a name at a specified
2272 The data at the specified \a name and \a index will be
2273 replaced, if it matches the \c B_STRING_TYPE.
2275 \param name The name associated with the data to replace.
2276 \param index The index in the array to replace.
2277 \param aString The object to store in the message.
2279 \returns A status code, \c B_OK on success or an error code.
2280 \retval B_OK The operation succeeded.
2281 \retval B_BAD_INDEX The index was out of range.
2282 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2284 \see ReplaceString(const char*, const char*)
2291 \fn status_t BMessage::ReplaceString(const char* name,
2292 const BString& aString)
2293 \brief Replace a string at the label \a name.
2295 This method is an overloaded method of
2296 ReplaceString(const char*, int32, BString&).
2297 It replaces the data at \a index \c 0.
2299 \param name The name associated with the data to replace.
2300 \param aString The object to store in the message.
2302 \returns A status code, \c B_OK on success or an error code.
2303 \retval B_OK The operation succeeded.
2304 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2311 \fn status_t BMessage::ReplaceString(const char* name, int32 index,
2312 const BString& aString)
2313 \brief Replace a string at the label \a name at a specified
2316 The data at the specified \a name and \a index will be replaced, if it
2317 matches the \c B_STRING_TYPE.
2319 \param name The name associated with the data to replace.
2320 \param index The index in the array to replace.
2321 \param aString The object to store in the message.
2323 \returns A status code, \c B_OK on success or an error code.
2324 \retval B_OK The operation succeeded.
2325 \retval B_BAD_INDEX The index was out of range.
2326 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2328 \see ReplaceString(const char*, BString&)
2335 \fn status_t BMessage::ReplaceInt8(const char* name, int8 value)
2336 \brief Replace an integer at the label \a name.
2338 This method is an overloaded method of
2339 ReplaceInt8(const char*, int32, int8).
2340 It replaces the data at \a index \c 0.
2342 \param name The name associated with the data to replace.
2343 \param value Where to store in the message.
2345 \returns A status code, \c B_OK on success or an error code.
2346 \retval B_OK The operation succeeded.
2347 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2354 \fn status_t BMessage::ReplaceInt8(const char* name, int32 index,
2356 \brief Replace an integer at the label \a name at a specified
2359 The data at the specified \a name and \a index will be replaced, if it
2360 matches the \c B_INT8_TYPE.
2362 \param name The name associated with the data to replace.
2363 \param index The index in the array to replace.
2364 \param value Where to store in the message.
2366 \returns A status code, \c B_OK on success or an error code.
2367 \retval B_OK The operation succeeded.
2368 \retval B_BAD_INDEX The index was out of range.
2369 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2371 \see ReplaceInt8(const char*, int8)
2378 \fn status_t BMessage::ReplaceInt16(const char* name, int16 value)
2379 \brief Replace an integer at the label \a name.
2381 This method is an overloaded method of
2382 ReplaceInt16(const char*, int32, int16).
2383 It replaces the data at \a index \c 0.
2385 \param name The name associated with the data to replace.
2386 \param value Where to store in the message.
2388 \returns A status code, \c B_OK on success or an error code.
2389 \retval B_OK The operation succeeded.
2390 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2397 \fn status_t BMessage::ReplaceInt16(const char* name, int32 index,
2399 \brief Replace an integer at the label \a name at a specified
2402 The data at the specified \a name and \a index will be replaced, if it
2403 matches the \c B_INT16_TYPE.
2405 \param name The name associated with the data to replace.
2406 \param index The index in the array to replace.
2407 \param value Where to store in the message.
2409 \returns A status code, \c B_OK on success or an error code.
2410 \retval B_OK The operation succeeded.
2411 \retval B_BAD_INDEX The index was out of range.
2412 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2414 \see ReplaceInt16(const char*, int16)
2421 \fn status_t BMessage::ReplaceInt32(const char* name, int32 value)
2422 \brief Replace an integer at the label \a name.
2424 This method is an overloaded method of
2425 ReplaceInt8(const char*, int32, int32).
2426 It replaces the data at \a index \c 0.
2428 \param name The name associated with the data to replace.
2429 \param value Where to store in the message.
2431 \returns A status code, \c B_OK on success or an error code.
2432 \retval B_OK The operation succeeded.
2433 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2440 \fn status_t BMessage::ReplaceInt32(const char* name, int32 index,
2442 \brief Replace an integer at the label \a name at a specified
2445 The data at the specified \a name and \a index will be replaced, if it
2446 matches the \c B_INT32_TYPE.
2448 \param name The name associated with the data to replace.
2449 \param index The index in the array to replace.
2450 \param value The object to store in the message.
2452 \returns A status code, \c B_OK on success or an error code.
2453 \retval B_OK The operation succeeded.
2454 \retval B_BAD_INDEX The index was out of range.
2455 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2457 \see ReplaceInt32(const char*, int32)
2464 \fn status_t BMessage::ReplaceInt64(const char* name, int64 value)
2465 \brief Replace an integer at the label \a name.
2467 This method is an overloaded method of
2468 ReplaceInt8(const char*, int32, int64).
2469 It replaces the data at \a index \c 0.
2471 \param name The name associated with the data to replace.
2472 \param value Where to store in the message.
2474 \returns A status code, \c B_OK on success or an error code.
2475 \retval B_OK The operation succeeded.
2476 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2483 \fn status_t BMessage::ReplaceInt64(const char* name, int32 index,
2485 \brief Replace an integer at the label \a name at a specified
2488 The data at the specified \a name and \a index will be replaced, if it
2489 matches the \c B_INT64_TYPE.
2491 \param name The name associated with the data to replace.
2492 \param index The index in the array to replace.
2493 \param value The object to store in the message.
2495 \returns A status code, \c B_OK on success or an error code.
2496 \retval B_OK The operation succeeded.
2497 \retval B_BAD_INDEX The index was out of range.
2498 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2500 \see ReplaceInt64(const char*, int64)
2507 \fn status_t BMessage::ReplaceBool(const char* name, bool aBoolean)
2508 \brief Replace a boolean at the label \a name.
2510 This method is an overloaded method of
2511 ReplaceBool(const char*, int32, bool).
2512 It replaces the data at \a index \c 0.
2514 \param name The name associated with the data to replace.
2515 \param aBoolean Where to store in the message.
2517 \returns A status code, \c B_OK on success or an error code.
2518 \retval B_OK The operation succeeded.
2519 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2526 \fn status_t BMessage::ReplaceBool(const char* name, int32 index,
2528 \brief Replace a boolean at the label \a name at a specified
2531 The data at the specified \a name and \a index will be replaced, if it
2532 matches the \c B_BOOL_TYPE.
2534 \param name The name associated with the data to replace.
2535 \param index The index in the array to replace.
2536 \param aBoolean Where to store in the message.
2538 \returns A status code, \c B_OK on success or an error code.
2539 \retval B_OK The operation succeeded.
2540 \retval B_BAD_INDEX The index was out of range.
2541 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2543 \see ReplaceBool(const char*, bool)
2550 \fn status_t BMessage::ReplaceFloat(const char* name, float aFloat)
2551 \brief Replace a float at the label \a name.
2553 This method is an overloaded method of
2554 ReplaceFloat(const char*, int32, float).
2555 It replaces the data at \a index \c 0.
2557 \param name The name associated with the data to replace.
2558 \param aFloat The object to store in the message.
2560 \returns A status code, \c B_OK on success or an error code.
2561 \retval B_OK The operation succeeded.
2562 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2569 \fn status_t BMessage::ReplaceFloat(const char* name, int32 index,
2571 \brief Replace a float at the label \a name at a specified
2574 The data at the specified \a name and \a index will be replaced, if it
2575 matches the \c B_FLOAT_TYPE.
2577 \param name The name associated with the data to replace.
2578 \param index The index in the array to replace.
2579 \param aFloat The object to store in the message.
2581 \returns A status code, \c B_OK on success or an error code.
2582 \retval B_OK The operation succeeded.
2583 \retval B_BAD_INDEX The index was out of range.
2584 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2586 \see ReplaceFloat(const char*, float)
2593 \fn status_t BMessage::ReplaceDouble(const char* name, double aDouble)
2594 \brief Replace a double at the label \a name.
2596 This method is an overloaded method of
2597 ReplaceDouble(const char*, int32, double).
2598 It replaces the data at \a index \c 0.
2600 \param name The name associated with the data to replace.
2601 \param aDouble Where to store in the message.
2603 \returns A status code, \c B_OK on success or an error code.
2604 \retval B_OK The operation succeeded.
2605 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2612 \fn status_t BMessage::ReplaceDouble(const char* name, int32 index,
2614 \brief Replace a double at the label \a name at a specified
2617 The data at the specified \a name and \a index will be replaced, if it
2618 matches the \c B_DOUBLE_TYPE.
2620 \param name The name associated with the data to replace.
2621 \param index The index in the array to replace.
2622 \param aDouble Where to store in the message.
2624 \returns A status code, \c B_OK on success or an error code.
2625 \retval B_OK The operation succeeded.
2626 \retval B_BAD_INDEX The index was out of range.
2627 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2629 \see ReplaceDouble(const char*, double)
2636 \fn status_t BMessage::ReplaceColor(const char* name, rgb_color aColor)
2637 \brief Replace a color at the label \a name.
2639 This method is an overloaded method of
2640 ReplaceColor(const char*, int32, rgb_color).
2641 It replaces the data at \a index \c 0.
2643 \param name The name associated with the data to replace.
2644 \param aColor Where to store in the message.
2646 \returns A status code, \c B_OK on success or an error code.
2647 \retval B_OK The operation succeeded.
2648 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2655 \fn status_t BMessage::ReplaceColor(const char* name, int32 index,
2657 \brief Replace a rgb_color at the label \a name at a specified
2660 The data at the specified \a name and \a index will be replaced, if it
2661 matches the \c B_RGB_32_BIT_TYPE.
2663 \param name The name associated with the data to replace.
2664 \param index The index in the array to replace.
2665 \param aColor Where to store in the message.
2667 \returns A status code, \c B_OK on success or an error code.
2668 \retval B_OK The operation succeeded.
2669 \retval B_BAD_INDEX The index was out of range.
2670 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2672 \see ReplaceColor(const char*, rgb_color)
2679 \fn status_t BMessage::ReplacePointer(const char* name,
2680 const void* pointer)
2681 \brief Replace a pointer at the label \a name.
2683 This method is an overloaded method of
2684 ReplacePointer(const char*, int32, const void*).
2685 It replaces the data at \a index \c 0.
2687 \param name The name associated with the data to replace.
2688 \param pointer Where to store in the message.
2690 \returns A status code, \c B_OK on success or an error code.
2691 \retval B_OK The operation succeeded.
2692 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2699 \fn status_t BMessage::ReplacePointer(const char* name, int32 index,
2700 const void* pointer)
2701 \brief Replace a pointer at the label \a name at a specified \a index.
2703 The data at the specified \a name and \a index will be replaced, if it
2704 matches the \c B_POINTER_TYPE.
2706 \param name The name associated with the data to replace.
2707 \param index The index in the array to replace.
2708 \param pointer Where to store in the message.
2710 \returns A status code, \c B_OK on success or an error code.
2711 \retval B_OK The operation succeeded.
2712 \retval B_BAD_INDEX The index was out of range.
2713 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2715 \see ReplacePointer(const char*, const void*)
2722 \fn status_t BMessage::ReplaceMessenger(const char* name,
2723 BMessenger messenger)
2724 \brief Replace a messenger at the label \a name.
2726 This method is an overloaded method of
2727 ReplaceMessenger(const char*, int32, BMessenger).
2728 It replaces the data at \a index \c 0.
2730 \param name The name associated with the data to replace.
2731 \param messenger The object to store in the message.
2733 \returns A status code, \c B_OK on success or an error code.
2734 \retval B_OK The operation succeeded.
2735 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2742 \fn status_t BMessage::ReplaceMessenger(const char* name, int32 index,
2743 BMessenger messenger)
2744 \brief Replace a messenger at the label \a name at a specified
2747 The data at the specified \a name and \a index will be replaced, if it
2748 matches the \c B_MESSENGER_TYPE.
2750 \param name The name associated with the data to replace.
2751 \param index The index in the array to replace.
2752 \param messenger The object to store in the message.
2754 \returns A status code, \c B_OK on success or an error code.
2755 \retval B_OK The operation succeeded.
2756 \retval B_BAD_INDEX The index was out of range.
2757 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2759 \see ReplaceMessenger(const char*, BMessenger)
2766 \fn status_t BMessage::ReplaceRef(const char* name, const entry_ref* ref)
2767 \brief Replace a reference to a file at the label \a name.
2769 This method is an overloaded method of
2770 ReplaceRef(const char*, int32, entry_ref*).
2771 It replaces the data at \a index \c 0.
2773 \param name The name associated with the data to replace.
2774 \param ref The object to store in the message.
2776 \returns A status code, \c B_OK on success or an error code.
2777 \retval B_OK The operation succeeded.
2778 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2785 \fn status_t BMessage::ReplaceRef(const char* name, int32 index,
2786 const entry_ref* ref)
2787 \brief Replace a reference to a file at the label \a name at a
2790 The data at the specified \a name and \a index will be replaced, if it
2791 matches the \c B_REF_TYPE.
2793 \param name The name associated with the data to replace.
2794 \param index The index in the array to replace.
2795 \param ref The object to store in the message.
2797 \returns A status code, \c B_OK on success or an error code.
2798 \retval B_OK The operation succeeded.
2799 \retval B_BAD_INDEX The index was out of range.
2800 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2802 \see ReplaceRef(const char*, entry_ref*)
2809 \fn status_t BMessage::ReplaceMessage(const char* name,
2810 const BMessage* message)
2811 \brief Replace a message at the label \a name.
2813 This method is an overloaded method of
2814 ReplaceMessage(const char*, int32, BMessage*).
2815 It replaces the data at \a index \c 0.
2817 \param name The name associated with the data to replace.
2818 \param message The object to store in the message.
2820 \returns A status code, \c B_OK on success or an error code.
2821 \retval B_OK The operation succeeded.
2822 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2829 \fn status_t BMessage::ReplaceMessage(const char* name, int32 index,
2830 const BMessage* message)
2831 \brief Replace a message at the label \a name at a specified
2834 The data at the specified \a name and \a index will be replaced, if it
2835 matches the \c B_MESSAGE_TYPE.
2837 \param name The name associated with the data to replace.
2838 \param index The index in the array to replace.
2839 \param message The object to store in the message.
2841 \returns A status code, \c B_OK on success or an error code.
2842 \retval B_OK The operation succeeded.
2843 \retval B_BAD_INDEX The index was out of range.
2844 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2846 \see ReplaceMessage(const char*, BMessage*)
2853 \fn status_t BMessage::ReplaceFlat(const char* name, BFlattenable* object)
2854 \brief Replace a flattened object at the label \a name.
2856 This method is an overloaded method of
2857 ReplaceFlat(const char*, int32, BFlattenable*).
2859 It replaces the data at \a index \c 0.
2861 \param name The name associated with the data to replace.
2862 \param object The object to store in the message.
2864 \returns A status code, \c B_OK on success or an error code.
2865 \retval B_OK The operation succeeded.
2866 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2873 \fn status_t BMessage::ReplaceFlat(const char* name, int32 index,
2874 BFlattenable* object)
2875 \brief Replace a flattened object at the label \a name at a
2878 The data at the specified \a name and \a index will be
2879 replaced, if it matches the type returned by your object. This method uses
2880 BFlattenable::TypeCode() to determine the type of the object.
2882 \param name The name associated with the data to replace.
2883 \param index The index in the array to replace.
2884 \param object The object to store in the message.
2886 \returns A status code, \c B_OK on success or an error code.
2887 \retval B_OK The operation succeeded.
2888 \retval B_BAD_INDEX The index was out of range.
2889 \retval B_NAME_NOT_FOUND There is no field with this \a name.
2891 \see ReplaceFlat(const char*, BFlattenable*)
2903 The new and delete operators are deprecated and are only provided for
2904 backwards compatibility.
2912 \fn BMessage& BMessage::operator=(const BMessage& other)
2913 \brief Copy one message into another.
2915 See the copy constructor, BMessage(const BMessage& other), for details on
2916 what is copied, and what isn't.
2923 \fn void* BMessage::operator new(size_t size)
2924 \brief Allocates \a size bytes of memory for a BMessage.
2926 \warning This method is deprecated, do not use.
2933 \fn void* BMessage::operator new(size_t, void* pointer)
2934 \brief Allocates \a size bytes of memory for a BMessage.
2936 \warning This method is deprecated, do not use.
2943 \fn void BMessage::operator delete(void* pointer, size_t size)
2944 \brief Frees memory allocated by new.
2946 \warning This method is deprecated, do not use.
2956 \name Deprecated Methods
2958 These methods are likely to disappear as they have been replaced by safer
2959 and more powerful methods but are implemented for the purpose of binary
2968 \fn bool BMessage::HasRect(const char*, int32) const
2971 \warning This method is deprecated, do not use.
2978 \fn bool BMessage::HasPoint(const char*, int32) const
2981 \warning This method is deprecated, do not use.
2988 \fn bool BMessage::HasString(const char*, int32) const
2991 \warning This method is deprecated, do not use.
2998 \fn bool BMessage::HasInt8(const char*, int32) const
3001 \warning This method is deprecated, do not use.
3008 \fn bool BMessage::HasInt16(const char*, int32) const
3011 \warning This method is deprecated, do not use.
3018 \fn bool BMessage::HasInt32(const char*, int32) const
3021 \warning This method is deprecated, do not use.
3028 \fn bool BMessage::HasInt64(const char*, int32) const
3031 \warning This method is deprecated, do not use.
3038 \fn bool BMessage::HasBool(const char*, int32) const
3041 \warning This method is deprecated, do not use.
3048 \fn bool BMessage::HasFloat(const char*, int32) const
3051 \warning This method is deprecated, do not use.
3058 \fn bool BMessage::HasDouble(const char*, int32) const
3061 \warning This method is deprecated, do not use.
3068 \fn bool BMessage::HasPointer(const char*, int32) const
3071 \warning This method is deprecated, do not use.
3078 \fn bool BMessage::HasMessenger(const char*, int32) const
3081 \warning This method is deprecated, do not use.
3088 \fn bool BMessage::HasRef(const char*, int32) const
3091 \warning This method is deprecated, do not use.
3098 \fn bool BMessage::HasMessage(const char*, int32) const
3101 \warning This method is deprecated, do not use.
3108 \fn bool BMessage::HasFlat(const char*, const BFlattenable*) const
3111 \warning This method is deprecated, do not use.
3118 \fn bool BMessage::HasFlat(const char*, int32, const BFlattenable*) const
3121 \warning This method is deprecated, do not use.
3128 \fn bool BMessage::HasData(const char*, type_code, int32) const
3131 \warning This method is deprecated, do not use.
3138 \fn BRect BMessage::FindRect(const char*, int32) const
3141 \warning This method is deprecated, do not use.
3148 \fn BPoint BMessage::FindPoint(const char*, int32) const
3151 \warning This method is deprecated, do not use.
3158 \fn const char* BMessage::FindString(const char*, int32) const
3161 \warning This method is deprecated, do not use.
3168 \fn int8 BMessage::FindInt8(const char*, int32) const
3171 \warning This method is deprecated, do not use.
3178 \fn int16 BMessage::FindInt16(const char*, int32) const
3181 \warning This method is deprecated, do not use.
3188 \fn int32 BMessage::FindInt32(const char*, int32) const
3191 \warning This method is deprecated, do not use.
3198 \fn int64 BMessage::FindInt64(const char*, int32) const
3201 \warning This method is deprecated, do not use.
3208 \fn bool BMessage::FindBool(const char*, int32) const
3211 \warning This method is deprecated, do not use.
3218 \fn float BMessage::FindFloat(const char*, int32) const
3221 \warning This method is deprecated, do not use.
3228 \fn double BMessage::FindDouble(const char*, int32) const
3231 \warning This method is deprecated, do not use.
3241 \name Finding Data Convenience Methods
3243 These methods may be used as alternatives to the Find data methods above
3244 which allow you to specify a default value to use if the value you are
3245 looking for is not found and return the result instead of filling out an
3246 out parameter and status code. If you are not interested in the status code
3247 these methods allow for some code simplification.
3249 For example, instead of writing:
3253 if (FindBool("enabled", &enabled) != B_OK)
3257 you can write the following:
3260 bool enabled = GetBool("enabled", false);
3263 reducing the example to a single line.
3271 \fn bool BMessage::GetBool(const char* name, bool defaultValue) const
3272 \brief Return the boolean value from message with \a name, or
3273 \a defaultValue if not found.
3275 \param name The name of the item to retrieve.
3276 \param defaultValue The value to use if the item specified by \a name
3279 \return The item with \a name, or \a defaultValue if not found.
3286 \fn bool BMessage::GetBool(const char* name, int32 index,
3287 bool defaultValue) const
3288 \brief Return the boolean value from message with \a name and \a index, or
3289 \a defaultValue if not found.
3291 \param name The name of the item to retrieve.
3292 \param index The index of the item to retrieve if there is more than one.
3293 \param defaultValue The value to use if the item specified by \a name
3296 \return The item with \a name, or \a defaultValue if not found.
3303 \fn int8 BMessage::GetInt8(const char* name, int8 defaultValue) const
3304 \brief Return the int8 value from message with \a name, or \a defaultValue
3307 \param name The name of the item to retrieve.
3308 \param defaultValue The value to use if the item specified by \a name
3311 \return The item with \a name, or \a defaultValue if not found.
3318 \fn int8 BMessage::GetInt8(const char* name, int32 index,
3319 int8 defaultValue) const
3320 \brief Return the int8 value from message with \a name and \a index, or
3321 \a defaultValue if not found.
3323 \param name The name of the item to retrieve.
3324 \param index The index of the item to retrieve if there is more than one.
3325 \param defaultValue The value to use if the item specified by \a name
3328 \return The item with \a name, or \a defaultValue if not found.
3335 \fn uint8 BMessage::GetUInt8(const char* name, uint8 defaultValue) const
3336 \brief Return the uint8 value from message with \a name, or \a defaultValue
3339 \param name The name of the item to retrieve.
3340 \param defaultValue The value to use if the item specified by \a name
3343 \return The item with \a name, or \a defaultValue if not found.
3350 \fn uint8 BMessage::GetUInt8(const char* name, int32 index,
3351 uint8 defaultValue) const
3352 \brief Return the uint8 message from message with \a name and \a index, or
3353 \a defaultValue if not found.
3355 \param name The name of the item to retrieve.
3356 \param index The index of the item to retrieve if there is more than one.
3357 \param defaultValue The value to use if the item specified by \a name
3360 \return The item with \a name, or \a defaultValue if not found.
3367 \fn int16 BMessage::GetInt16(const char* name, int16 defaultValue) const
3368 \brief Return the int16 value from message with \a name, or \a defaultValue
3371 \param name The name of the item to retrieve.
3372 \param defaultValue The value to use if the item specified by \a name
3375 \return The item with \a name, or \a defaultValue if not found.
3382 \fn int16 BMessage::GetInt16(const char* name, int32 index,
3383 int16 defaultValue) const
3384 \brief Return the int16 value from message with \a name and \a index, or
3385 \a defaultValue if not found.
3387 \param name The name of the item to retrieve.
3388 \param index The index of the item to retrieve if there is more than one.
3389 \param defaultValue The value to use if the item specified by \a name
3392 \return The item with \a name, or \a defaultValue if not found.
3399 \fn uint16 BMessage::GetUInt16(const char* name, uint16 defaultValue) const
3400 \brief Return the uint16 value from message with \a name, or
3401 \a defaultValue if not found.
3403 \param name The name of the item to retrieve.
3404 \param defaultValue The value to use if the item specified by \a name
3407 \return The item with \a name, or \a defaultValue if not found.
3414 \fn uint16 BMessage::GetUInt16(const char* name, int32 index,
3415 uint16 defaultValue) const
3416 \brief Return the uint16 value from message with \a name and \a index, or
3417 \a defaultValue if not found.
3419 \param name The name of the item to retrieve.
3420 \param index The index of the item to retrieve if there is more than one.
3421 \param defaultValue The value to use if the item specified by \a name
3424 \return The item with \a name, or \a defaultValue if not found.
3431 \fn int32 BMessage::GetInt32(const char* name, int32 defaultValue) const
3432 \brief Return the int32 value from message with \a name, or \a defaultValue
3435 \param name The name of the item to retrieve.
3436 \param defaultValue The value to use if the item specified by \a name
3439 \return The item with \a name, or \a defaultValue if not found.
3446 \fn int32 BMessage::GetInt32(const char* name, int32 index,
3447 int32 defaultValue) const
3448 \brief Return the int32 value from message with \a name and \a index, or
3449 \a defaultValue if not found.
3451 \param name The name of the item to retrieve.
3452 \param index The index of the item to retrieve if there is more than one.
3453 \param defaultValue The value to use if the item specified by \a name
3456 \return The item with \a name, or \a defaultValue if not found.
3463 \fn uint32 BMessage::GetUInt32(const char* name, uint32 defaultValue) const
3464 \brief Return the uint32 value from message with \a name, or
3465 \a defaultValue if not found.
3467 \param name The name of the item to retrieve.
3468 \param defaultValue The value to use if the item specified by \a name
3471 \return The item with \a name, or \a defaultValue if not found.
3478 \fn uint32 BMessage::GetUInt32(const char* name, int32 index,
3479 uint32 defaultValue) const
3480 \brief Return the uint32 value from message with \a name and \a index, or
3481 \a defaultValue if not found.
3483 \param name The name of the item to retrieve.
3484 \param index The index of the item to retrieve if there is more than one.
3485 \param defaultValue The value to use if the item specified by \a name
3488 \return The item with \a name, or \a defaultValue if not found.
3495 \fn int64 BMessage::GetInt64(const char* name, int64 defaultValue) const
3496 \brief Return the int64 value from message with \a name, or \a defaultValue
3499 \param name The name of the item to retrieve.
3500 \param defaultValue The value to use if the item specified by \a name
3503 \return The item with \a name, or \a defaultValue if not found.
3510 \fn int64 BMessage::GetInt64(const char* name, int32 index,
3511 int64 defaultValue) const
3512 \brief Return the int64 value from message with \a name and \a index, or
3513 \a defaultValue if not found.
3515 \param name The name of the item to retrieve.
3516 \param index The index of the item to retrieve if there is more than one.
3517 \param defaultValue The value to use if the item specified by \a name
3520 \return The item with \a name, or \a defaultValue if not found.
3527 \fn uint64 BMessage::GetUInt64(const char* name, uint64 defaultValue) const
3528 \brief Return the uint64 value from message with \a name, or
3529 \a defaultValue if not found.
3531 \param name The name of the item to retrieve.
3532 \param defaultValue The value to use if the item specified by \a name
3535 \return The item with \a name, or \a defaultValue if not found.
3542 \fn uint64 BMessage::GetUInt64(const char* name, int32 index,
3543 uint64 defaultValue) const
3544 \brief Return the uint64 value from message with \a name and \a index, or
3545 \a defaultValue if not found.
3547 \param name The name of the item to retrieve.
3548 \param index The index of the item to retrieve if there is more than one.
3549 \param defaultValue The value to use if the item specified by \a name
3552 \return The item with \a name, or \a defaultValue if not found.
3559 \fn float BMessage::GetFloat(const char* name, float defaultValue) const
3560 \brief Return the float value from message with \a name, or \a defaultValue
3563 \param name The name of the item to retrieve.
3564 \param defaultValue The value to use if the item specified by \a name
3567 \return The item with \a name, or \a defaultValue if not found.
3574 \fn float BMessage::GetFloat(const char* name, int32 index,
3575 float defaultValue) const
3576 \brief Return the float value from message with \a name and \a index, or
3577 \a defaultValue if not found.
3579 \param name The name of the item to retrieve.
3580 \param index The index of the item to retrieve if there is more than one.
3581 \param defaultValue The value to use if the item specified by \a name
3584 \return The item with \a name, or \a defaultValue if not found.
3591 \fn double BMessage::GetDouble(const char* name, double defaultValue) const
3592 \brief Return the double value from message with \a name, or
3593 \a defaultValue if not found.
3595 \param name The name of the item to retrieve.
3596 \param defaultValue The value to use if the item specified by \a name
3599 \return The item with \a name, or \a defaultValue if not found.
3606 \fn double BMessage::GetDouble(const char* name, int32 index,
3607 double defaultValue) const
3608 \brief Return the double value from message with \a name and \a index, or
3609 \a defaultValue if not found.
3611 \param name The name of the item to retrieve.
3612 \param index The index of the item to retrieve if there is more than one.
3613 \param defaultValue The value to use if the item specified by \a name
3616 \return The item with \a name, or \a defaultValue if not found.
3623 \fn rgb_color BMessage::GetColor(const char* name, rgb_color defaultValue) const
3624 \brief Return the rgb_color value from message with \a name, or
3625 \a defaultValue if not found.
3627 \param name The name of the item to retrieve.
3628 \param defaultValue The value to use if the item specified by \a name
3631 \return The item with \a name, or \a defaultValue if not found.
3638 \fn rgb_color BMessage::GetColor(const char* name, int32 index,
3639 rgb_color defaultValue) const
3640 \brief Return the rgb_color value from message with \a name and \a index, or
3641 \a defaultValue if not found.
3643 \param name The name of the item to retrieve.
3644 \param index The index of the item to retrieve if there is more than one.
3645 \param defaultValue The value to use if the item specified by \a name
3648 \return The item with \a name, or \a defaultValue if not found.
3655 \fn const char* BMessage::GetString(const char* name,
3656 const char* defaultValue) const
3657 \brief Return the string from message with \a name, or \a defaultValue if
3660 \param name The name of the item to retrieve.
3661 \param defaultValue The value to use if the item specified by \a name
3664 \return The item with \a name, or \a defaultValue if not found.
3671 \fn const char* BMessage::GetString(const char* name, int32 index,
3672 const char* defaultValue) const
3673 \brief Return the string from message with \a name and \a index, or
3674 \a defaultValue if not found.
3676 \param name The name of the item to retrieve.
3677 \param index The index of the item to retrieve if there is more than one.
3678 \param defaultValue The value to use if the item specified by \a name
3681 \return The item with \a name, or \a defaultValue if not found.
3688 \fn BAlignment BMessage::GetAlignment(const char* name,
3689 const BAlignment& defaultValue) const
3690 \brief Return the BAlignment object from message with \a name, or
3691 \a defaultValue if not found.
3693 \param name The name of the item to retrieve.
3694 \param defaultValue The value to use if the item specified by \a name
3697 \return The item with \a name, or \a defaultValue if not found.
3704 \fn BAlignment BMessage::GetAlignment(const char* name, int32 index,
3705 const BAlignment& defaultValue) const
3706 \brief Return the BAlignment object from message with \a name and \a index,
3707 or \a defaultValue if not found.
3709 \param name The name of the item to retrieve.
3710 \param index The index of the item to retrieve if there is more than one.
3711 \param defaultValue The value to use if the item specified by \a name
3714 \return The item with \a name, or \a defaultValue if not found.
3721 \fn BRect BMessage::GetRect(const char* name, const BRect& defaultValue) const
3722 \brief Return the BRect object from message with \a name, or
3723 \a defaultValue if not found.
3725 \param name The name of the item to retrieve.
3726 \param defaultValue The value to use if the item specified by \a name
3729 \return The item with \a name, or \a defaultValue if not found.
3736 \fn BRect BMessage::GetRect(const char* name, int32 index,
3737 const BRect& defaultValue) const
3738 \brief Return the BRect object from message with \a name and \a index,
3739 or \a defaultValue if not found.
3741 \param name The name of the item to retrieve.
3742 \param index The index of the item to retrieve if there is more than one.
3743 \param defaultValue The value to use if the item specified by \a name
3746 \return The item with \a name, or \a defaultValue if not found.
3753 \fn BPoint BMessage::GetPoint(const char* name,
3754 const BPoint& defaultValue) const
3755 \brief Return the BPoint object from message with \a name, or
3756 \a defaultValue if not found.
3758 \param name The name of the item to retrieve.
3759 \param defaultValue The value to use if the item specified by \a name
3762 \return The item with \a name, or \a defaultValue if not found.
3769 \fn BPoint BMessage::GetPoint(const char* name, int32 index,
3770 const BPoint& defaultValue) const
3771 \brief Return the BPoint object from message with \a name and \a index,
3772 or \a defaultValue if not found.
3774 \param name The name of the item to retrieve.
3775 \param index The index of the item to retrieve if there is more than one.
3776 \param defaultValue The value to use if the item specified by \a name
3779 \return The item with \a name, or \a defaultValue if not found.
3786 \fn BSize BMessage::GetSize(const char* name,
3787 const BSize& defaultValue) const
3788 \brief Return the BSize object from message with \a name, or
3789 \a defaultValue if not found.
3791 \param name The name of the item to retrieve.
3792 \param defaultValue The value to use if the item specified by \a name
3795 \return The item with \a name, or \a defaultValue if not found.
3802 \fn BSize BMessage::GetSize(const char* name, int32 index,
3803 const BSize& defaultValue) const
3804 \brief Return the BSize object from message with \a name and \a index,
3805 or \a defaultValue if not found.
3807 \param name The name of the item to retrieve.
3808 \param index The index of the item to retrieve if there is more than one.
3809 \param defaultValue The value to use if the item specified by \a name
3812 \return The item with \a name, or \a defaultValue if not found.