1/* 2 * Copyright 2007 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Niels Sascha Reedijk, niels.reedijk@gmail.com 7 * 8 * Corresponds to: 9 * headers/os/app/Message.h rev 21562 10 * src/kits/app/Message.cpp rev 22240 11 */ 12 13 14/*! 15 \file Message.h 16 \ingroup app 17 \ingroup libbe 18 \brief Provides the BMessage class. 19*/ 20 21 22///// Name lengths and Scripting specifiers ///// 23 24 25/*! 26 \def B_FIELD_NAME_LENGTH 27 \brief Undocumented... 28*/ 29 30 31/*! 32 \def B_PROPERTY_NAME_LENGTH 33 \brief Undocumented... 34*/ 35 36 37/*! 38 \var B_NO_SPECIFIER 39 \brief Undocumented... 40*/ 41 42 43/*! 44 \var B_DIRECT_SPECIFIER 45 \brief Undocumented... 46*/ 47 48 49/*! 50 \var B_INDEX_SPECIFIER 51 \brief Undocumented... 52*/ 53 54 55/*! 56 \var B_REVERSE_INDEX_SPECIFIER, 57 \brief Undocumented... 58*/ 59 60 61/*! 62 \var B_RANGE_SPECIFIER 63 \brief Undocumented... 64*/ 65 66 67/*! 68 \var B_REVERSE_RANGE_SPECIFIER 69 \brief Undocumented... 70*/ 71 72 73/*! 74 \var B_NAME_SPECIFIER 75 \brief Undocumented... 76*/ 77 78 79/*! 80 \var B_ID_SPECIFIER 81 \brief Undocumented... 82*/ 83 84 85/*! 86 \var B_SPECIFIERS_END 87 \brief Undocumented... 88*/ 89 90 91///// Class BMessage ///// 92 93 94/*! 95 \class BMessage 96 \ingroup app 97 \ingroup libbe 98 \brief A container that can be send and received using the Haiku messaging 99 subsystem. 100 101 This class is at the center of the web of messaging classes, in the sense 102 that it defines the actual structure of the messages. Messages have two 103 <b>important elements</b>: the #what identifier, and the data members. The 104 first can be directly manipulated, the latter can be manipulated through 105 AddData(), FindData() and ReplaceData() and their derivatives. Neither of 106 these elements are mandatory. 107 108 The second important role of BMessage is that it stores <b>meta data</b>: 109 who sent the message and with what intention? The methods of BMessage will 110 disclose if the message was a reply (IsReply()), where it came from 111 (IsSourceRemote()), whether a reply is expected (IsSourceWaiting()), and in 112 case the message is a reply, what it's a reply to (Previous()). 113 114 Mostly, messages are used to pass information between the the objects in 115 your application, but because messages are such flexible data containers, 116 they are also often used for other <b>data storage purposes</b>. Many 117 applications store their settings as messages. Because messages can be 118 flattened to data streams (such as files), they provide an easy but 119 powerful tool for data storage. 120 121 All methods can be classified in these areas: 122 - Adding, Finding, Replacing and Removing Data. 123 - Statistics and Miscellaneous information. 124 - Delivery information. 125 - Utilities to reply to messages. 126 127 To see how messages fit in with the greater picture, have a look at the 128 \ref app_messaging "Messaging Introduction". 129*/ 130 131 132/*! 133 \var BMessage::what 134 \brief A 4-byte constant that determines the type of message. 135 136 You can directly manipulate this data member. 137*/ 138 139 140/*! 141 \fn BMessage::BMessage() 142 \brief Construct an empty message, without any data members and with a 143 \a what constant set to \c 0. 144 145 \see BMessage(uint32 what) 146 \see BMessage(const BMessage &other) 147*/ 148 149 150/*! 151 \fn BMessage::BMessage(uint32 what) 152 \brief Construct an empty message with the \a what member set to the 153 specified value. 154 155 \see BMessage::BMessage() 156 \see BMessage::BMessage(const BMessage &other) 157*/ 158 159 160/*! 161 \fn BMessage::BMessage(const BMessage &other) 162 \brief Construct a new message that is a copy of another message. 163 164 The \a what member and the data values are copied. The metadata, such as 165 whether or not the message is a drop message or reply information, is 166 not copied. So if the original message is a reply to a previous message, 167 which will make IsReply() return \c true, calling the same method on a copy 168 of the message will return \c false. 169 170 \remarks BeOS R5 did keep the metadata of the message. Haiku deviates from 171 this behavior. Use the Haiku implementation of message copying as the 172 default behavior. This will keep your applications backwards compatible. 173 174 \see BMessage::BMessage() 175 \see BMessage(uint32 what) 176*/ 177 178 179/*! 180 \fn BMessage::~BMessage() 181 \brief Free the data members associated with the message. 182 183 If there still is a sender waiting for a reply, the \c B_NO_REPLY message 184 will be sent to inform them that there won't be a reply. 185*/ 186 187 188/*! 189 \fn BMessage &BMessage::operator=(const BMessage &other) 190 \brief Copy one message into another. 191 192 See the copy constructor, BMessage(const BMessage &other), for details on 193 what is copied, and what isn't. 194*/ 195 196 197/*! 198 \name Statistics and Miscellaneous Information 199*/ 200 201 202//! @{ 203 204 205/*! 206 \fn status_t BMessage::GetInfo(type_code typeRequested, int32 index, 207 char **nameFound, type_code *typeFound, int32 *countFound) const 208 \brief Retrieve the name, the type and the number of items in a message by 209 an \a index. 210 211 \param[in] typeRequested If you want to limit the search to only one type, 212 pass that type code here. If you don't care which type the data has, 213 you can pass \c B_ANY_TYPE. 214 \param[in] index The index of the data you want to investigate. 215 \param[out] nameFound The name of the item if it is found. Haiku will fill 216 in a pointer to the internal name buffer in the message. This means 217 that you should not manipulate this name. If you are not interested in 218 the name, you can safely pass \c NULL. 219 \param[out] typeFound The type of the item at \a index. If you are 220 not interested in the type (because you specifically asked for a type), 221 you can safely pass \c NULL. 222 \param[out] countFound The number of items at \a index. If data 223 items have the same name, they will be placed under the same index. 224 225 \return If the \a index is found, and matches the requested type, 226 then the other parameters will be filled in. If this is not the case, 227 the method will return with an error. 228 \retval B_OK An match was found. The values have been filled in. 229 \retval B_BAD_INDEX The \a index was out of range. None of the 230 passed variables have been altered. 231 \retval B_BAD_TYPE The data field at \a index does not have the 232 requested type. 233*/ 234 235 236/*! 237 \fn status_t BMessage::GetInfo(const char *name, type_code *typeFound, 238 int32 *countFound) const 239 \brief Retrieve the type and the number of data items in this message that 240 are associated with a \a name. 241 242 \param[in] name The name of the data member that you are looking for. 243 \param[out] typeFound In case of a match, the name of the data member will 244 be put in this parameter. In case you are not interested, you can pass 245 \c NULL. 246 \param[out] countFound In case of a match, the number of items at this 247 label will be in this parameter. In case you are not interested, you 248 can safely pass \c NULL. 249 250 \return If the message has data associated with the given \a name, 251 the other parameters will contain information associated with the data, 252 else, the method will return with an error. 253 \retval B_OK A match was found. The other parameters have been filled in. 254 \retval B_BAD_VALUE You passed \c NULL as argument to \a name. 255 \retval B_NAME_NOT_FOUND There is no data with the label \a name. 256*/ 257 258 259/*! 260 \fn status_t BMessage::GetInfo(const char *name, type_code *typeFound, 261 bool *fixedSize) const 262 \brief Retrieve the type and whether or not the size of the data is fixed 263 associated with a \a name. 264 265 This method is the same as GetInfo(const char *,type_code *, int32 *) const, 266 with the difference that you can find out whether or not the size of the 267 data associated with the \a name is fixed. You will get this value 268 in the variable you passed as \a fixedSize parameter. 269*/ 270 271 272/*! 273 \fn int32 BMessage::CountNames(type_code type) const 274 \brief Count the number of names of a certain \a type. 275 276 This method can be used to count the number of items of a certain type. 277 It's practical use is limited to debugging purposes. 278 279 \param type The type you want to find. If you pass \c B_ANY_TYPE, this 280 method will return the total number of data items. 281 282 \return The number of data items in this message with the specified 283 \a type, or \c 0 in case no items match the type. 284*/ 285 286 287/*! 288 \fn bool BMessage::IsEmpty() const 289 \brief Check if the message has data members. 290 291 \return If this message contains data members, this method will return 292 \c true, else it will return \c false. 293 \see MakeEmpty() 294*/ 295 296 297/*! 298 \fn bool BMessage::IsSystem() const 299 \brief Check if the message is a system message. 300 301 \return If this message is a system message, the method will return 302 \c true. 303*/ 304 305 306/*! 307 \fn bool BMessage::IsReply() const 308 \brief Check if the message is a reply to a (previous) message. 309 310 \return If this message is a reply, this method will return \c true. 311*/ 312 313 314/*! 315 \fn void BMessage::PrintToStream() const 316 \brief Print the message to the standard output. 317 318 This method can be used to debug your application. It can be used to check 319 if it creates the messages properly, by checking if all the required fields 320 are present, and it can be used to debug your message handling routines, 321 especially the handling of those that are sent by external applications, to 322 see if you understand the semantics correctly. 323*/ 324 325 326/*! 327 \fn status_t BMessage::Rename(const char *oldEntry, const char *newEntry) 328 \brief Rename a data label. 329 330 \param oldEntry The name of the label you want to rename. 331 \param newEntry The new name of the data entry. 332 333 \returns A status code, \c B_OK on success or an error code. 334 \retval B_OK Renaming succeeded. 335 \retval B_BAD_VALUE Either the \a oldEntry or the 336 \a newEntry pointers are \c NULL. 337 \retval B_NAME_NOT_FOUND There is no data associated with the label 338 \a oldEntry. 339*/ 340 341 342//! @} 343 344 345/*! 346 \name Delivery Info 347*/ 348 349 350//! @{ 351 352 353/*! 354 \fn bool BMessage::WasDelivered() const 355 \brief Check if this message was delivered through the delivery methods. 356 357 If this message is passed via a BMessenger or BLooper::PostMessage(), this 358 method will return \c true. 359 360 \warning This method should not be abused by a thread that sends a message 361 to track whether or not a message was delivered. This is because the 362 ownership of the message goes to the receiving looper, which will 363 delete the message as soon as it is done with it. 364 365 \warning If you need to check whether a message is delivered, you should 366 either ask for a reply, or use one of the synchronous 367 BMessenger::SendMessage() methods. 368*/ 369 370 371/*! 372 \fn bool BMessage::IsSourceWaiting() const 373 \brief Check if the sender expects a reply. 374 375 This method will return \c true, if the sender flagged that it is waiting 376 for a reply, and such a reply has not yet been sent. 377*/ 378 379 380/*! 381 \fn bool BMessage::IsSourceRemote() const 382 \brief Check if the message is sent by another application. 383*/ 384 385 386/*! 387 \fn BMessenger BMessage::ReturnAddress() const 388 \brief Get a messenger that points to the sender of the message. 389 390 Using this method, you can fetch a BMessenger that can be used to deliver 391 replies to this message. This method works both for local and remote 392 deliveries. 393 394 For remote deliveries, this approach is preferred over sending the reply 395 using a standard BMessenger that is created with the signature of the 396 application. A standard BMessenger sends the messages to the main BLooper 397 of the application, the BApplication object. With the delivery data stored 398 in the messages, the reply using this messenger will be directed at a 399 specific looper that is able to handle the replies. 400 401 If this method is called on a message that has not been delivered (yet), 402 it will return an empty BMessenger object. 403*/ 404 405 406/*! 407 \fn const BMessage *BMessage::Previous() const 408 \brief Get the message to which this message is a reply. 409 410 \return Returns a new BMessage with the same data stuctures as the message 411 to which this message is a reply. You get the ownership of this 412 message, so free it when you're done. If this message isn't a reply to 413 another message, this method will return \c NULL. 414*/ 415 416 417/*! 418 \fn bool BMessage::WasDropped() const 419 \brief Check if the message was delivered through 'drag and drop'. 420 421 \return This method returns \c true if the message has been delivered 422 through drag and drop. It returns \c false if it has been delivered 423 through the regular messaging functions, or if the message has not 424 been delivered at all. 425 426 \see DropPoint() 427*/ 428 429 430/*! 431 \fn BPoint BMessage::DropPoint(BPoint *offset) const 432 \brief Get the coordinates of the drop point of the message. 433 434 If the message has been delivered because of drag and drop, which can be 435 verified with the WasDropped() method, this method will return a BPoint to 436 where exactly the drop off was made. 437 438 Because drop messages are delivered to the BWindow in which they were 439 dropped, and BWindow is a subclass of BLooper, you can use BWindow to 440 determine based on the location, how you should react to it. 441 442 If this message was not delivered through drag and drop, it will return 443 a \c NULL pointer. 444 445 \see WasDropped() 446*/ 447 448 449//! @} 450 451 452/*! 453 \name Replying 454*/ 455 456 457//! @{ 458 459 460/*! 461 \fn status_t BMessage::SendReply(uint32 command, BHandler *replyTo) 462 \brief Asynchronously send a reply to this message. 463 464 This is an overloaded member of SendReply(BMessage *, BMessenger, bigtime_t). 465 Use this variant if you want to send a message without data members. 466*/ 467 468 469/*! 470 \fn status_t BMessage::SendReply(BMessage *reply, BHandler *replyTo, 471 bigtime_t timeout) 472 \brief Asynchronously send a reply to this message. 473 474 This is an overloaded member of SendReply(BMessage *, BMessenger, bigtime_t). 475 Use this variant if you want to send the message to a specific handler 476 (instead of a complete messenger). 477*/ 478 479 480/*! 481 \fn status_t BMessage::SendReply(BMessage *reply, BMessenger replyTo, 482 bigtime_t timeout) 483 \brief Asynchronously send a reply to this message. 484 485 This method sends a reply to this message to the sender. On your turn, 486 you specify a messenger that handles a reply back to the message you 487 specify as the \a reply argument. You can set a timeout for the 488 message to be delivered. This method blocks until the message has been 489 received, or the \a timeout has been reached. 490 491 \param reply The message that is in reply to this message. 492 \param replyTo In case the receiver needs to reply to the message you are 493 sending, you can specify the return address with this argument. 494 \param timeout The maximum time in microseconds this delivery may take. The 495 \a timeout is a relative timeout. You can also use 496 \c B_INFINITE_TIMEOUT if you want to wait infinitely for the message 497 to be delivered. 498 499 \returns A status code, \c B_OK on success or an error code. 500 \retval B_OK The message has been delivered. 501 \retval B_DUPLICATE_REPLY There already has been a reply to this message. 502 \retval B_BAD_PORT_ID The reply address is not valid (anymore). 503 \retval B_WOULD_BLOCK The delivery \a timeout was 504 \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when trying 505 to deliver the message. 506 \retval B_TIMED_OUT The timeout expired while trying to deliver the 507 message. 508 \see SendReply(uint32 command, BHandler *replyTo) 509*/ 510 511 512/*! 513 \fn status_t BMessage::SendReply(uint32 command, BMessage *replyToReply) 514 \brief Synchronously send a reply to this message, and wait for a reply 515 back. 516 517 This is an overloaded member of SendReply(BMessage *, BMessage *, 518 bigtime_t, bigtime_t) Use this variant if you want to send a message 519 without data members. 520*/ 521 522 523/*! 524 \fn status_t BMessage::SendReply(BMessage *reply, BMessage *replyToReply, 525 bigtime_t sendTimeout, bigtime_t replyTimeout) 526 \brief Synchronously send a reply to this message, and wait for a reply 527 back. 528 529 This method sends a reply to this message to the sender. The 530 \a reply is delivered, and then the method waits for a reply from 531 the receiver. If a reply is received, that reply is copied into the 532 \a replyToReply argument. 533 If the message was delivered properly, but the receiver did not reply 534 within the specified \a replyTimeout, the \a what member of 535 \a replyToReply will be set to \c B_NO_REPLY. 536 537 \param reply The message that is in reply to this message. 538 \param[out] replyToReply The reply is copied into this argument. 539 \param sendTimeout The maximum time in microseconds this delivery may take. 540 The \a timeout is a relative timeout. You can also use 541 \c B_INFINITE_TIMEOUT if you want to wait infinitely for the message 542 to be delivered. 543 \param replyTimeout The maximum time in microseconds you want to wait for a 544 reply. Note that the timer starts when the message has been delivered. 545 546 \returns A status code, \c B_OK on success or an error code. 547 \retval B_OK The message has been delivered. 548 \retval B_DUPLICATE_REPLY There already has been a reply to this message. 549 \retval B_BAD_VALUE Either \a reply or \a replyToReply is 550 \c NULL. 551 \retval B_BAD_PORT_ID The reply address is not valid (anymore). 552 \retval B_WOULD_BLOCK The delivery \a timeout was 553 \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when trying 554 to deliver the message. 555 \retval B_TIMED_OUT The timeout expired while trying to deliver the 556 message. 557 \retval B_NO_MORE_PORTS All reply ports are in use. 558 \see SendReply(uint32 command, BMessage *replyToReply) 559*/ 560 561 562//! @} 563 564 565/*! 566 \name Flattening methods 567 568 Because of historical reasons and for binary compatibility, this class 569 provides a flattening API without inheriting the BFlattenable class. The 570 API is more or less the same, but you are inconvenienced when you want to 571 use messages in methods that handle BFlattenable objects. 572*/ 573 574 575//! @{ 576 577 578/*! 579 \fn ssize_t BMessage::FlattenedSize() const 580 \brief Return the size in bytes required when you want to flatten this 581 message to a stream of bytes. 582*/ 583 584 585/*! 586 \fn status_t BMessage::Flatten(char *buffer, ssize_t size) const 587 \brief Flatten the message to a \a buffer. 588 589 \param buffer The buffer to write the data to. 590 \param size The size of the buffer. 591 592 \return \c B_OK in case of success, or an error code in case something went 593 awry. 594 595 \warning Make sure the buffer is large enough to hold the message. This 596 method does not double-check for you! 597 \see FlattenedSize() 598 \see Flatten(BDataIO *stream, ssize_t *size) const 599*/ 600 601 602/*! 603 \fn status_t BMessage::Flatten(BDataIO *stream, ssize_t *size) const 604 \brief Flatten the message to a \a stream. 605 606 \param[in] stream The stream to flatten the message to. 607 \param[out] size The method writes the number of bytes actually written to 608 this argument. 609 \return \c B_OK in case of success, or an error code in case something went 610 awry. 611 612 \warning Make sure the subclass of the BDataIO interface either protects 613 against buffer overwrites, or check if the number of bytes that is 614 going to be written isn't larger than it can handle. 615 \see FlattenedSize() 616 \see Flatten(char *buffer, ssize_t size) const 617*/ 618 619 620/*! 621 \fn status_t BMessage::Unflatten(const char *flatBuffer) 622 \brief Unflatten a message from a buffer and put it into the current 623 object. 624 625 This action clears the current contents of the message. 626 627 \param flatBuffer The buffer that contains the message. 628 629 \returns A status code, \c B_OK on success or an error code. 630 \retval B_OK The buffer has been unflattened. 631 \retval B_BAD_VALUE The buffer does not contain a valid message. 632 \retval B_NO_MEMORY An error occured whilst allocating memory for the data 633 members. 634 \see Flatten(char *buffer, ssize_t size) const 635 \see Unflatten(BDataIO *stream) 636*/ 637 638 639/*! 640 \fn status_t BMessage::Unflatten(BDataIO *stream) 641 \brief Unflatten a message from a stream and put it into the current 642 object. 643 644 This action clears the current contents of the message. 645 646 \param stream The stream that contains the message. 647 648 \returns A status code, \c B_OK on success or an error code. 649 \retval B_OK The message has been unflattened. 650 \retval B_BAD_VALUE The stream does not contain a valid message. 651 \retval B_NO_MEMORY An error occured whilst allocating memory for the data 652 members. 653 \see Flatten(BDataIO *stream, ssize_t *size) const 654 \see Unflatten(const char *flatBuffer) 655*/ 656 657 658//! @} 659 660 661/*! 662 \name Specifiers (scripting) 663*/ 664 665 666//! @{ 667 668 669/*! 670 \fn status_t BMessage::AddSpecifier(const char *property) 671 \brief Undocumented. 672*/ 673 674 675/*! 676 \fn status_t BMessage::AddSpecifier(const char *property, int32 index) 677 \brief Undocumented. 678*/ 679 680 681/*! 682 \fn status_t BMessage::AddSpecifier(const char *property, int32 index, 683 int32 range) 684 \brief Undocumented. 685*/ 686 687 688/*! 689 \fn status_t BMessage::AddSpecifier(const char *property, const char *name) 690 \brief Undocumented. 691*/ 692 693 694/*! 695 \fn status_t BMessage::AddSpecifier(const BMessage *specifier) 696 \brief Undocumented. 697*/ 698 699 700/*! 701 \fn status_t BMessage::SetCurrentSpecifier(int32 index) 702 \brief Undocumented. 703*/ 704 705 706/*! 707 \fn status_t BMessage::GetCurrentSpecifier(int32 *index, 708 BMessage *specifier, int32 *what, const char **property) const 709 \brief Undocumented. 710*/ 711 712 713/*! 714 \fn bool BMessage::HasSpecifiers() const 715 \brief Undocumented. 716*/ 717 718 719/*! 720 \fn status_t BMessage::PopSpecifier() 721 \brief Undocumented. 722*/ 723 724 725//! @} 726 727 728/*! 729 \name Adding Data 730*/ 731 732 733//! @{ 734 735 736/*! 737 \fn status_t BMessage::AddData(const char *name, type_code type, 738 const void *data, ssize_t numBytes, bool isFixedSize, int32 count) 739 \brief Add \a data of a certain \a type to the message. 740 741 The amount of \a numBytes is copied into the message. The data is 742 stored at the label specified in \a name. You are responsible for 743 specifying the correct \a type. The Haiku API already specifies 744 many constants, such as \c B_FLOAT_TYPE or \c B_RECT_TYPE. See 745 TypeConstants.h for more information on the system-wide defined types. 746 747 If the field with the \a name already exists, the data is added in 748 an array-like form. If you are adding a certain \a name for the 749 first time, you are able to specify some properties of this array. You can 750 fix the size of each data entry, and you can also instruct BMessage to 751 allocate a \a count of items. The latter does not mean that the 752 number of items is fixed; the array will grow nonetheless. Also, note that 753 every \a name can only be associated with one \a type of 754 data. 755 756 If consecutive method calls specify a different \a type than the 757 initial, these calls will fail. 758 759 There is no limit to the number of labels, or the amount of data, but 760 note that searching of data members is linear, as well as that some 761 messages will be copied whilst being passed around, so if the amount of 762 data you need to pass is too big, find another way to pass it. 763 764 \param name The label to which this data needs to be associated. If the 765 \a name already exists, the new data will be added in an 766 array-like style. 767 \param type The type of data. If you are adding data to the same 768 \a name, make sure it is the same type. 769 \param data The data buffer to copy the bytes from. 770 \param numBytes The number of bytes to be copied. If this is the first call 771 to this method for this type of data, and you set 772 \a isFixedSize to \c true, this will specify the size of all 773 consecutive calls to this 774 method. 775 \param isFixedSize If this is the first call to this method with this 776 \a name, you can specify the whether or not all items in this 777 array should have the same fixed size. 778 \param count If this is the first call to this method with this 779 \a name, you can instruct this message to allocate a number of 780 items in advance. This does not limit the amount of items though. The 781 array will grow if needed. 782 783 \returns A status code, \c B_OK on success or an error code. 784 \retval B_OK The \a data is succesfully added. 785 \retval B_BAD_VALUE The \a numBytes is less than, or equal to \c 0, 786 or the size of this item is larger than the \a name allows, 787 since it has been specified to have a fixed size. 788 \retval B_ERROR There was an error whilst creating the label with your 789 \a name. 790 \retval B_BAD_TYPE The \a type you specified is different than the 791 one already associated with \a name. 792*/ 793 794 795/*! 796 \fn status_t BMessage::AddRect(const char *name, BRect aRect) 797 \brief Convenience method to add a BRect to the label \a name. 798 799 This method calls AddData() with the \c B_RECT_TYPE \a type. 800 801 \param name The label to associate the data with. 802 \param aRect The rectangle to store in the message. 803 804 \returns A status code, \c B_OK on success or an error code. 805 806 \see AddData() for a more detailed overview of the inner workings. 807 \see FindRect() 808 \see GetRect() 809 \see ReplaceRect() 810*/ 811 812 813/*! 814 \fn status_t BMessage::AddPoint(const char *name, BPoint aPoint) 815 \brief Convenience method to add a BPoint to the label \a name. 816 817 This method calls AddData() with the \c B_POINT_TYPE \a type. 818 819 \param name The label to associate the data with. 820 \param aPoint The point to store in the message. 821 822 \returns A status code, \c B_OK on success or an error code. 823 824 \see AddData() for a more detailed overview of the inner workings. 825 \see FindPoint() 826 \see GetPoint() 827 \see ReplacePoint() 828*/ 829 830 831/*! 832 \fn status_t BMessage::AddString(const char *name, const char *aString) 833 \brief Convenience method to add a C-string to the label \a name. 834 835 This method calls AddData() with the \c B_STRING_TYPE \a type. 836 837 \param name The label to associate the data with. 838 \param aString The string to copy to the message. 839 840 \returns A status code, \c B_OK on success or an error code. 841 842 \see AddData() for a more detailed overview of the inner workings. 843 \see FindString() 844 \see GetString() 845 \see ReplaceString() 846*/ 847 848 849/*! 850 \fn status_t BMessage::AddString(const char *name, const BString &aString) 851 \brief Convenience method to add a BString to the label \a name. 852 853 This method calls AddData() with the \c B_STRING_TYPE \a type. 854 855 \param name The label to associate the data with. 856 \param aString The string to copy to the message. 857 858 \returns A status code, \c B_OK on success or an error code. 859 860 \see AddData() for a more detailed overview of the inner workings. 861 \see FindString() 862 \see GetString() 863 \see ReplaceString() 864*/ 865 866 867/*! 868 \fn status_t BMessage::AddInt8(const char *name, int8 value) 869 \brief Convenience method to add an \c int8 to the label \a name. 870 871 This method calls AddData() with the \c B_INT8_TYPE \a type. 872 873 \param name The label to associate the data with. 874 \param value The value to store in the message. 875 876 \returns A status code, \c B_OK on success or an error code. 877 878 \see AddData() for a more detailed overview of the inner workings. 879 \see FindInt8() 880 \see GetInt8() 881 \see ReplaceInt8() 882*/ 883 884 885/*! 886 \fn status_t BMessage::AddInt16(const char *name, int16 value) 887 \brief Convenience method to add an \c int16 to the label \a name. 888 889 This method calls AddData() with the \c B_INT16_TYPE \a type. 890 891 \param name The label to associate the data with. 892 \param value The value to store in the message. 893 894 \returns A status code, \c B_OK on success or an error code. 895 896 \see AddData() for a more detailed overview of the inner workings. 897 \see FindInt16() 898 \see GetInt16() 899 \see ReplaceInt16() 900*/ 901 902 903/*! 904 \fn status_t BMessage::AddInt32(const char *name, int32 value) 905 \brief Convenience method to add an \c int32 to the label \a name. 906 907 This method calls AddData() with the \c B_INT32_TYPE \a type. 908 909 \param name The label to associate the data with. 910 \param value The value to store in the message. 911 912 \returns A status code, \c B_OK on success or an error code. 913 914 \see AddData() for a more detailed overview of the inner workings. 915 \see FindInt32() 916 \see GetInt32() 917 \see ReplaceInt32() 918*/ 919 920 921/*! 922 \fn status_t BMessage::AddInt64(const char *name, int64 value) 923 \brief Convenience method to add an \c int64 to the label \a name. 924 925 This method calls AddData() with the \c B_INT64_TYPE \a type. 926 927 \param name The label to associate the data with. 928 \param value The value to store in the message. 929 930 \returns A status code, \c B_OK on success or an error code. 931 932 \see AddData() for a more detailed overview of the inner workings. 933 \see FindInt64() 934 \see GetInt64() 935 \see ReplaceInt64() 936*/ 937 938 939/*! 940 \fn status_t BMessage::AddBool(const char *name, bool aBoolean) 941 \brief Convenience method to add a \c bool to the label \a name. 942 943 This method calls AddData() with the \c B_BOOL_TYPE \a type. 944 945 \param name The label to associate the data with. 946 \param aBoolean The value to store in the message. 947 948 \returns A status code, \c B_OK on success or an error code. 949 950 \see AddData() for a more detailed overview of the inner workings. 951 \see FindBool() 952 \see GetBool() 953 \see ReplaceBool() 954*/ 955 956/*! 957 \fn status_t BMessage::AddFloat(const char *name, float aFloat) 958 \brief Convenience method to add a \c float to the label \a name. 959 960 This method calls AddData() with the \c B_FLOAT_TYPE \a type. 961 962 \param name The label to associate the data with. 963 \param aFloat The value to store in the message. 964 965 \returns A status code, \c B_OK on success or an error code. 966 967 \see AddData() for a more detailed overview of the inner workings. 968 \see FindFloat() 969 \see GetFloat() 970 \see ReplaceFloat() 971*/ 972 973 974/*! 975 \fn status_t BMessage::AddDouble(const char *name, double aDouble) 976 \brief Convenience method to add a \c double to the label \a name. 977 978 This method calls AddData() with the \c B_DOUBLE_TYPE \a type. 979 980 \param name The label to associate the data with. 981 \param aDouble The value to store in the message. 982 983 \returns A status code, \c B_OK on success or an error code. 984 985 \see AddData() for a more detailed overview of the inner workings. 986 \see FindDouble() 987 \see GetDouble() 988 \see ReplaceDouble() 989*/ 990 991 992/*! 993 \fn status_t BMessage::AddPointer(const char *name, const void *aPointer) 994 \brief Convenience method to add a \c pointer to the label \a name. 995 996 This method calls AddData() with the \c B_POINTER_TYPE \a type. 997 998 \warning If you want to share objects between applications, remember 999 that each application has its own address space, and that it therefore 1000 is useless to try to pass around objects by sending pointers in 1001 messages. You should think about copying the entire object in the 1002 message, or you should consider using shared memory. 1003 1004 \param name The label to associate the data with. 1005 \param aPointer The value to store in the message. 1006 1007 \returns A status code, \c B_OK on success or an error code. 1008 1009 \see AddData() for a more detailed overview of the inner workings. 1010 \see FindPointer() 1011 \see GetPointer() 1012 \see ReplacePointer() 1013*/ 1014 1015 1016/*! 1017 \fn status_t BMessage::AddMessenger(const char *name, BMessenger messenger) 1018 \brief Convenience method to add a messenger to the label \a name. 1019 1020 This method calls AddData() with the \c B_MESSENGER_TYPE \a type. 1021 1022 \param name The label to associate the data with. 1023 \param messenger The messenger to store in the message. 1024 1025 \returns A status code, \c B_OK on success or an error code. 1026 1027 \see AddData() for a more detailed overview of the inner workings. 1028 \see FindMessenger() 1029 \see ReplaceMessenger() 1030*/ 1031 1032 1033/*! 1034 \fn status_t BMessage::AddRef(const char *name, const entry_ref *ref) 1035 \brief Convenience method to add an \c entry_ref to the label 1036 \a name. 1037 1038 This method calls AddData() with the \c B_REF_TYPE \a type. 1039 1040 \param name The label to associate the data with. 1041 \param ref The reference to store in the message. 1042 1043 \returns A status code, \c B_OK on success or an error code. 1044 1045 \see AddData() for a more detailed overview of the inner workings. 1046 \see FindRef() 1047 \see ReplaceRef() 1048*/ 1049 1050 1051/*! 1052 \fn status_t BMessage::AddMessage(const char *name, const BMessage *message) 1053 \brief Convenience method to add a message to the label \a name. 1054 1055 This method calls AddData() with the \c B_MESSAGE_TYPE \a type. 1056 1057 \param name The label to associate the data with. 1058 \param message The message to store in this message. 1059 1060 \returns A status code, \c B_OK on success or an error code. 1061 1062 \see AddData() for a more detailed overview of the inner workings. 1063 \see FindMessage() 1064 \see ReplaceMessage() 1065*/ 1066 1067 1068/*! 1069 \fn status_t BMessage::AddFlat(const char *name, BFlattenable *object, 1070 int32 count = 1) 1071 \brief Convenience method to add a flattenable to the label \a name. 1072 1073 This method uses BFlattenable::TypeCode() to determine the type. It also 1074 uses BFlattenable::IsFixedSize() to determine whether or not the size of 1075 the object is supposedly always the same. You can specify a 1076 \a count, to pre-allocate more entries if you are going to add 1077 more than one of this type. 1078 1079 \param name The label to associate the data with. 1080 \param object The object to flatten into the message. 1081 \param count The number of items to pre-allocate associated with this 1082 \a name. 1083 1084 \returns A status code, \c B_OK on success or an error code. 1085 1086 \see AddData() for a more detailed overview of the inner workings. 1087 \see FindFlat() 1088 \see ReplaceFlat() 1089*/ 1090 1091 1092//! @} 1093 1094 1095/*! 1096 \name Removing Data 1097*/ 1098 1099 1100//! @{ 1101 1102 1103/*! 1104 \fn status_t BMessage::RemoveData(const char *name, int32 index) 1105 \brief Remove data associated with \a name at a specified 1106 \a index. 1107 1108 If this is the only instance of the data, then the entire label will be 1109 removed. This means you can recreate it with another type. 1110 1111 \param name The \a name of which the associated data should be cleared. 1112 \param index The \a index of the item that should be cleared. 1113 1114 \returns A status code, \c B_OK on success or an error code. 1115 \retval B_OK The data has been removed. 1116 \retval B_BAD_VALUE The \a index is less than \c 0. 1117 \retval B_BAD_INDEX The \a index is out of bounds. 1118 \retval B_NAME_NOT_FOUND The \a name does not have any data associated 1119 with it. 1120 1121 \see RemoveName() 1122 \see MakeEmpty() 1123*/ 1124 1125 1126/*! 1127 \fn status_t BMessage::RemoveName(const char *name) 1128 \brief Remove all data associated with a \a name. 1129 1130 This also removes the label, so that you can recreate it with another type, 1131 if you want to. 1132 1133 \param name The \a name that refers to the data you want to clear out. 1134 1135 \returns A status code, \c B_OK on success or an error code. 1136 \retval B_OK All the data is removed. 1137 \retval B_BAD_VALUE The \a name pointer points to \c NULL. 1138 \retval B_NAME_NOT_FOUND The \a name does not exist in this message. 1139 1140 \see RemoveData() 1141 \see MakeEmpty() 1142*/ 1143 1144 1145/*! 1146 \fn status_t BMessage::MakeEmpty() 1147 \brief Clear all data and metadata in this message. 1148 1149 Everything is cleared out, all labels and all associated data, as well 1150 as metadata such as reply info. 1151 1152 \return This method always returns \c B_OK. 1153 1154 \see RemoveData() 1155 \see RemoveName() 1156*/ 1157 1158 1159//! @} 1160 1161 1162/*! 1163 \name Finding Data 1164 1165 Look at FindData() for a general introduction to finding data. 1166*/ 1167 1168/* TODO: 1169 Quick overview: 1170 1171 <table> 1172 <tr><th>Type of data</th><th>Type code</th><th>Method</td></tr> 1173 <tr><td>BRect</td><td>\c B_RECT_TYPE</td><td>FindRect()</td></tr> 1174 </table> 1175*/ 1176 1177 1178//! @{ 1179 1180 1181/*! 1182 \fn status_t BMessage::FindData(const char *name, type_code type, 1183 int32 index, const void **data, ssize_t *numBytes) const 1184 \brief Find \a data that is stored in this message at an 1185 \a index. 1186 1187 This method matches the label \a name with the \a type you 1188 are asking for, and it looks for the data that is stored at a certain 1189 \a index number. If all these things match, you will get a pointer 1190 to the internal buffer, and the method will put the size of the item in 1191 \a numBytes. 1192 1193 Note that only this method, and FindString(const char *, const char **), 1194 pass a pointer to the internal buffer. The other more specific methods, 1195 such as FindBool() and FindRect() copy the data into a buffer you specify. 1196 This means that the data retrieved with this method is valid until the 1197 message is deleted. 1198 1199 \param name The label the data should be associated with. 1200 \param type The type of data you want to retrieve. You can pass 1201 \c B_ANY_TYPE if you don't mind which type the data is. 1202 \param index The index in the array of the data that you want to retrieve. 1203 Note that the array is zero-based. 1204 \param[out] data A pointer to a pointer where the data can point to. 1205 \param[out] numBytes The size of the data will be put in this parameter. 1206 1207 \returns A status code, \c B_OK on success or an error code. 1208 \retval B_OK The \a name was found, matches the type, and the data 1209 at \a index has been put in \a data. 1210 \retval B_BAD_VALUE One of the output arguments were \c NULL. 1211 \retval B_BAD_INDEX The \a index does not exist. 1212 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1213 1214 \see status_t FindData(const char *, type_code, int32, 1215 const void **, ssize_t *) const 1216*/ 1217 1218 1219/*! 1220 \fn status_t BMessage::FindData(const char *name, type_code type, 1221 const void **data, ssize_t *numBytes) const 1222 \brief Find \a data that is stored in this message. 1223 1224 This is an overloaded version of 1225 FindData(const char *, type_code, int32, const void **, ssize_t *) const 1226 where data is sought at \a index \c 0. 1227*/ 1228 1229 1230/*! 1231 \fn status_t BMessage::FindRect(const char *name, BRect *rect) const 1232 \brief Find a rectangle at the label \a name. 1233 1234 This is an overloaded version of 1235 FindRect(const char *, int32, BRect *) const 1236 where the data is sought at \a index \c 0. 1237*/ 1238 1239 1240/*! 1241 \fn status_t BMessage::FindRect(const char *name, int32 index, BRect *rect) const 1242 \brief Find a rectangle at the label \a name at an \a index. 1243 1244 This method looks for the data with the \c B_RECT_TYPE, and copies it into 1245 a provided buffer. 1246 1247 \param name The label to which the data is associated. 1248 \param index The index from which the data should be copied. 1249 \param rect The object in which the data should be copied. 1250 1251 \returns A status code, \c B_OK on success or an error code. 1252 \retval B_OK The object now contains the requested data. 1253 \retval B_BAD_INDEX The \a index does not exist. 1254 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1255 1256 \see FindRect(const char *, BRect *) const 1257*/ 1258 1259 1260/*! 1261 \fn status_t BMessage::FindPoint(const char *name, BPoint *point) const 1262 \brief Find a point at the label \a name. 1263 1264 This is an overloaded version of 1265 FindPoint(const char *, int32, BPoint *) const 1266 where the data is sought at \a index \c 0. 1267*/ 1268 1269 1270/*! 1271 \fn status_t BMessage::FindPoint(const char *name, int32 index, BPoint *point) const 1272 \brief Find a point at the label \a name at an \a index. 1273 1274 This method looks for the data with the \c B_POINT_TYPE, and copies it into 1275 a provided buffer. 1276 1277 \param name The label to which the data is associated. 1278 \param index The index from which the data should be copied. 1279 \param point The object in which the data should be copied. 1280 1281 \returns A status code, \c B_OK on success or an error code. 1282 \retval B_OK The object now contains the requested data. 1283 \retval B_BAD_INDEX The \a index does not exist. 1284 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1285 1286 \see FindPoint(const char *, BPoint *) const 1287*/ 1288 1289 1290/*! 1291 \fn status_t BMessage::FindString(const char *name, const char **string) const 1292 \brief Find a string at the label \a name. 1293 1294 This is an overloaded version of 1295 FindString(const char *, int32, const char **) const 1296 where the data is sought at \a index \c 0. 1297*/ 1298 1299 1300/*! 1301 \fn status_t BMessage::FindString(const char *name, int32 index, 1302 const char ** string) const 1303 \brief Find a string at the label \a name at an \a index. 1304 1305 This method looks for the data with the \c B_STRING_TYPE, and returns a 1306 pointer to the internal buffer of the message. Note that this pointer is 1307 valid, until the message is deleted. 1308 1309 \param name The label to which the data is associated. 1310 \param index The index from which the data should be copied. 1311 \param string The object in which the data should be copied. 1312 1313 \returns A status code, \c B_OK on success or an error code. 1314 \retval B_OK The object now contains the requested data. 1315 \retval B_BAD_INDEX The \a index does not exist. 1316 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1317 1318 \see FindString(const char *, const char **) const 1319 \see FindString(const char *, int32, BString *) const 1320*/ 1321 1322 1323/*! 1324 \fn status_t BMessage::FindString(const char *name, BString *string) const 1325 \brief Find a string at the label \a name. 1326 1327 This is an overloaded version of 1328 FindString(const char *, int32, BString *) const 1329 where the data is sought at \a index \c 0. 1330*/ 1331 1332 1333/*! 1334 \fn status_t BMessage::FindString(const char *name, int32 index, BString *string) const 1335 \brief Find a string at the label \a name at an \a index. 1336 1337 This method looks for the data with the \c B_STRING_TYPE, and copies it 1338 into the \a string object. 1339 1340 \param name The label to which the data is associated. 1341 \param index The index from which the data should be copied. 1342 \param string The object in which the data should be copied. 1343 1344 \returns A status code, \c B_OK on success or an error code. 1345 \retval B_OK The object now contains the requested data. 1346 \retval B_BAD_INDEX The \a index does not exist. 1347 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1348 1349 \see FindString(const char *, BString *) const 1350 \see FindString(const char *, int32, const char **) const 1351*/ 1352 1353 1354/*! 1355 \fn status_t BMessage::FindInt8(const char *name, int8 *value) const 1356 \brief Find an integer at the label \a name. 1357 1358 This is an overloaded version of FindInt8(const char *, int32, int8 *) const 1359 where the data is sought at \a index \c 0. 1360*/ 1361 1362 1363/*! 1364 \fn status_t BMessage::FindInt8(const char *name, int32 index, int8 *value) const 1365 \brief Find an integer at the label \a name at an \a index. 1366 1367 This method looks for the data with the \c B_INT8_TYPE, and copies it into 1368 a provided buffer. 1369 1370 \param name The label to which the data is associated. 1371 \param index The index from which the data should be copied. 1372 \param value The object in which the data should be copied. 1373 1374 \returns A status code, \c B_OK on success or an error code. 1375 \retval B_OK The object now contains the requested data. 1376 \retval B_BAD_INDEX The \a index does not exist. 1377 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1378 1379 \see FindInt8(const char *, int8 *) const 1380*/ 1381 1382 1383/*! 1384 \fn status_t BMessage::FindInt16(const char *name, int16 *value) const 1385 \brief Find an integer at the label \a name. 1386 1387 This is an overloaded version of FindInt8(const char *, int32, int16 *) const 1388 where the data is sought at \a index \c 0. 1389 1390 \param name The label to which the data is associated. 1391 \param value The object in which the data should be copied. 1392 1393 \returns A status code, \c B_OK on success or an error code. 1394 \retval B_OK The object now contains the requested data. 1395 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1396*/ 1397 1398 1399/*! 1400 \fn status_t BMessage::FindInt16(const char *name, int32 index, int16 *value) const 1401 \brief Find an integer at the label \a name at an \a index. 1402 1403 This method looks for the data with the \c B_INT16_TYPE, and copies it into 1404 a provided buffer. 1405 1406 \param name The label to which the data is associated. 1407 \param index The index from which the data should be copied. 1408 \param value The object in which the data should be copied. 1409 1410 \returns A status code, \c B_OK on success or an error code. 1411 \retval B_OK The object now contains the requested data. 1412 \retval B_BAD_INDEX The \a index does not exist. 1413 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1414 1415 \see FindInt16(const char *, int16 *) const 1416*/ 1417 1418 1419/*! 1420 \fn status_t BMessage::FindInt32(const char *name, int32 *value) const 1421 \brief Find an integer at the label \a name. 1422 1423 This is an overloaded version of 1424 FindInt32(const char *, int32, int32 *) const 1425 where the data is sought at \a index \c 0. 1426 1427 \param name The label to which the data is associated. 1428 \param value The object in which the data should be copied. 1429 1430 \returns A status code, \c B_OK on success or an error code. 1431 \retval B_OK The object now contains the requested data. 1432 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1433*/ 1434 1435 1436/*! 1437 \fn status_t BMessage::FindInt32(const char *name, int32 index, int32 *value) const 1438 \brief Find an integer at the label \a name at an \a index. 1439 1440 This method looks for the data with the \c B_INT32_TYPE, and copies it into 1441 a provided buffer. 1442 1443 \param name The label to which the data is associated. 1444 \param index The index from which the data should be copied. 1445 \param value The object in which the data should be copied. 1446 1447 \returns A status code, \c B_OK on success or an error code. 1448 \retval B_OK The object now contains the requested data. 1449 \retval B_BAD_INDEX The \a index does not exist. 1450 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1451 1452 \see FindInt32(const char *, int32 *) const 1453*/ 1454 1455 1456/*! 1457 \fn status_t BMessage::FindInt64(const char *name, int64 *value) const 1458 \brief Find an integer at the label \a name. 1459 1460 This is an overloaded version of 1461 FindInt64(const char *, int32, int64 *) const 1462 where the data is sought at \a index \c 0. 1463 1464 \param name The label to which the data is associated. 1465 \param value The object in which the data should be copied. 1466 1467 \returns A status code, \c B_OK on success or an error code. 1468 \retval B_OK The object now contains the requested data. 1469 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1470*/ 1471 1472 1473/*! 1474 \fn status_t BMessage::FindInt64(const char *name, int32 index, int64 *value) const 1475 \brief Find an integer at the label \a name at an \a index. 1476 1477 This method looks for the data with the \c B_INT64_TYPE, and copies it into 1478 a provided buffer. 1479 1480 \param name The label to which the data is associated. 1481 \param index The index from which the data should be copied. 1482 \param value The object in which the data should be copied. 1483 1484 \returns A status code, \c B_OK on success or an error code. 1485 \retval B_OK The object now contains the requested data. 1486 \retval B_BAD_INDEX The \a index does not exist. 1487 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1488 1489 \see FindInt64(const char *, int64 *) const 1490*/ 1491 1492 1493/*! 1494 \fn status_t BMessage::FindBool(const char *name, bool *value) const 1495 \brief Find a boolean at the label \a name. 1496 1497 This is an overloaded version of 1498 FindBool(const char *, int32, bool *) const 1499 where the data is sought at \a index \c 0. 1500 1501 \param name The label to which the data is associated. 1502 \param value The object in which the data should be copied. 1503 1504 \returns A status code, \c B_OK on success or an error code. 1505 \retval B_OK The object now contains the requested data. 1506 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1507*/ 1508 1509 1510/*! 1511 \fn status_t BMessage::FindBool(const char *name, int32 index, bool *value) const 1512 \brief Find a boolean at the label \a name at an \a index. 1513 1514 This method looks for the data with the \c B_BOOL_TYPE, and copies it into 1515 a provided buffer. 1516 1517 \param name The label to which the data is associated. 1518 \param index The index from which the data should be copied. 1519 \param value The object in which the data should be copied. 1520 1521 \returns A status code, \c B_OK on success or an error code. 1522 \retval B_OK The object now contains the requested data. 1523 \retval B_BAD_INDEX The \a index does not exist. 1524 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1525 1526 \see FindBool(const char *, bool *) const 1527*/ 1528 1529 1530/*! 1531 \fn status_t BMessage::FindFloat(const char *name, float *value) const 1532 \brief Find a float at the label \a name. 1533 1534 This is an overloaded version of 1535 FindFloat(const char *, int32, float *) const 1536 where the data is sought at \a index \c 0. 1537 1538 \param name The label to which the data is associated. 1539 \param value The object in which the data should be copied. 1540 1541 \returns A status code, \c B_OK on success or an error code. 1542 \retval B_OK The object now contains the requested data. 1543 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1544*/ 1545 1546 1547/*! 1548 \fn status_t BMessage::FindFloat(const char *name, int32 index, float *value) const 1549 \brief Find a float at the label \a name at an \a index. 1550 1551 This method looks for the data with the \c B_FLOAT_TYPE, and copies it into 1552 a provided buffer. 1553 1554 \param name The label to which the data is associated. 1555 \param index The index from which the data should be copied. 1556 \param value The object in which the data should be copied. 1557 1558 \returns A status code, \c B_OK on success or an error code. 1559 \retval B_OK The object now contains the requested data. 1560 \retval B_BAD_INDEX The \a index does not exist. 1561 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1562 1563 \see FindFloat(const char *, float *) const 1564*/ 1565 1566 1567/*! 1568 \fn status_t BMessage::FindDouble(const char *name, double *value) const 1569 \brief Find a double at the label \a name. 1570 1571 This is an overloaded version of 1572 FindDouble(const char *, int32, double *) const 1573 where the data is sought at \a index \c 0. 1574 1575 \param name The label to which the data is associated. 1576 \param value The object in which the data should be copied. 1577 1578 \returns A status code, \c B_OK on success or an error code. 1579 \retval B_OK The object now contains the requested data. 1580 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1581*/ 1582 1583 1584/*! 1585 \fn status_t BMessage::FindDouble(const char *name, int32 index, double *value) const 1586 \brief Find a double at the label \a name at an \a index. 1587 1588 This method looks for the data with the \c B_DOUBLE_TYPE, and copies it into 1589 a provided buffer. 1590 1591 \param name The label to which the data is associated. 1592 \param index The index from which the data should be copied. 1593 \param value The object in which the data should be copied. 1594 1595 \returns A status code, \c B_OK on success or an error code. 1596 \retval B_OK The object now contains the requested data. 1597 \retval B_BAD_INDEX The \a index does not exist. 1598 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1599 1600 \see FindDouble(const char *, double *) const 1601*/ 1602 1603 1604/*! 1605 \fn status_t BMessage::FindPointer(const char *name, void **pointer) const 1606 \brief Find a pointer at the label \a name. 1607 1608 This is an overloaded version of 1609 FindPointer(const char *, int32, void *) const 1610 where the data is sought at \a index \c 0. 1611 1612 \param name The label to which the data is associated. 1613 \param pointer The object in which the data should be copied. 1614 1615 \returns A status code, \c B_OK on success or an error code. 1616 \retval B_OK The object now contains the requested data. 1617 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1618*/ 1619 1620 1621/*! 1622 \fn status_t BMessage::FindPointer(const char *name, int32 index, void **pointer) const 1623 \brief Find a pointer at the label \a name at an \a index. 1624 1625 This method looks for the data with the \c B_POINTER_TYPE, and copies it into 1626 a provided buffer. 1627 1628 \warning If you want to share objects between applications, remember 1629 that each application has its own address space, and that it therefore 1630 is useless to try to pass around objects by sending pointers in 1631 messages. You should think about copying the entire object in the 1632 message, or you should consider using shared memory. 1633 1634 \param name The label to which the data is associated. 1635 \param index The index from which the data should be copied. 1636 \param pointer The object in which the data should be copied. 1637 1638 \returns A status code, \c B_OK on success or an error code. 1639 \retval B_OK The object now contains the requested data. 1640 \retval B_BAD_INDEX The \a index does not exist. 1641 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1642 1643 \see FindPointer(const char *, double *) const 1644*/ 1645 1646 1647/*! 1648 \fn status_t BMessage::FindMessenger(const char* name, BMessenger* messenger) const 1649 \brief Find a messenger at the label \a name. 1650 1651 This is an overloaded version of 1652 FindMessenger(const char *, int32, BMessenger *) const 1653 where the data is sought at \a index \c 0. 1654 1655 \param name The label to which the data is associated. 1656 \param messenger The object in which the data should be copied. 1657 1658 \returns A status code, \c B_OK on success or an error code. 1659 \retval B_OK The object now contains the requested data. 1660 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1661*/ 1662 1663 1664/*! 1665 \fn status_t BMessage::FindMessenger(const char *name, int32 index, BMessenger *messenger) const 1666 \brief Find a messenger at the label \a name at an \a index. 1667 1668 This method looks for the data with the \c B_MESSENGER_TYPE, and copies it 1669 into a provided buffer. 1670 1671 \param name The label to which the data is associated. 1672 \param index The index from which the data should be copied. 1673 \param messenger The object in which the data should be copied. 1674 1675 \returns A status code, \c B_OK on success or an error code. 1676 \retval B_OK The object now contains the requested data. 1677 \retval B_BAD_INDEX The \a index does not exist. 1678 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1679 1680 \see FindMessenger(const char *, BMessenger *) const 1681*/ 1682 1683 1684/*! 1685 \fn status_t BMessage::FindRef(const char *name, entry_ref *ref) const 1686 \brief Find a reference to a file at the label \a name. 1687 1688 This is an overloaded version of 1689 FindRef(const char *, int32, entry_ref *) const 1690 where the data is sought at \a index \c 0. 1691 1692 \param name The label to which the data is associated. 1693 \param ref The object in which the data should be copied. 1694 1695 \returns A status code, \c B_OK on success or an error code. 1696 \retval B_OK The object now contains the requested data. 1697 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1698*/ 1699 1700 1701/*! 1702 \fn status_t BMessage::FindRef(const char *name, int32 index, entry_ref *ref) const 1703 \brief Find a reference to a file at the label \a name at an 1704 \a index. 1705 1706 This method looks for the data with the \c B_REF_TYPE, and copies it into 1707 a provided buffer. 1708 1709 \param name The label to which the data is associated. 1710 \param index The index from which the data should be copied. 1711 \param ref The object in which the data should be copied. 1712 1713 \returns A status code, \c B_OK on success or an error code. 1714 \retval B_OK The object now contains the requested data. 1715 \retval B_BAD_INDEX The \a index does not exist. 1716 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1717 1718 \see FindRef(const char *, entry_ref *) const 1719*/ 1720 1721 1722/*! 1723 \fn status_t BMessage::FindMessage(const char *name, BMessage *message) const 1724 \brief Find a message at the label \a name. 1725 1726 This is an overloaded version of 1727 FindMessage(const char *, int32, BMessage *) const 1728 where the data is sought at \a index \c 0. 1729 1730 \param name The label to which the data is associated. 1731 \param message The object in which the data should be copied. 1732 1733 \returns A status code, \c B_OK on success or an error code. 1734 \retval B_OK The object now contains the requested data. 1735 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1736*/ 1737 1738 1739/*! 1740 \fn status_t BMessage::FindMessage(const char *name, int32 index, BMessage *message) const 1741 \brief Find a message at the label \a name at an \a index. 1742 1743 This method looks for the data with the \c B_MESSAGE_TYPE, and copies it 1744 into a provided buffer. 1745 1746 \param name The label to which the data is associated. 1747 \param index The index from which the data should be copied. 1748 \param message The object in which the data should be copied. 1749 1750 \returns A status code, \c B_OK on success or an error code. 1751 \retval B_OK The object now contains the requested data. 1752 \retval B_BAD_INDEX The \a index does not exist. 1753 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1754 1755 \see FindMessage(const char *, BMessage *) const 1756*/ 1757 1758 1759/*! 1760 \fn status_t BMessage::FindFlat(const char *name, BFlattenable *object) const 1761 \brief Find a flattened object at the label \a name. 1762 1763 This is an overloaded version of 1764 FindFlat(const char *, int32, BFlattenable *) const 1765 where the data is sought at \a index \c 0. 1766 1767 \param name The label to which the data is associated. 1768 \param object The object in which the data should be unflattened. 1769 1770 \returns A status code, \c B_OK on success or an error code. 1771 \retval B_OK The object now contains the requested data. 1772 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1773*/ 1774 1775 1776/*! 1777 \fn status_t BMessage::FindFlat(const char *name, int32 index, 1778 BFlattenable *object) const 1779 \brief Find a flattened object at the label \a name at an 1780 \a index. 1781 1782 The type is determined by the type of the passed object. If that type is 1783 available at the specified label, then the Unflatten() method of that 1784 object will be called. 1785 1786 \param name The label to which the data is associated. 1787 \param index The index from which the data should be unflattened. 1788 \param object The object in which the data should be unflattened. 1789 1790 \returns A status code, \c B_OK on success or an error code. 1791 \retval B_OK The object now contains the requested data. 1792 \retval B_BAD_INDEX The \a index does not exist. 1793 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1794 1795 \see FindFlat(const char *, BFlattenable *) const 1796*/ 1797 1798 1799//! @} 1800 1801 1802/*! 1803 \name Replacing Data 1804 1805 Look at ReplaceData() for a general introduction to replacing data. 1806*/ 1807 1808 1809//! @{ 1810 1811 1812/*! 1813 \fn status_t BMessage::ReplaceData(const char *name, type_code type, 1814 const void *data, ssize_t numBytes) 1815 \brief Replace the data at label \a name. 1816 1817 This method is an overloaded method that replaces the data at 1818 \a index \c 0. See 1819 ReplaceData(const char *, type_code, int32, const void *, ssize_t). 1820 1821 \param name The name associated with the data to replace. 1822 \param type The type of the data. 1823 \param data A pointer to the new data that needs to be copied into the 1824 message. 1825 \param numBytes The size of the new data. 1826 1827 \returns A status code, \c B_OK on success or an error code. 1828*/ 1829 1830 1831/*! 1832 \fn status_t BMessage::ReplaceData(const char *name, type_code type, 1833 int32 index, const void *data, ssize_t numBytes) 1834 \brief Replace the data at label \a name at a specified 1835 \a index. 1836 1837 The conditions for replacing data are that the\a name is correct, 1838 the \a type matches and the data entry at \a index 1839 exists. 1840 1841 There is also a collection of convenience methods, that allow you to 1842 efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()), 1843 and so on. 1844 1845 \param name The name associated with the data to replace. 1846 \param type The type of the data. 1847 \param index The index in the array to replace. 1848 \param data A pointer to the new data that needs to be copied into the 1849 message. 1850 \param numBytes The size of the new data. 1851 1852 \returns A status code, \c B_OK on success or an error code. 1853 \retval B_OK The operation succeeded. 1854 \retval B_BAD_VALUE One of the input parameters are invalid. Check that 1855 you did not pass \c NULL, and in case the field has fixed sized data, 1856 check that \a numBytes is the same as the specified fixed size. 1857 \retval B_BAD_INDEX The \a index is out of range. 1858*/ 1859 1860 1861/*! 1862 \fn status_t BMessage::ReplaceRect(const char *name, BRect aRect) 1863 \brief Replace a rectangle at the label \a name. 1864 1865 This method is an overloaded method of 1866 ReplaceRect(const char *, int32, BRect). 1867 It replaces the data at \a index \c 0. 1868 1869 \param name The name associated with the data to replace. 1870 \param aRect The object to store in the message. 1871 1872 \returns A status code, \c B_OK on success or an error code. 1873 \retval B_OK The object now contains the requested data. 1874 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1875*/ 1876 1877 1878/*! 1879 \fn status_t BMessage::ReplaceRect(const char *name, int32 index, BRect aRect) 1880 \brief Replace a rectangle at the label \a name at a specified 1881 \a index. 1882 1883 The data at the specified \a name and \a index will be replaced, if it 1884 matches the \c B_RECT_TYPE. 1885 1886 \param name The name associated with the data to replace. 1887 \param index The index in the array to replace. 1888 \param aRect The object to store in the message. 1889 1890 \returns A status code, \c B_OK on success or an error code. 1891 \retval B_OK The operation succeeded. 1892 \retval B_BAD_INDEX The index was out of range. 1893 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1894 1895 \see ReplaceRect(const char*, BRect) 1896*/ 1897 1898 1899/*! 1900 \fn status_t BMessage::ReplacePoint(const char *name, BPoint aPoint) 1901 \brief Replace a point at the label \a name. 1902 1903 This method is an overloaded method of 1904 ReplacePoint(const char *, int32, BPoint). 1905 It replaces the data at \a index \c 0. 1906 1907 \param name The name associated with the data to replace. 1908 \param aPoint The object to store in the message. 1909 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_NAME_NOT_FOUND There is no field with this \a name. 1913*/ 1914 1915 1916/*! 1917 \fn status_t BMessage::ReplacePoint(const char *name, int32 index, BPoint aPoint) 1918 \brief Replace a point at the label \a name at a specified 1919 \a index. 1920 1921 The data at the specified \a name and \a index will be replaced, if it 1922 matches the \c B_POINT_TYPE. 1923 1924 \param name The name associated with the data to replace. 1925 \param index The index in the array to replace. 1926 \param aPoint The object to store in the message. 1927 1928 \returns A status code, \c B_OK on success or an error code. 1929 \retval B_OK The operation succeeded. 1930 \retval B_BAD_INDEX The index was out of range. 1931 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1932 1933 \see ReplacePoint(const char*, aPoint) 1934*/ 1935 1936 1937/*! 1938 \fn status_t BMessage::ReplaceString(const char *name, const char *aString) 1939 \brief Replace a string at the label \a name. 1940 1941 This method is an overloaded method of 1942 ReplaceString(const char *, int32, const char *). 1943 It replaces the data at \a index \c 0. 1944 1945 \param name The name associated with the data to replace. 1946 \param aString The object to store in the message. 1947 1948 \returns A status code, \c B_OK on success or an error code. 1949 \retval B_OK The operation succeeded. 1950 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1951*/ 1952 1953 1954/*! 1955 \fn status_t BMessage::ReplaceString(const char *name, int32 index, const char *aString) 1956 \brief Replace a string at the label \a name at a specified 1957 \a index. 1958 1959 The data at the specified \a name and \a index will be 1960 replaced, if it matches the \c B_STRING_TYPE. 1961 1962 \param name The name associated with the data to replace. 1963 \param index The index in the array to replace. 1964 \param aString The object to store in the message. 1965 1966 \returns A status code, \c B_OK on success or an error code. 1967 \retval B_OK The operation succeeded. 1968 \retval B_BAD_INDEX The index was out of range. 1969 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1970 1971 \see ReplaceString(const char*, const char *) 1972*/ 1973 1974 1975/*! 1976 \fn status_t BMessage::ReplaceString(const char *name, const BString &aString) 1977 \brief Replace a string at the label \a name. 1978 1979 This method is an overloaded method of 1980 ReplaceString(const char *, int32, BString &). 1981 It replaces the data at \a index \c 0. 1982 1983 \param name The name associated with the data to replace. 1984 \param aString The object to store in the message. 1985 1986 \returns A status code, \c B_OK on success or an error code. 1987 \retval B_OK The operation succeeded. 1988 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1989*/ 1990 1991 1992/*! 1993 \fn status_t BMessage::ReplaceString(const char *name, int32 index, const BString &aString) 1994 \brief Replace a string at the label \a name at a specified 1995 \a index. 1996 1997 The data at the specified \a name and \a index will be replaced, if it 1998 matches the \c B_STRING_TYPE. 1999 2000 \param name The name associated with the data to replace. 2001 \param index The index in the array to replace. 2002 \param aString The object to store in the message. 2003 2004 \returns A status code, \c B_OK on success or an error code. 2005 \retval B_OK The operation succeeded. 2006 \retval B_BAD_INDEX The index was out of range. 2007 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2008 2009 \see ReplaceString(const char*, BString &) 2010*/ 2011 2012 2013/*! 2014 \fn status_t BMessage::ReplaceInt8(const char *name, int8 value) 2015 \brief Replace an integer at the label \a name. 2016 2017 This method is an overloaded method of 2018 ReplaceInt8(const char *, int32, int8). 2019 It replaces the data at \a index \c 0. 2020 2021 \param name The name associated with the data to replace. 2022 \param value Where to store in the message. 2023 2024 \returns A status code, \c B_OK on success or an error code. 2025 \retval B_OK The operation succeeded. 2026 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2027*/ 2028 2029 2030/*! 2031 \fn status_t BMessage::ReplaceInt8(const char *name, int32 index, int8 value) 2032 \brief Replace an integer at the label \a name at a specified 2033 \a index. 2034 2035 The data at the specified \a name and \a index will be replaced, if it 2036 matches the \c B_INT8_TYPE. 2037 2038 \param name The name associated with the data to replace. 2039 \param index The index in the array to replace. 2040 \param value Where to store in the message. 2041 2042 \returns A status code, \c B_OK on success or an error code. 2043 \retval B_OK The operation succeeded. 2044 \retval B_BAD_INDEX The index was out of range. 2045 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2046 2047 \see ReplaceInt8(const char*, int8) 2048*/ 2049 2050 2051/*! 2052 \fn status_t BMessage::ReplaceInt16(const char *name, int16 value) 2053 \brief Replace an integer at the label \a name. 2054 2055 This method is an overloaded method of 2056 ReplaceInt16(const char *, int32, int16). 2057 It replaces the data at \a index \c 0. 2058 2059 \param name The name associated with the data to replace. 2060 \param value Where to store in the message. 2061 2062 \returns A status code, \c B_OK on success or an error code. 2063 \retval B_OK The operation succeeded. 2064 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2065*/ 2066 2067 2068/*! 2069 \fn status_t BMessage::ReplaceInt16(const char *name, int32 index, int16 value) 2070 \brief Replace an integer at the label \a name at a specified 2071 \a index. 2072 2073 The data at the specified \a name and \a index will be replaced, if it 2074 matches the \c B_INT16_TYPE. 2075 2076 \param name The name associated with the data to replace. 2077 \param index The index in the array to replace. 2078 \param value Where to store in the message. 2079 2080 \returns A status code, \c B_OK on success or an error code. 2081 \retval B_OK The operation succeeded. 2082 \retval B_BAD_INDEX The index was out of range. 2083 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2084 2085 \see ReplaceInt16(const char*, int16) 2086*/ 2087 2088 2089/*! 2090 \fn status_t BMessage::ReplaceInt32(const char *name, int32 value) 2091 \brief Replace an integer at the label \a name. 2092 2093 This method is an overloaded method of 2094 ReplaceInt8(const char *, int32, int32). 2095 It replaces the data at \a index \c 0. 2096 2097 \param name The name associated with the data to replace. 2098 \param value Where to store in the message. 2099 2100 \returns A status code, \c B_OK on success or an error code. 2101 \retval B_OK The operation succeeded. 2102 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2103*/ 2104 2105 2106/*! 2107 \fn status_t BMessage::ReplaceInt32(const char *name, int32 index, int32 value) 2108 \brief Replace an integer at the label \a name at a specified 2109 \a index. 2110 2111 The data at the specified \a name and \a index will be replaced, if it 2112 matches the \c B_INT32_TYPE. 2113 2114 \param name The name associated with the data to replace. 2115 \param index The index in the array to replace. 2116 \param value The object to store in the message. 2117 2118 \returns A status code, \c B_OK on success or an error code. 2119 \retval B_OK The operation succeeded. 2120 \retval B_BAD_INDEX The index was out of range. 2121 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2122 2123 \see ReplaceInt32(const char*, int32) 2124*/ 2125 2126 2127/*! 2128 \fn status_t BMessage::ReplaceInt64(const char *name, int64 value) 2129 \brief Replace an integer at the label \a name. 2130 2131 This method is an overloaded method of 2132 ReplaceInt8(const char *, int32, int64). 2133 It replaces the data at \a index \c 0. 2134 2135 \param name The name associated with the data to replace. 2136 \param value Where to store in the message. 2137 2138 \returns A status code, \c B_OK on success or an error code. 2139 \retval B_OK The operation succeeded. 2140 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2141*/ 2142 2143 2144/*! 2145 \fn status_t BMessage::ReplaceInt64(const char *name, int32 index, int64 value) 2146 \brief Replace an integer at the label \a name at a specified 2147 \a index. 2148 2149 The data at the specified \a name and \a index will be replaced, if it 2150 matches the \c B_INT64_TYPE. 2151 2152 \param name The name associated with the data to replace. 2153 \param index The index in the array to replace. 2154 \param value The object to store in the message. 2155 2156 \returns A status code, \c B_OK on success or an error code. 2157 \retval B_OK The operation succeeded. 2158 \retval B_BAD_INDEX The index was out of range. 2159 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2160 2161 \see ReplaceInt64(const char*, int64) 2162*/ 2163 2164 2165/*! 2166 \fn status_t BMessage::ReplaceBool(const char *name, bool aBoolean) 2167 \brief Replace a boolean at the label \a name. 2168 2169 This method is an overloaded method of 2170 ReplaceBool(const char *, int32, bool). 2171 It replaces the data at \a index \c 0. 2172 2173 \param name The name associated with the data to replace. 2174 \param aBoolean Where to store in the message. 2175 2176 \returns A status code, \c B_OK on success or an error code. 2177 \retval B_OK The operation succeeded. 2178 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2179*/ 2180 2181 2182/*! 2183 \fn status_t BMessage::ReplaceBool(const char *name, int32 index, bool aBoolean) 2184 \brief Replace a boolean at the label \a name at a specified 2185 \a index. 2186 2187 The data at the specified \a name and \a index will be replaced, if it 2188 matches the \c B_BOOL_TYPE. 2189 2190 \param name The name associated with the data to replace. 2191 \param index The index in the array to replace. 2192 \param aBoolean Where to store in the message. 2193 2194 \returns A status code, \c B_OK on success or an error code. 2195 \retval B_OK The operation succeeded. 2196 \retval B_BAD_INDEX The index was out of range. 2197 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2198 2199 \see ReplaceBool(const char*, bool) 2200*/ 2201 2202 2203/*! 2204 \fn status_t BMessage::ReplaceFloat(const char *name, float aFloat) 2205 \brief Replace a float at the label \a name. 2206 2207 This method is an overloaded method of 2208 ReplaceFloat(const char *, int32, float). 2209 It replaces the data at \a index \c 0. 2210 2211 \param name The name associated with the data to replace. 2212 \param aFloat The object to store in the message. 2213 2214 \returns A status code, \c B_OK on success or an error code. 2215 \retval B_OK The operation succeeded. 2216 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2217*/ 2218 2219 2220/*! 2221 \fn status_t BMessage::ReplaceFloat(const char *name, int32 index, float aFloat) 2222 \brief Replace a float at the label \a name at a specified 2223 \a index. 2224 2225 The data at the specified \a name and \a index will be replaced, if it 2226 matches the \c B_FLOAT_TYPE. 2227 2228 \param name The name associated with the data to replace. 2229 \param index The index in the array to replace. 2230 \param aFloat The object to store in the message. 2231 2232 \returns A status code, \c B_OK on success or an error code. 2233 \retval B_OK The operation succeeded. 2234 \retval B_BAD_INDEX The index was out of range. 2235 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2236 2237 \see ReplaceFloat(const char*, float) 2238*/ 2239 2240 2241/*! 2242 \fn status_t BMessage::ReplaceDouble(const char *name, double aDouble) 2243 \brief Replace a double at the label \a name. 2244 2245 This method is an overloaded method of 2246 ReplaceDouble(const char *, int32, double). 2247 It replaces the data at \a index \c 0. 2248 2249 \param name The name associated with the data to replace. 2250 \param aDouble Where to store in the message. 2251 2252 \returns A status code, \c B_OK on success or an error code. 2253 \retval B_OK The operation succeeded. 2254 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2255*/ 2256 2257 2258/*! 2259 \fn status_t BMessage::ReplaceDouble(const char *name, int32 index, double aDouble) 2260 \brief Replace a double at the label \a name at a specified 2261 \a index. 2262 2263 The data at the specified \a name and \a index will be replaced, if it 2264 matches the \c B_DOUBLE_TYPE. 2265 2266 \param name The name associated with the data to replace. 2267 \param index The index in the array to replace. 2268 \param aDouble Where to store in the message. 2269 2270 \returns A status code, \c B_OK on success or an error code. 2271 \retval B_OK The operation succeeded. 2272 \retval B_BAD_INDEX The index was out of range. 2273 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2274 2275 \see ReplaceDouble(const char*, double) 2276*/ 2277 2278 2279/*! 2280 \fn status_t BMessage::ReplacePointer(const char *name, const void *pointer) 2281 \brief Replace a pointer at the label \a name. 2282 2283 This method is an overloaded method of 2284 ReplacePointer(const char *, int32, const void *). 2285 It replaces the data at \a index \c 0. 2286 2287 \param name The name associated with the data to replace. 2288 \param pointer Where to store in the message. 2289 2290 \returns A status code, \c B_OK on success or an error code. 2291 \retval B_OK The operation succeeded. 2292 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2293*/ 2294 2295 2296/*! 2297 \fn status_t BMessage::ReplacePointer(const char *name, int32 index, const void *pointer) 2298 \brief Replace a pointer at the label \a name at a specified \a index. 2299 2300 The data at the specified \a name and \a index will be replaced, if it 2301 matches the \c B_POINTER_TYPE. 2302 2303 \param name The name associated with the data to replace. 2304 \param index The index in the array to replace. 2305 \param pointer Where to store in the message. 2306 2307 \returns A status code, \c B_OK on success or an error code. 2308 \retval B_OK The operation succeeded. 2309 \retval B_BAD_INDEX The index was out of range. 2310 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2311 2312 \see ReplacePointer(const char*, const void *) 2313*/ 2314 2315 2316/*! 2317 \fn status_t BMessage::ReplaceMessenger(const char *name, BMessenger messenger) 2318 \brief Replace a messenger at the label \a name. 2319 2320 This method is an overloaded method of 2321 ReplaceMessenger(const char *, int32, BMessenger). 2322 It replaces the data at \a index \c 0. 2323 2324 \param name The name associated with the data to replace. 2325 \param messenger The object to store in the message. 2326 2327 \returns A status code, \c B_OK on success or an error code. 2328 \retval B_OK The operation succeeded. 2329 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2330*/ 2331 2332 2333/*! 2334 \fn status_t BMessage::ReplaceMessenger(const char *name, int32 index, BMessenger messenger) 2335 \brief Replace a messenger at the label \a name at a specified 2336 \a index. 2337 2338 The data at the specified \a name and \a index will be replaced, if it 2339 matches the \c B_MESSENGER_TYPE. 2340 2341 \param name The name associated with the data to replace. 2342 \param index The index in the array to replace. 2343 \param messenger The object to store in the message. 2344 2345 \returns A status code, \c B_OK on success or an error code. 2346 \retval B_OK The operation succeeded. 2347 \retval B_BAD_INDEX The index was out of range. 2348 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2349 2350 \see ReplaceMessenger(const char*, BMessenger) 2351*/ 2352 2353 2354/*! 2355 \fn status_t BMessage::ReplaceRef(const char *name,const entry_ref *ref) 2356 \brief Replace a reference to a file at the label \a name. 2357 2358 This method is an overloaded method of 2359 ReplaceRef(const char *, int32, entry_ref *). 2360 It replaces the data at \a index \c 0. 2361 2362 \param name The name associated with the data to replace. 2363 \param ref The object to store in the message. 2364 2365 \returns A status code, \c B_OK on success or an error code. 2366 \retval B_OK The operation succeeded. 2367 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2368*/ 2369 2370 2371/*! 2372 \fn status_t BMessage::ReplaceRef( const char *name, int32 index, const entry_ref *ref) 2373 \brief Replace a reference to a file at the label \a name at a 2374 specified \a index. 2375 2376 The data at the specified \a name and \a index will be replaced, if it 2377 matches the \c B_REF_TYPE. 2378 2379 \param name The name associated with the data to replace. 2380 \param index The index in the array to replace. 2381 \param ref The object to store in the message. 2382 2383 \returns A status code, \c B_OK on success or an error code. 2384 \retval B_OK The operation succeeded. 2385 \retval B_BAD_INDEX The index was out of range. 2386 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2387 2388 \see ReplaceRef(const char*, entry_ref *) 2389*/ 2390 2391 2392/*! 2393 \fn status_t BMessage::ReplaceMessage(const char *name, const BMessage *message) 2394 \brief Replace a message at the label \a name. 2395 2396 This method is an overloaded method of 2397 ReplaceMessage(const char *, int32, BMessage *). 2398 It replaces the data at \a index \c 0. 2399 2400 \param name The name associated with the data to replace. 2401 \param message The object to store in the message. 2402 2403 \returns A status code, \c B_OK on success or an error code. 2404 \retval B_OK The operation succeeded. 2405 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2406*/ 2407 2408 2409/*! 2410 \fn status_t BMessage::ReplaceMessage(const char *name, int32 index, const BMessage *message) 2411 \brief Replace a message at the label \a name at a specified 2412 \a index. 2413 2414 The data at the specified \a name and \a index will be replaced, if it 2415 matches the \c B_MESSAGE_TYPE. 2416 2417 \param name The name associated with the data to replace. 2418 \param index The index in the array to replace. 2419 \param message The object to store in the message. 2420 2421 \returns A status code, \c B_OK on success or an error code. 2422 \retval B_OK The operation succeeded. 2423 \retval B_BAD_INDEX The index was out of range. 2424 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2425 2426 \see ReplaceMessage(const char*, BMessage *) 2427*/ 2428 2429 2430/*! 2431 \fn status_t BMessage::ReplaceFlat(const char *name, BFlattenable *object) 2432 \brief Replace a flattened object at the label \a name. 2433 2434 This method is an overloaded method of 2435 ReplaceFlat(const char *, int32, BFlattenable *). 2436 2437 It replaces the data at \a index \c 0. 2438 2439 \param name The name associated with the data to replace. 2440 \param object The object to store in the message. 2441 2442 \returns A status code, \c B_OK on success or an error code. 2443 \retval B_OK The operation succeeded. 2444 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2445*/ 2446 2447 2448/*! 2449 \fn status_t BMessage::ReplaceFlat(const char *name, int32 index, BFlattenable *object) 2450 \brief Replace a flattened object at the label \a name at a 2451 specified \a index. 2452 2453 The data at the specified \a name and \a index will be 2454 replaced, if it matches the type returned by your object. This method uses 2455 BFlattenable::TypeCode() to determine the type of the object. 2456 2457 \param name The name associated with the data to replace. 2458 \param index The index in the array to replace. 2459 \param object The object to store in the message. 2460 2461 \returns A status code, \c B_OK on success or an error code. 2462 \retval B_OK The operation succeeded. 2463 \retval B_BAD_INDEX The index was out of range. 2464 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2465 2466 \see ReplaceFlat(const char*, BFlattenable *) 2467*/ 2468 2469 2470//! @} 2471 2472 2473/*! 2474 \name Deprecated methods 2475 2476 These methods are likely to disappear as they have been replaced by safer 2477 and more powerful methods but are implemented for the purpose of binary 2478 compatibility. 2479*/ 2480 2481 2482//! @{ 2483 2484 2485/*! 2486 \fn void *BMessage::operator new(size_t size) 2487 \brief Internal operator. 2488*/ 2489 2490 2491/*! 2492 \fn void *BMessage::operator new(size_t, void *pointer) 2493 \brief Internal operator. 2494*/ 2495 2496 2497/*! 2498 \fn void BMessage::operator delete(void *pointer, size_t size) 2499 \brief Internal operator. 2500*/ 2501 2502 2503/*! 2504 \fn bool BMessage::HasRect(const char *, int32) const 2505 \brief Deprecated. 2506*/ 2507 2508 2509/*! 2510 \fn bool BMessage::HasPoint(const char *, int32) const 2511 \brief Deprecated. 2512*/ 2513 2514 2515/*! 2516 \fn bool BMessage::HasString(const char *, int32) const 2517 \brief Deprecated. 2518*/ 2519 2520 2521/*! 2522 \fn bool BMessage::HasInt8(const char *, int32) const 2523 \brief Deprecated. 2524*/ 2525 2526 2527/*! 2528 \fn bool BMessage::HasInt16(const char *, int32) const 2529 \brief Deprecated. 2530*/ 2531 2532 2533/*! 2534 \fn bool BMessage::HasInt32(const char *, int32) const 2535 \brief Deprecated. 2536*/ 2537 2538 2539/*! 2540 \fn bool BMessage::HasInt64(const char *, int32) const 2541 \brief Deprecated. 2542*/ 2543 2544 2545/*! 2546 \fn bool BMessage::HasBool(const char *, int32) const 2547 \brief Deprecated. 2548*/ 2549 2550 2551/*! 2552 \fn bool BMessage::HasFloat(const char *, int32) const 2553 \brief Deprecated. 2554*/ 2555 2556 2557/*! 2558 \fn bool BMessage::HasDouble(const char *, int32) const 2559 \brief Deprecated. 2560*/ 2561 2562 2563/*! 2564 \fn bool BMessage::HasPointer(const char *, int32) const 2565 \brief Deprecated. 2566*/ 2567 2568 2569/*! 2570 \fn bool BMessage::HasMessenger(const char *, int32) const 2571 \brief Deprecated. 2572*/ 2573 2574 2575/*! 2576 \fn bool BMessage::HasRef(const char *, int32) const 2577 \brief Deprecated. 2578*/ 2579 2580 2581/*! 2582 \fn bool BMessage::HasMessage(const char *, int32) const 2583 \brief Deprecated. 2584*/ 2585 2586 2587/*! 2588 \fn bool BMessage::HasFlat(const char *, const BFlattenable *) const 2589 \brief Deprecated. 2590*/ 2591 2592 2593/*! 2594 \fn bool BMessage::HasFlat(const char *, int32, const BFlattenable *) const 2595 \brief Deprecated. 2596*/ 2597 2598 2599/*! 2600 \fn bool BMessage::HasData(const char *, type_code , int32) const 2601 \brief Deprecated. 2602*/ 2603 2604 2605/*! 2606 \fn BRect BMessage::FindRect(const char *, int32) const 2607 \brief Deprecated. 2608*/ 2609 2610 2611/*! 2612 \fn BPoint BMessage::FindPoint(const char *, int32) const 2613 \brief Deprecated. 2614*/ 2615 2616 2617/*! 2618 \fn const char *BMessage::FindString(const char *, int32) const 2619 \brief Deprecated. 2620*/ 2621 2622 2623/*! 2624 \fn int8 BMessage::FindInt8(const char *, int32) const 2625 \brief Deprecated. 2626*/ 2627 2628 2629/*! 2630 \fn int16 BMessage::FindInt16(const char *, int32) const 2631 \brief Deprecated. 2632*/ 2633 2634 2635/*! 2636 \fn int32 BMessage::FindInt32(const char *, int32) const 2637 \brief Deprecated. 2638*/ 2639 2640 2641/*! 2642 \fn int64 BMessage::FindInt64(const char *, int32) const 2643 \brief Deprecated. 2644*/ 2645 2646 2647/*! 2648 \fn bool BMessage::FindBool(const char *, int32) const 2649 \brief Deprecated. 2650*/ 2651 2652 2653/*! 2654 \fn float BMessage::FindFloat(const char *, int32) const 2655 \brief Deprecated. 2656*/ 2657 2658 2659/*! 2660 \fn double BMessage::FindDouble(const char *, int32) const 2661 \brief Deprecated. 2662*/ 2663 2664 2665//! @} 2666 2667 2668/*! 2669 \name Finding Data Convenience Methods 2670 2671 These methods may be used as alternatives to the Find data methods above 2672 which allow you to specify a default value to use if the value you are 2673 looking for is not found and return the result instead of filling out an 2674 out parameter and status code. If you are not interested in the status code 2675 these methods allow for some code simplification. 2676 2677 For example, instead of writing: 2678 2679\code 2680bool enabled; 2681if (FindBool("enabled", &enabled) != B_OK) 2682 enabled = false; 2683\endcode 2684 2685 you can write the following: 2686 2687\code 2688bool enabled = GetBool("enabled", false); 2689\endcode 2690 2691 reducing the example to a single line. 2692*/ 2693 2694 2695//! @{ 2696 2697 2698/*! 2699 \fn bool BMessage::GetBool(const char* name, bool defaultValue) const 2700 \brief Return the boolean value from message with \a name, or 2701 \a defaultValue if not found. 2702 2703 \param name The name of the item to retrieve. 2704 \param defaultValue The value to use if the item specified by \a name 2705 is not found. 2706 2707 \return The item with \a name, or \a defaultValue if not found. 2708*/ 2709 2710 2711/*! 2712 \fn bool BMessage::GetBool(const char* name, int32 index, 2713 bool defaultValue) const 2714 \brief Return the boolean value from message with \a name and \a index, or 2715 \a defaultValue if not found. 2716 2717 \param name The name of the item to retrieve. 2718 \param index The index of the item to retrieve if there is more than one. 2719 \param defaultValue The value to use if the item specified by \a name 2720 is not found. 2721 2722 \return The item with \a name, or \a defaultValue if not found. 2723*/ 2724 2725 2726/*! 2727 \fn int8 BMessage::GetInt8(const char* name, int8 defaultValue) const 2728 \brief Return the int8 value from message with \a name, or \a defaultValue 2729 if not found. 2730 2731 \param name The name of the item to retrieve. 2732 \param defaultValue The value to use if the item specified by \a name 2733 is not found. 2734 2735 \return The item with \a name, or \a defaultValue if not found. 2736*/ 2737 2738 2739/*! 2740 \fn int8 BMessage::GetInt8(const char* name, int32 index, 2741 int8 defaultValue) const 2742 \brief Return the int8 value from message with \a name and \a index, or 2743 \a defaultValue if not found. 2744 2745 \param name The name of the item to retrieve. 2746 \param index The index of the item to retrieve if there is more than one. 2747 \param defaultValue The value to use if the item specified by \a name 2748 is not found. 2749 2750 \return The item with \a name, or \a defaultValue if not found. 2751*/ 2752 2753 2754/*! 2755 \fn uint8 BMessage::GetUInt8(const char* name, uint8 defaultValue) const 2756 \brief Return the uint8 value from message with \a name, or \a defaultValue 2757 if not found. 2758 2759 \param name The name of the item to retrieve. 2760 \param defaultValue The value to use if the item specified by \a name 2761 is not found. 2762 2763 \return The item with \a name, or \a defaultValue if not found. 2764*/ 2765 2766 2767/*! 2768 \fn uint8 BMessage::GetUInt8(const char* name, int32 index, 2769 uint8 defaultValue) const 2770 \brief Return the uint8 message from message with \a name and \a index, or 2771 \a defaultValue if not found. 2772 2773 \param name The name of the item to retrieve. 2774 \param index The index of the item to retrieve if there is more than one. 2775 \param defaultValue The value to use if the item specified by \a name 2776 is not found. 2777 2778 \return The item with \a name, or \a defaultValue if not found. 2779*/ 2780 2781 2782/*! 2783 \fn int16 BMessage::GetInt16(const char* name, int16 defaultValue) const 2784 \brief Return the int16 value from message with \a name, or \a defaultValue 2785 if not found. 2786 2787 \param name The name of the item to retrieve. 2788 \param defaultValue The value to use if the item specified by \a name 2789 is not found. 2790 2791 \return The item with \a name, or \a defaultValue if not found. 2792*/ 2793 2794 2795/*! 2796 \fn int16 BMessage::GetInt16(const char* name, int32 index, 2797 int16 defaultValue) const 2798 \brief Return the int16 value from message with \a name and \a index, or 2799 \a defaultValue if not found. 2800 2801 \param name The name of the item to retrieve. 2802 \param index The index of the item to retrieve if there is more than one. 2803 \param defaultValue The value to use if the item specified by \a name 2804 is not found. 2805 2806 \return The item with \a name, or \a defaultValue if not found. 2807*/ 2808 2809 2810/*! 2811 \fn uint16 BMessage::GetUInt16(const char* name, uint16 defaultValue) const 2812 \brief Return the uint16 value from message with \a name, or 2813 \a defaultValue if not found. 2814 2815 \param name The name of the item to retrieve. 2816 \param defaultValue The value to use if the item specified by \a name 2817 is not found. 2818 2819 \return The item with \a name, or \a defaultValue if not found. 2820*/ 2821 2822 2823/*! 2824 \fn uint16 BMessage::GetUInt16(const char* name, int32 index, 2825 uint16 defaultValue) const 2826 \brief Return the uint16 value from message with \a name and \a index, or 2827 \a defaultValue if not found. 2828 2829 \param name The name of the item to retrieve. 2830 \param index The index of the item to retrieve if there is more than one. 2831 \param defaultValue The value to use if the item specified by \a name 2832 is not found. 2833 2834 \return The item with \a name, or \a defaultValue if not found. 2835*/ 2836 2837 2838/*! 2839 \fn int32 BMessage::GetInt32(const char* name, int32 defaultValue) const 2840 \brief Return the int32 value from message with \a name, or \a defaultValue 2841 if not found. 2842 2843 \param name The name of the item to retrieve. 2844 \param defaultValue The value to use if the item specified by \a name 2845 is not found. 2846 2847 \return The item with \a name, or \a defaultValue if not found. 2848*/ 2849 2850 2851/*! 2852 \fn int32 BMessage::GetInt32(const char* name, int32 index, 2853 int32 defaultValue) const 2854 \brief Return the int32 value from message with \a name and \a index, or 2855 \a defaultValue if not found. 2856 2857 \param name The name of the item to retrieve. 2858 \param index The index of the item to retrieve if there is more than one. 2859 \param defaultValue The value to use if the item specified by \a name 2860 is not found. 2861 2862 \return The item with \a name, or \a defaultValue if not found. 2863*/ 2864 2865 2866/*! 2867 \fn uint32 BMessage::GetUInt32(const char* name, uint32 defaultValue) const 2868 \brief Return the uint32 value from message with \a name, or 2869 \a defaultValue if not found. 2870 2871 \param name The name of the item to retrieve. 2872 \param defaultValue The value to use if the item specified by \a name 2873 is not found. 2874 2875 \return The item with \a name, or \a defaultValue if not found. 2876*/ 2877 2878 2879/*! 2880 \fn uint32 BMessage::GetUInt32(const char* name, int32 index, 2881 uint32 defaultValue) const 2882 \brief Return the uint32 value from message with \a name and \a index, or 2883 \a defaultValue if not found. 2884 2885 \param name The name of the item to retrieve. 2886 \param index The index of the item to retrieve if there is more than one. 2887 \param defaultValue The value to use if the item specified by \a name 2888 is not found. 2889 2890 \return The item with \a name, or \a defaultValue if not found. 2891*/ 2892 2893 2894/*! 2895 \fn int64 BMessage::GetInt64(const char* name, int64 defaultValue) const 2896 \brief Return the int64 value from message with \a name, or \a defaultValue 2897 if not found. 2898 2899 \param name The name of the item to retrieve. 2900 \param defaultValue The value to use if the item specified by \a name 2901 is not found. 2902 2903 \return The item with \a name, or \a defaultValue if not found. 2904*/ 2905 2906 2907/*! 2908 \fn int64 BMessage::GetInt64(const char* name, int32 index, 2909 int64 defaultValue) const 2910 \brief Return the int64 value from message with \a name and \a index, or 2911 \a defaultValue if not found. 2912 2913 \param name The name of the item to retrieve. 2914 \param index The index of the item to retrieve if there is more than one. 2915 \param defaultValue The value to use if the item specified by \a name 2916 is not found. 2917 2918 \return The item with \a name, or \a defaultValue if not found. 2919*/ 2920 2921 2922/*! 2923 \fn uint64 BMessage::GetUInt64(const char* name, uint64 defaultValue) const 2924 \brief Return the uint64 value from message with \a name, or 2925 \a defaultValue if not found. 2926 2927 \param name The name of the item to retrieve. 2928 \param defaultValue The value to use if the item specified by \a name 2929 is not found. 2930 2931 \return The item with \a name, or \a defaultValue if not found. 2932*/ 2933 2934 2935/*! 2936 \fn uint64 BMessage::GetUInt64(const char* name, int32 index, 2937 uint64 defaultValue) const 2938 \brief Return the uint64 value from message with \a name and \a index, or 2939 \a defaultValue if not found. 2940 2941 \param name The name of the item to retrieve. 2942 \param index The index of the item to retrieve if there is more than one. 2943 \param defaultValue The value to use if the item specified by \a name 2944 is not found. 2945 2946 \return The item with \a name, or \a defaultValue if not found. 2947*/ 2948 2949 2950/*! 2951 \fn float BMessage::GetFloat(const char* name, float defaultValue) const 2952 \brief Return the float value from message with \a name, or \a defaultValue 2953 if not found. 2954 2955 \param name The name of the item to retrieve. 2956 \param defaultValue The value to use if the item specified by \a name 2957 is not found. 2958 2959 \return The item with \a name, or \a defaultValue if not found. 2960*/ 2961 2962 2963/*! 2964 \fn float BMessage::GetFloat(const char* name, int32 index, 2965 float defaultValue) const 2966 \brief Return the float value from message with \a name and \a index, or 2967 \a defaultValue if not found. 2968 2969 \param name The name of the item to retrieve. 2970 \param index The index of the item to retrieve if there is more than one. 2971 \param defaultValue The value to use if the item specified by \a name 2972 is not found. 2973 2974 \return The item with \a name, or \a defaultValue if not found. 2975*/ 2976 2977 2978/*! 2979 \fn double BMessage::GetDouble(const char* name, double defaultValue) const 2980 \brief Return the double value from message with \a name, or 2981 \a defaultValue if not found. 2982 2983 \param name The name of the item to retrieve. 2984 \param defaultValue The value to use if the item specified by \a name 2985 is not found. 2986 2987 \return The item with \a name, or \a defaultValue if not found. 2988*/ 2989 2990 2991/*! 2992 \fn double BMessage::GetDouble(const char* name, int32 index, 2993 double defaultValue) const 2994 \brief Return the double value from message with \a name and \a index, or 2995 \a defaultValue if not found. 2996 2997 \param name The name of the item to retrieve. 2998 \param index The index of the item to retrieve if there is more than one. 2999 \param defaultValue The value to use if the item specified by \a name 3000 is not found. 3001 3002 \return The item with \a name, or \a defaultValue if not found. 3003*/ 3004 3005 3006/*! 3007 \fn void* BMessage::GetPointer(const char* name, 3008 const void* defaultValue) const 3009 \brief Return the pointer from message with \a name, or 3010 \a defaultValue if not found. 3011 3012 \param name The name of the item to retrieve. 3013 \param defaultValue The value to use if the item specified by \a name 3014 is not found. 3015 3016 \return The item with \a name, or \a defaultValue if not found. 3017*/ 3018 3019 3020/*! 3021 \fn void* BMessage::GetPointer(const char* name, int32 index, 3022 const void* defaultValue) const 3023 \brief Return the pointer from message with \a name and \a index, or 3024 \a defaultValue if not found. 3025 3026 \param name The name of the item to retrieve. 3027 \param index The index of the item to retrieve if there is more than one. 3028 \param defaultValue The value to use if the item specified by \a name 3029 is not found. 3030 3031 \return The item with \a name, or \a defaultValue if not found. 3032*/ 3033 3034 3035/*! 3036 \fn const char* BMessage::GetString(const char* name, 3037 const char* defaultValue) const 3038 \brief Return the string from message with \a name, or \a defaultValue if 3039 not found. 3040 3041 \param name The name of the item to retrieve. 3042 \param defaultValue The value to use if the item specified by \a name 3043 is not found. 3044 3045 \return The item with \a name, or \a defaultValue if not found. 3046*/ 3047 3048 3049/*! 3050 \fn const char* BMessage::GetString(const char* name, int32 index, 3051 const char* defaultValue) const 3052 \brief Return the string from message with \a name and \a index, or 3053 \a defaultValue if not found. 3054 3055 \param name The name of the item to retrieve. 3056 \param index The index of the item to retrieve if there is more than one. 3057 \param defaultValue The value to use if the item specified by \a name 3058 is not found. 3059 3060 \return The item with \a name, or \a defaultValue if not found. 3061*/ 3062 3063 3064/*! 3065 \fn BAlignment BMessage::GetAlignment(const char* name, 3066 const BAlignment& defaultValue) const 3067 \brief Return the BAlignment object from message with \a name, or 3068 \a defaultValue if not found. 3069 3070 \param name The name of the item to retrieve. 3071 \param defaultValue The value to use if the item specified by \a name 3072 is not found. 3073 3074 \return The item with \a name, or \a defaultValue if not found. 3075*/ 3076 3077 3078/*! 3079 \fn BAlignment BMessage::GetAlignment(const char* name, int32 index, 3080 const BAlignment& defaultValue) const 3081 \brief Return the BAlignment object from message with \a name and \a index, 3082 or \a defaultValue if not found. 3083 3084 \param name The name of the item to retrieve. 3085 \param index The index of the item to retrieve if there is more than one. 3086 \param defaultValue The value to use if the item specified by \a name 3087 is not found. 3088 3089 \return The item with \a name, or \a defaultValue if not found. 3090*/ 3091 3092 3093/*! 3094 \fn BRect BMessage::GetRect(const char* name, const BRect& defaultValue) const 3095 \brief Return the BRect object from message with \a name, or 3096 \a defaultValue if not found. 3097 3098 \param name The name of the item to retrieve. 3099 \param defaultValue The value to use if the item specified by \a name 3100 is not found. 3101 3102 \return The item with \a name, or \a defaultValue if not found. 3103*/ 3104 3105 3106/*! 3107 \fn BRect BMessage::GetRect(const char* name, int32 index, 3108 const BRect& defaultValue) const 3109 \brief Return the BRect object from message with \a name and \a index, 3110 or \a defaultValue if not found. 3111 3112 \param name The name of the item to retrieve. 3113 \param index The index of the item to retrieve if there is more than one. 3114 \param defaultValue The value to use if the item specified by \a name 3115 is not found. 3116 3117 \return The item with \a name, or \a defaultValue if not found. 3118*/ 3119 3120 3121/*! 3122 \fn BPoint BMessage::GetPoint(const char* name, 3123 const BPoint& defaultValue) const 3124 \brief Return the BPoint object from message with \a name, or 3125 \a defaultValue if not found. 3126 3127 \param name The name of the item to retrieve. 3128 \param defaultValue The value to use if the item specified by \a name 3129 is not found. 3130 3131 \return The item with \a name, or \a defaultValue if not found. 3132*/ 3133 3134 3135/*! 3136 \fn BPoint BMessage::GetPoint(const char* name, int32 index, 3137 const BPoint& defaultValue) const 3138 \brief Return the BPoint object from message with \a name and \a index, 3139 or \a defaultValue if not found. 3140 3141 \param name The name of the item to retrieve. 3142 \param index The index of the item to retrieve if there is more than one. 3143 \param defaultValue The value to use if the item specified by \a name 3144 is not found. 3145 3146 \return The item with \a name, or \a defaultValue if not found. 3147*/ 3148 3149 3150/*! 3151 \fn BSize BMessage::GetSize(const char* name, 3152 const BSize& defaultValue) const 3153 \brief Return the BSize object from message with \a name, or 3154 \a defaultValue if not found. 3155 3156 \param name The name of the item to retrieve. 3157 \param defaultValue The value to use if the item specified by \a name 3158 is not found. 3159 3160 \return The item with \a name, or \a defaultValue if not found. 3161*/ 3162 3163 3164/*! 3165 \fn BSize BMessage::GetSize(const char* name, int32 index, 3166 const BSize& defaultValue) const 3167 \brief Return the BSize object from message with \a name and \a index, 3168 or \a defaultValue if not found. 3169 3170 \param name The name of the item to retrieve. 3171 \param index The index of the item to retrieve if there is more than one. 3172 \param defaultValue The value to use if the item specified by \a name 3173 is not found. 3174 3175 \return The item with \a name, or \a defaultValue if not found. 3176*/ 3177 3178 3179//! @} 3180