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