1/* 2 * Copyright 2007-2014, 2019 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 hrev51780 11 * src/kits/app/Message.cpp hrev53160 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 status_t BMessage::GetInfo(const char* name, type_code* typeFound, 308 int32* countFound, bool* fixedSize) const 309 \brief Retrieve the type and whether or not the size of the data is fixed 310 associated with a \a name. 311 312 This method is the same as GetInfo(const char*, type_code*, int32*) const, 313 with the difference that you can find out whether or not the size of the 314 data associated with the \a name is fixed. You will get this value 315 in the variable you passed as \a fixedSize parameter. 316 317 \since BeOS R4 318*/ 319 320 321/*! 322 \fn int32 BMessage::CountNames(type_code type) const 323 \brief Count the number of names of a certain \a type. 324 325 This method can be used to count the number of items of a certain type. 326 It's practical use is limited to debugging purposes. 327 328 \param type The type you want to find. If you pass \c B_ANY_TYPE, this 329 method will return the total number of data items. 330 331 \return The number of data items in this message with the specified 332 \a type, or \c 0 in case no items match the type. 333 334 \since BeOS R3 335*/ 336 337 338/*! 339 \fn bool BMessage::IsEmpty() const 340 \brief Check if the message has data members. 341 342 \return If this message contains data members, this method will return 343 \c true, else it will return \c false. 344 345 \see MakeEmpty() 346 347 \since BeOS R3 348*/ 349 350 351/*! 352 \fn bool BMessage::IsSystem() const 353 \brief Check if the message is a system message. 354 355 \return If this message is a system message, the method will return 356 \c true. 357 358 \since BeOS R3 359*/ 360 361 362/*! 363 \fn bool BMessage::IsReply() const 364 \brief Check if the message is a reply to a (previous) message. 365 366 \return If this message is a reply, this method will return \c true. 367 368 \since BeOS R3 369*/ 370 371 372/*! 373 \fn void BMessage::PrintToStream() const 374 \brief Print the message to the standard output. 375 376 This method can be used to debug your application. It can be used to check 377 if it creates the messages properly, by checking if all the required fields 378 are present, and it can be used to debug your message handling routines, 379 especially the handling of those that are sent by external applications, to 380 see if you understand the semantics correctly. 381 382 \since BeOS R3 383*/ 384 385 386/*! 387 \fn status_t BMessage::Rename(const char* oldEntry, const char* newEntry) 388 \brief Rename a data label. 389 390 \param oldEntry The name of the label you want to rename. 391 \param newEntry The new name of the data entry. 392 393 \returns A status code, \c B_OK on success or an error code. 394 \retval B_OK Renaming succeeded. 395 \retval B_BAD_VALUE Either the \a oldEntry or the 396 \a newEntry pointers are \c NULL. 397 \retval B_NAME_NOT_FOUND There is no data associated with the label 398 \a oldEntry. 399 400 \since Haiku R1 401*/ 402 403 404//! @} 405 406 407/*! 408 \name Delivery Info 409*/ 410 411 412//! @{ 413 414 415/*! 416 \fn bool BMessage::WasDelivered() const 417 \brief Check if this message was delivered through the delivery methods. 418 419 If this message is passed via a BMessenger or BLooper::PostMessage(), this 420 method will return \c true. 421 422 \warning This method should not be abused by a thread that sends a message 423 to track whether or not a message was delivered. This is because 424 the ownership of the message goes to the receiving looper, which 425 will delete the message as soon as it is done with it. 426 427 \warning If you need to check whether a message is delivered, you should 428 either ask for a reply, or use one of the synchronous 429 BMessenger::SendMessage() methods. 430 431 \since BeOS R3 432*/ 433 434 435/*! 436 \fn bool BMessage::IsSourceWaiting() const 437 \brief Check if the sender expects a reply. 438 439 This method will return \c true, if the sender flagged that it is waiting 440 for a reply, and such a reply has not yet been sent. 441 442 \since BeOS R3 443*/ 444 445 446/*! 447 \fn bool BMessage::IsSourceRemote() const 448 \brief Check if the message is sent by another application. 449 450 \since BeOS R3 451*/ 452 453 454/*! 455 \fn BMessenger BMessage::ReturnAddress() const 456 \brief Get a messenger that points to the sender of the message. 457 458 Using this method, you can fetch a BMessenger that can be used to deliver 459 replies to this message. This method works both for local and remote 460 deliveries. 461 462 For remote deliveries, this approach is preferred over sending the reply 463 using a standard BMessenger that is created with the signature of the 464 application. A standard BMessenger sends the messages to the main BLooper 465 of the application, the BApplication object. With the delivery data stored 466 in the messages, the reply using this messenger will be directed at a 467 specific looper that is able to handle the replies. 468 469 If this method is called on a message that has not been delivered (yet), 470 it will return an empty BMessenger object. 471 472 \since BeOS R3 473*/ 474 475 476/*! 477 \fn const BMessage* BMessage::Previous() const 478 \brief Get the message to which this message is a reply. 479 480 \return Returns a new BMessage with the same data stuctures as the message 481 to which this message is a reply. The pointer is only valid as 482 long as this message is still allocated, you do not get ownership. 483 If this message isn't a reply to another message, this method will 484 return \c NULL. 485 486 \since BeOS R3 487*/ 488 489 490/*! 491 \fn bool BMessage::WasDropped() const 492 \brief Check if the message was delivered through 'drag and drop'. 493 494 \return This method returns \c true if the message has been delivered 495 through drag and drop. It returns \c false if it has been delivered 496 through the regular messaging functions, or if the message has not 497 been delivered at all. 498 499 \see DropPoint() 500 501 \since BeOS R3 502*/ 503 504 505/*! 506 \fn BPoint BMessage::DropPoint(BPoint* offset) const 507 \brief Get the coordinates of the drop point of the message. 508 509 If the message has been delivered because of drag and drop, which can be 510 verified with the WasDropped() method, this method will return a BPoint to 511 where exactly the drop off was made. 512 513 Because drop messages are delivered to the BWindow in which they were 514 dropped, and BWindow is a subclass of BLooper, you can use BWindow to 515 determine based on the location, how you should react to it. 516 517 If this message was not delivered through drag and drop, it will return 518 a \c NULL pointer. 519 520 \see WasDropped() 521 522 \since BeOS R3 523*/ 524 525 526//! @} 527 528 529/*! 530 \name Replying 531*/ 532 533 534//! @{ 535 536 537/*! 538 \fn status_t BMessage::SendReply(uint32 command, BHandler* replyTo) 539 \brief Asynchronously send a reply to this message. 540 541 This is an overloaded member of 542 SendReply(BMessage*, BMessenger, bigtime_t). Use this variant if you 543 want to send a message without data members. 544 545 \since BeOS R3 546*/ 547 548 549/*! 550 \fn status_t BMessage::SendReply(BMessage* reply, BHandler* replyTo, 551 bigtime_t timeout) 552 \brief Asynchronously send a reply to this message. 553 554 This is an overloaded member of SendReply(BMessage*, BMessenger, bigtime_t). 555 Use this variant if you want to send the message to a specific handler 556 (instead of a complete messenger). 557 558 \since BeOS R3 559*/ 560 561 562/*! 563 \fn status_t BMessage::SendReply(BMessage* reply, BMessenger replyTo, 564 bigtime_t timeout) 565 \brief Asynchronously send a reply to this message. 566 567 This method sends a reply to this message to the sender. On your turn, 568 you specify a messenger that handles a reply back to the message you 569 specify as the \a reply argument. You can set a timeout for the 570 message to be delivered. This method blocks until the message has been 571 received, or the \a timeout has been reached. 572 573 \param reply The message that is in reply to this message. 574 \param replyTo In case the receiver needs to reply to the message you are 575 sending, you can specify the return address with this argument. 576 \param timeout The maximum time in microseconds this delivery may take. The 577 \a timeout is a relative timeout. You can also use 578 \c B_INFINITE_TIMEOUT if you want to wait infinitely for the message 579 to be delivered. 580 581 \returns A status code, \c B_OK on success or an error code. 582 \retval B_OK The message has been delivered. 583 \retval B_DUPLICATE_REPLY There already has been a reply to this message. 584 \retval B_BAD_PORT_ID The reply address is not valid (anymore). 585 \retval B_WOULD_BLOCK The delivery \a timeout was 586 \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when 587 trying to deliver the message. 588 \retval B_TIMED_OUT The timeout expired while trying to deliver the 589 message. 590 591 \see SendReply(uint32 command, BHandler* replyTo) 592 593 \since Haiku R1 594*/ 595 596 597/*! 598 \fn status_t BMessage::SendReply(uint32 command, BMessage* replyToReply) 599 \brief Synchronously send a reply to this message, and wait for a reply 600 back. 601 602 This is an overloaded member of 603 SendReply(BMessage*, BMessage*, bigtime_t, bigtime_t) 604 Use this variant if you want to send a message without data members. 605 606 \since BeOS R3 607*/ 608 609 610/*! 611 \fn status_t BMessage::SendReply(BMessage* reply, BMessage* replyToReply, 612 bigtime_t sendTimeout, bigtime_t replyTimeout) 613 \brief Synchronously send a reply to this message, and wait for a reply 614 back. 615 616 This method sends a reply to this message to the sender. The 617 \a reply is delivered, and then the method waits for a reply from 618 the receiver. If a reply is received, that reply is copied into the 619 \a replyToReply argument. 620 If the message was delivered properly, but the receiver did not reply 621 within the specified \a replyTimeout, the \a what member of 622 \a replyToReply will be set to \c B_NO_REPLY. 623 624 \param reply The message that is in reply to this message. 625 \param[out] replyToReply The reply is copied into this argument. 626 \param sendTimeout The maximum time in microseconds this delivery may take. 627 The \a timeout is a relative timeout. You can also use 628 \c B_INFINITE_TIMEOUT if you want to wait infinitely for the message 629 to be delivered. 630 \param replyTimeout The maximum time in microseconds you want to wait for a 631 reply. Note that the timer starts when the message has been 632 delivered. 633 634 \returns A status code, \c B_OK on success or an error code. 635 \retval B_OK The message has been delivered. 636 \retval B_DUPLICATE_REPLY There already has been a reply to this message. 637 \retval B_BAD_VALUE Either \a reply or \a replyToReply is \c NULL. 638 \retval B_BAD_PORT_ID The reply address is not valid (anymore). 639 \retval B_WOULD_BLOCK The delivery \a timeout was 640 \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when 641 trying to deliver the message. 642 \retval B_TIMED_OUT The timeout expired while trying to deliver the 643 message. 644 \retval B_NO_MORE_PORTS All reply ports are in use. 645 646 \see SendReply(uint32 command, BMessage* replyToReply) 647 648 \since BeOS R3 649*/ 650 651 652//! @} 653 654 655/*! 656 \name Flattening 657 658 Because of historical reasons and for binary compatibility, this class 659 provides a flattening API without inheriting the BFlattenable class. The 660 API is more or less the same, but you are inconvenienced when you want to 661 use messages in methods that handle BFlattenable objects. 662*/ 663 664 665//! @{ 666 667 668/*! 669 \fn ssize_t BMessage::FlattenedSize() const 670 \brief Return the size in bytes required when you want to flatten this 671 message to a stream of bytes. 672 673 \since BeOS R3 674*/ 675 676 677/*! 678 \fn status_t BMessage::Flatten(char* buffer, ssize_t size) const 679 \brief Flatten the message to a \a buffer. 680 681 \param buffer The buffer to write the data to. 682 \param size The size of the buffer. 683 684 \return \c B_OK in case of success, or an error code in case something 685 went awry. 686 687 \warning Make sure the buffer is large enough to hold the message. This 688 method does not double-check for you! 689 690 \see FlattenedSize() 691 \see Flatten(BDataIO* stream, ssize_t* size) const 692 693 \since BeOS R3 694*/ 695 696 697/*! 698 \fn status_t BMessage::Flatten(BDataIO* stream, ssize_t* size) const 699 \brief Flatten the message to a \a stream. 700 701 \param[in] stream The stream to flatten the message to. 702 \param[out] size The method writes the number of bytes actually written 703 to this argument. 704 \return \c B_OK in case of success, or an error code in case something 705 went awry. 706 707 \warning Make sure the subclass of the BDataIO interface either protects 708 against buffer overwrites, or check if the number of bytes that 709 is going to be written isn't larger than it can handle. 710 711 \see FlattenedSize() 712 \see Flatten(char* buffer, ssize_t size) const 713 714 \since BeOS R3 715*/ 716 717 718/*! 719 \fn status_t BMessage::Unflatten(const char* flatBuffer) 720 \brief Unflatten a message from a buffer and put it into the current 721 object. 722 723 This action clears the current contents of the message. 724 725 \param flatBuffer The buffer that contains the message. 726 727 \returns A status code, \c B_OK on success or an error code. 728 \retval B_OK The buffer has been unflattened. 729 \retval B_BAD_VALUE The buffer does not contain a valid message. 730 \retval B_NO_MEMORY An error occured whilst allocating memory for the data 731 members. 732 733 \see Flatten(char* buffer, ssize_t size) const 734 \see Unflatten(BDataIO* stream) 735 736 \since BeOS R3 737*/ 738 739 740/*! 741 \fn status_t BMessage::Unflatten(BDataIO* stream) 742 \brief Unflatten a message from a stream and put it into the current 743 object. 744 745 This action clears the current contents of the message. 746 747 \param stream The stream that contains the message. 748 749 \returns A status code, \c B_OK on success or an error code. 750 \retval B_OK The message has been unflattened. 751 \retval B_BAD_VALUE The stream does not contain a valid message. 752 \retval B_NO_MEMORY An error occured whilst allocating memory for the 753 data members. 754 755 \see Flatten(BDataIO* stream, ssize_t* size) const 756 \see Unflatten(const char*) 757 758 \since BeOS R3 759*/ 760 761 762//! @} 763 764 765/*! 766 \name Specifiers (Scripting) 767*/ 768 769 770//! @{ 771 772 773/*! 774 \fn status_t BMessage::AddSpecifier(const char* property) 775 \brief Undocumented. 776 777 \since BeOS R3 778*/ 779 780 781/*! 782 \fn status_t BMessage::AddSpecifier(const char* property, int32 index) 783 \brief Undocumented. 784 785 \since BeOS R3 786*/ 787 788 789/*! 790 \fn status_t BMessage::AddSpecifier(const char* property, int32 index, 791 int32 range) 792 \brief Undocumented. 793 794 \since BeOS R3 795*/ 796 797 798/*! 799 \fn status_t BMessage::AddSpecifier(const char* property, const char* name) 800 \brief Undocumented. 801 802 \since BeOS R3 803*/ 804 805 806/*! 807 \fn status_t BMessage::AddSpecifier(const BMessage* specifier) 808 \brief Undocumented. 809 810 \since BeOS R3 811*/ 812 813 814/*! 815 \fn status_t BMessage::SetCurrentSpecifier(int32 index) 816 \brief Undocumented. 817 818 \since Haiku R1 819*/ 820 821 822/*! 823 \fn status_t BMessage::GetCurrentSpecifier(int32* index, 824 BMessage* specifier, int32* what, const char** property) const 825 \brief Undocumented. 826 827 \since BeOS R3 828*/ 829 830 831/*! 832 \fn bool BMessage::HasSpecifiers() const 833 \brief Undocumented. 834 835 \since BeOS R3 836*/ 837 838 839/*! 840 \fn status_t BMessage::PopSpecifier() 841 \brief Undocumented. 842 843 \since BeOS R3 844*/ 845 846 847//! @} 848 849 850/*! 851 \name Adding Data 852*/ 853 854 855//! @{ 856 857 858/*! 859 \fn status_t BMessage::AddData(const char* name, type_code type, 860 const void* data, ssize_t numBytes, bool isFixedSize, int32 count) 861 \brief Add \a data of a certain \a type to the message. 862 863 The amount of \a numBytes is copied into the message. The data is 864 stored at the label specified in \a name. You are responsible for 865 specifying the correct \a type. The Haiku API already specifies 866 many constants, such as \c B_FLOAT_TYPE or \c B_RECT_TYPE. See 867 TypeConstants.h for more information on the system-wide defined types. 868 869 If the field with the \a name already exists, the data is added in 870 an array-like form. If you are adding a certain \a name for the 871 first time, you are able to specify some properties of this array. You can 872 fix the size of each data entry, and you can also instruct BMessage to 873 allocate a \a count of items. The latter does not mean that the 874 number of items is fixed; the array will grow nonetheless. Also, note that 875 every \a name can only be associated with one \a type of 876 data. 877 878 If consecutive method calls specify a different \a type than the 879 initial, these calls will fail. 880 881 There is no limit to the number of labels, or the amount of data, but 882 note that searching of data members is linear, as well as that some 883 messages will be copied whilst being passed around, so if the amount of 884 data you need to pass is too big, find another way to pass it. 885 886 \param name The label to which this data needs to be associated. If the 887 \a name already exists, the new data will be added in an 888 array-like style. 889 \param type The type of data. If you are adding data to the same 890 \a name, make sure it is the same type. 891 \param data The data buffer to copy the bytes from. 892 \param numBytes The number of bytes to be copied. If this is the first 893 call to this method for this type of data, and you set 894 \a isFixedSize to \c true, this will specify the size of all 895 consecutive calls to this method. 896 \param isFixedSize If this is the first call to this method with this 897 \a name, you can specify the whether or not all items in this 898 array should have the same fixed size. 899 \param count If this is the first call to this method with this 900 \a name, you can instruct this message to allocate a number of 901 items in advance. This does not limit the amount of items though. 902 The array will grow if needed. 903 904 \returns A status code, \c B_OK on success or an error code. 905 \retval B_OK The \a data is succesfully added. 906 \retval B_BAD_VALUE The \a numBytes is less than, or equal to \c 0, 907 or the size of this item is larger than the \a name allows, 908 since it has been specified to have a fixed size. 909 \retval B_ERROR There was an error whilst creating the label with 910 your \a name. 911 \retval B_BAD_TYPE The \a type you specified is different than the 912 one already associated with \a name. 913 914 \since BeOS R3 915*/ 916 917 918/*! 919 \fn status_t BMessage::AddAlignment(const char* name, 920 const BAlignment& alignment) 921 \brief Convenience method to add a BAlignment to the label \a name. 922 923 This method calls AddData() with the \c B_ALIGNMENT_TYPE \a type. 924 925 \param name The label to associate the data with. 926 \param alignment The alignment to store in the message. 927 928 \returns A status code, \c B_OK on success or an error code. 929 930 \see AddData() for a more detailed overview of the inner workings. 931 \see FindAlignment() 932 \see GetAlignment() 933 \see ReplaceAlignment() 934 935 \since Haiku R1 936*/ 937 938 939/*! 940 \fn status_t BMessage::AddRect(const char* name, BRect aRect) 941 \brief Convenience method to add a BRect to the label \a name. 942 943 This method calls AddData() with the \c B_RECT_TYPE \a type. 944 945 \param name The label to associate the data with. 946 \param aRect The rectangle to store in the message. 947 948 \returns A status code, \c B_OK on success or an error code. 949 950 \see AddData() for a more detailed overview of the inner workings. 951 \see FindRect() 952 \see GetRect() 953 \see ReplaceRect() 954 955 \since BeOS R3 956*/ 957 958 959/*! 960 \fn status_t BMessage::AddPoint(const char* name, BPoint aPoint) 961 \brief Convenience method to add a BPoint to the label \a name. 962 963 This method calls AddData() with the \c B_POINT_TYPE \a type. 964 965 \param name The label to associate the data with. 966 \param aPoint The point to store in the message. 967 968 \returns A status code, \c B_OK on success or an error code. 969 970 \see AddData() for a more detailed overview of the inner workings. 971 \see FindPoint() 972 \see GetPoint() 973 \see ReplacePoint() 974 975 \since BeOS R3 976*/ 977 978 979/*! 980 \fn status_t BMessage::AddSize(const char* name, BSize size) 981 \brief Convenience method to add a BSize to the label \a name. 982 983 This method calls AddData() with the \c B_SIZE_TYPE \a type. 984 985 \param name The label to associate the data with. 986 \param size The BSize to store in the message. 987 988 \returns A status code, \c B_OK on success or an error code. 989 990 \see AddData() for a more detailed overview of the inner workings. 991 \see FindSize() 992 \see GetSize() 993 \see ReplaceSize() 994 995 \since Haiku R1 996*/ 997 998 999/*! 1000 \fn status_t BMessage::AddString(const char* name, const char* aString) 1001 \brief Convenience method to add a C-string to the label \a name. 1002 1003 This method calls AddData() with the \c B_STRING_TYPE \a type. 1004 1005 \param name The label to associate the data with. 1006 \param aString The string to copy to the message. 1007 1008 \returns A status code, \c B_OK on success or an error code. 1009 1010 \see AddData() for a more detailed overview of the inner workings. 1011 \see FindString() 1012 \see GetString() 1013 \see ReplaceString() 1014 1015 \since BeOS R3 1016*/ 1017 1018 1019/*! 1020 \fn status_t BMessage::AddString(const char* name, const BString& aString) 1021 \brief Convenience method to add a BString to the label \a name. 1022 1023 This method calls AddData() with the \c B_STRING_TYPE \a type. 1024 1025 \param name The label to associate the data with. 1026 \param aString The string to copy to the message. 1027 1028 \returns A status code, \c B_OK on success or an error code. 1029 1030 \see AddData() for a more detailed overview of the inner workings. 1031 \see FindString() 1032 \see GetString() 1033 \see ReplaceString() 1034 1035 \since BeOS R5 1036*/ 1037 1038 1039/*! 1040 \fn status_t BMessage::AddStrings(const char* name, 1041 const BStringList& list) 1042 \brief Convenience method to add list of strings to the label \a name. 1043 1044 This method calls AddData() with the \c B_STRING_TYPE \a type for each 1045 string in the BStringList. 1046 1047 \param name The label to associate the data with. 1048 \param list The list of strings to store in the message. 1049 1050 \returns A status code, \c B_OK on success or an error code. 1051 1052 \see AddData() for a more detailed overview of the inner workings. 1053 \see FindStrings() 1054 \see GetStrings() 1055 \see ReplaceStrings() 1056 1057 \since Haiku R1 1058*/ 1059 1060 1061/*! 1062 \fn status_t BMessage::AddInt8(const char* name, int8 value) 1063 \brief Convenience method to add an \c int8 to the label \a name. 1064 1065 This method calls AddData() with the \c B_INT8_TYPE \a type. 1066 1067 \param name The label to associate the data with. 1068 \param value The value to store in the message. 1069 1070 \returns A status code, \c B_OK on success or an error code. 1071 1072 \see AddData() for a more detailed overview of the inner workings. 1073 \see FindInt8() 1074 \see GetInt8() 1075 \see ReplaceInt8() 1076 1077 \since BeOS R3 1078*/ 1079 1080 1081/*! 1082 \fn status_t BMessage::AddUInt8(const char* name, uint8 value) 1083 \brief Convenience method to add an \c uint8 to the label \a name. 1084 1085 This method calls AddData() with the \c B_UINT8_TYPE \a type. 1086 1087 \param name The label to associate the data with. 1088 \param value The value to store in the message. 1089 1090 \returns A status code, \c B_OK on success or an error code. 1091 1092 \see AddData() for a more detailed overview of the inner workings. 1093 \see FindUInt8() 1094 \see GetUInt8() 1095 \see ReplaceUInt8() 1096 1097 \since BeOS R3 1098*/ 1099 1100 1101/*! 1102 \fn status_t BMessage::AddInt16(const char* name, int16 value) 1103 \brief Convenience method to add an \c int16 to the label \a name. 1104 1105 This method calls AddData() with the \c B_INT16_TYPE \a type. 1106 1107 \param name The label to associate the data with. 1108 \param value The value to store in the message. 1109 1110 \returns A status code, \c B_OK on success or an error code. 1111 1112 \see AddData() for a more detailed overview of the inner workings. 1113 \see FindInt16() 1114 \see GetInt16() 1115 \see ReplaceInt16() 1116 1117 \since BeOS R3 1118*/ 1119 1120 1121/*! 1122 \fn status_t BMessage::AddUInt16(const char* name, uint16 value) 1123 \brief Convenience method to add an \c uint16 to the label \a name. 1124 1125 This method calls AddData() with the \c B_UINT16_TYPE \a type. 1126 1127 \param name The label to associate the data with. 1128 \param value The value to store in the message. 1129 1130 \returns A status code, \c B_OK on success or an error code. 1131 1132 \see AddData() for a more detailed overview of the inner workings. 1133 \see FindUInt16() 1134 \see GetUInt16() 1135 \see ReplaceUInt16() 1136 1137 \since BeOS R3 1138*/ 1139 1140 1141/*! 1142 \fn status_t BMessage::AddInt32(const char* name, int32 value) 1143 \brief Convenience method to add an \c int32 to the label \a name. 1144 1145 This method calls AddData() with the \c B_INT32_TYPE \a type. 1146 1147 \param name The label to associate the data with. 1148 \param value The value to store in the message. 1149 1150 \returns A status code, \c B_OK on success or an error code. 1151 1152 \see AddData() for a more detailed overview of the inner workings. 1153 \see FindInt32() 1154 \see GetInt32() 1155 \see ReplaceInt32() 1156 1157 \since BeOS R3 1158*/ 1159 1160 1161/*! 1162 \fn status_t BMessage::AddUInt32(const char* name, uint32 value) 1163 \brief Convenience method to add an \c uint32 to the label \a name. 1164 1165 This method calls AddData() with the \c B_UINT32_TYPE \a type. 1166 1167 \param name The label to associate the data with. 1168 \param value The value to store in the message. 1169 1170 \returns A status code, \c B_OK on success or an error code. 1171 1172 \see AddData() for a more detailed overview of the inner workings. 1173 \see FindUInt32() 1174 \see GetUInt32() 1175 \see ReplaceUInt32() 1176 1177 \since BeOS R3 1178*/ 1179 1180 1181/*! 1182 \fn status_t BMessage::AddInt64(const char* name, int64 value) 1183 \brief Convenience method to add an \c int64 to the label \a name. 1184 1185 This method calls AddData() with the \c B_INT64_TYPE \a type. 1186 1187 \param name The label to associate the data with. 1188 \param value The value to store in the message. 1189 1190 \returns A status code, \c B_OK on success or an error code. 1191 1192 \see AddData() for a more detailed overview of the inner workings. 1193 \see FindInt64() 1194 \see GetInt64() 1195 \see ReplaceInt64() 1196 1197 \since BeOS R3 1198*/ 1199 1200 1201/*! 1202 \fn status_t BMessage::AddUInt64(const char* name, uint64 value) 1203 \brief Convenience method to add an \c uint64 to the label \a name. 1204 1205 This method calls AddData() with the \c B_UINT64_TYPE \a type. 1206 1207 \param name The label to associate the data with. 1208 \param value The value to store in the message. 1209 1210 \returns A status code, \c B_OK on success or an error code. 1211 1212 \see AddData() for a more detailed overview of the inner workings. 1213 \see FindUInt64() 1214 \see GetUInt64() 1215 \see ReplaceUInt64() 1216 1217 \since BeOS R3 1218*/ 1219 1220 1221/*! 1222 \fn status_t BMessage::AddBool(const char* name, bool aBoolean) 1223 \brief Convenience method to add a \c bool to the label \a name. 1224 1225 This method calls AddData() with the \c B_BOOL_TYPE \a type. 1226 1227 \param name The label to associate the data with. 1228 \param aBoolean The value to store in the message. 1229 1230 \returns A status code, \c B_OK on success or an error code. 1231 1232 \see AddData() for a more detailed overview of the inner workings. 1233 \see FindBool() 1234 \see GetBool() 1235 \see ReplaceBool() 1236 1237 \since BeOS R3 1238*/ 1239 1240 1241/*! 1242 \fn status_t BMessage::AddFloat(const char* name, float aFloat) 1243 \brief Convenience method to add a \c float to the label \a name. 1244 1245 This method calls AddData() with the \c B_FLOAT_TYPE \a type. 1246 1247 \param name The label to associate the data with. 1248 \param aFloat The value to store in the message. 1249 1250 \returns A status code, \c B_OK on success or an error code. 1251 1252 \see AddData() for a more detailed overview of the inner workings. 1253 \see FindFloat() 1254 \see GetFloat() 1255 \see ReplaceFloat() 1256 1257 \since BeOS R3 1258*/ 1259 1260 1261/*! 1262 \fn status_t BMessage::AddDouble(const char* name, double aDouble) 1263 \brief Convenience method to add a \c double to the label \a name. 1264 1265 This method calls AddData() with the \c B_DOUBLE_TYPE \a type. 1266 1267 \param name The label to associate the data with. 1268 \param aDouble The value to store in the message. 1269 1270 \returns A status code, \c B_OK on success or an error code. 1271 1272 \see AddData() for a more detailed overview of the inner workings. 1273 \see FindDouble() 1274 \see GetDouble() 1275 \see ReplaceDouble() 1276 1277 \since BeOS R3 1278*/ 1279 1280 1281/*! 1282 \fn status_t BMessage::AddColor(const char* name, rgb_color aColor) 1283 \brief Convenience method to add a \c rgb_color to the label \a name. 1284 1285 This method calls AddData() with the \c B_RGB_32_BIT_TYPE \a type. 1286 1287 \param name The label to associate the data with. 1288 \param aColor The value to store in the message. 1289 1290 \returns A status code, \c B_OK on success or an error code. 1291 1292 \see AddColor() for a more detailed overview of the inner workings. 1293 \see FindColor() 1294 \see GetColor() 1295 \see ReplaceColor() 1296 1297 \since Haiku R1 1298*/ 1299 1300 1301/*! 1302 \fn status_t BMessage::AddPointer(const char* name, const void* aPointer) 1303 \brief Convenience method to add a \c pointer to the label \a name. 1304 1305 This method calls AddData() with the \c B_POINTER_TYPE \a type. 1306 1307 \warning If you want to share objects between applications, remember 1308 that each application has its own address space, and that it 1309 therefore is useless to try to pass around objects by sending 1310 pointers in messages. You should think about copying the 1311 entire object in the message, or you should consider using 1312 shared memory. 1313 1314 \param name The label to associate the data with. 1315 \param aPointer The value to store in the message. 1316 1317 \returns A status code, \c B_OK on success or an error code. 1318 1319 \see AddData() for a more detailed overview of the inner workings. 1320 \see FindPointer() 1321 \see ReplacePointer() 1322 1323 \since BeOS R3 1324*/ 1325 1326 1327/*! 1328 \fn status_t BMessage::AddMessenger(const char* name, BMessenger messenger) 1329 \brief Convenience method to add a messenger to the label \a name. 1330 1331 This method calls AddData() with the \c B_MESSENGER_TYPE \a type. 1332 1333 \param name The label to associate the data with. 1334 \param messenger The messenger to store in the message. 1335 1336 \returns A status code, \c B_OK on success or an error code. 1337 1338 \see AddData() for a more detailed overview of the inner workings. 1339 \see FindMessenger() 1340 \see ReplaceMessenger() 1341 1342 \since BeOS R3 1343*/ 1344 1345 1346/*! 1347 \fn status_t BMessage::AddRef(const char* name, const entry_ref* ref) 1348 \brief Convenience method to add an \c entry_ref to the label \a name. 1349 1350 This method calls AddData() with the \c B_REF_TYPE \a type. 1351 1352 \param name The label to associate the data with. 1353 \param ref The reference to store in the message. 1354 1355 \returns A status code, \c B_OK on success or an error code. 1356 1357 \see AddData() for a more detailed overview of the inner workings. 1358 \see FindRef() 1359 \see ReplaceRef() 1360 1361 \since BeOS R3 1362*/ 1363 1364 1365/*! 1366 \fn status_t BMessage::AddNodeRef(const char* name, const node_ref* ref) 1367 \brief Convenience method to add a \c node_ref with the label \a name. 1368 1369 This method calls AddData() with the \c B_NODE_REF_TYPE \a type. 1370 1371 \param name The label to associate the data with. 1372 \param ref The node reference to store in the message. 1373 1374 \returns A status code, \c B_OK on success or an error code. 1375 1376 \see AddData() for a more detailed overview of the inner workings. 1377 \see FindNodeRef() 1378 \see ReplaceNodeRef() 1379 1380 \since Haiku R1 1381*/ 1382 1383 1384/*! 1385 \fn status_t BMessage::AddMessage(const char* name, 1386 const BMessage* message) 1387 \brief Convenience method to add a message to the label \a name. 1388 1389 This method calls AddData() with the \c B_MESSAGE_TYPE \a type. 1390 1391 \param name The label to associate the data with. 1392 \param message The message to store in this message. 1393 1394 \returns A status code, \c B_OK on success or an error code. 1395 1396 \see AddData() for a more detailed overview of the inner workings. 1397 \see FindMessage() 1398 \see ReplaceMessage() 1399 1400 \since BeOS R3 1401*/ 1402 1403 1404/*! 1405 \fn status_t BMessage::AddFlat(const char* name, BFlattenable* object, 1406 int32 count = 1) 1407 \brief Convenience method to add a flattenable to the label \a name. 1408 1409 \deprecated This method is deprecated. Use 1410 AddFlat(const char*, const BFlattenable*, int32) instead 1411 1412 \since BeOS R3 1413*/ 1414 1415 1416/*! 1417 \fn status_t BMessage::AddFlat(const char* name, 1418 const BFlattenable* object, int32 count = 1) 1419 \brief Convenience method to add a flattenable to the label \a name. 1420 1421 This method uses BFlattenable::TypeCode() to determine the type. It also 1422 uses BFlattenable::IsFixedSize() to determine whether or not the size of 1423 the object is supposedly always the same. You can specify a 1424 \a count, to pre-allocate more entries if you are going to add 1425 more than one of this type. 1426 1427 \param name The label to associate the data with. 1428 \param object The object to flatten into the message. 1429 \param count The number of items to pre-allocate associated with this 1430 \a name. 1431 1432 \returns A status code, \c B_OK on success or an error code. 1433 1434 \see AddData() for a more detailed overview of the inner workings. 1435 \see FindFlat() 1436 \see ReplaceFlat() 1437 1438 \since Haiku R1 1439*/ 1440 1441 1442/*! 1443 \fn status_t BMessage::Append(const BMessage& message) 1444 \brief Append the data of another \a message to this message. 1445 1446 This copies all the data of the \a message to this message. If an item 1447 already exists with a given name, and the incoming data is of the same 1448 type, the new items will be added to that label. If the item exists but 1449 has a different type, then the call will fail. This might leave your 1450 message in an incomplete state, because data is processed field by field, 1451 so it could be that some data was copied succesfully. After encountering an 1452 incompatible data type, any data after that field will not be processed. 1453 1454 \param message The message with the data you want to append. This message 1455 will not be modified. 1456 1457 \returns A status code, \c B_OK on success or an error code. 1458*/ 1459 1460//! @} 1461 1462 1463/*! 1464 \name Removing Data 1465*/ 1466 1467 1468//! @{ 1469 1470 1471/*! 1472 \fn status_t BMessage::RemoveData(const char* name, int32 index) 1473 \brief Remove data associated with \a name at a specified 1474 \a index. 1475 1476 If this is the only instance of the data, then the entire label will be 1477 removed. This means you can recreate it with another type. 1478 1479 \param name The \a name of which the associated data should be cleared. 1480 \param index The \a index of the item that should be cleared. 1481 1482 \returns A status code, \c B_OK on success or an error code. 1483 \retval B_OK The data has been removed. 1484 \retval B_BAD_VALUE The \a index is less than \c 0. 1485 \retval B_BAD_INDEX The \a index is out of bounds. 1486 \retval B_NAME_NOT_FOUND The \a name does not have any data associated 1487 with it. 1488 1489 \see RemoveName() 1490 \see MakeEmpty() 1491 1492 \since BeOS R3 1493*/ 1494 1495 1496/*! 1497 \fn status_t BMessage::RemoveName(const char* name) 1498 \brief Remove all data associated with a \a name. 1499 1500 This also removes the label, so that you can recreate it with another type, 1501 if you want to. 1502 1503 \param name The \a name that refers to the data you want to clear out. 1504 1505 \returns A status code, \c B_OK on success or an error code. 1506 \retval B_OK All the data is removed. 1507 \retval B_BAD_VALUE The \a name pointer points to \c NULL. 1508 \retval B_NAME_NOT_FOUND The \a name does not exist in this message. 1509 1510 \see RemoveData() 1511 \see MakeEmpty() 1512 1513 \since BeOS R3 1514*/ 1515 1516 1517/*! 1518 \fn status_t BMessage::MakeEmpty() 1519 \brief Clear all data and metadata in this message. 1520 1521 Everything is cleared out, all labels and all associated data, as well 1522 as metadata such as reply info. 1523 1524 \return This method always returns \c B_OK. 1525 1526 \see RemoveData() 1527 \see RemoveName() 1528 1529 \since BeOS R3 1530*/ 1531 1532 1533//! @} 1534 1535 1536/*! 1537 \name Finding Data 1538 1539 Look at FindData() for a general introduction to finding data. 1540*/ 1541 1542/* TODO: 1543 Quick overview: 1544 1545 <table> 1546 <tr><th>Type of data</th><th>Type code</th><th>Method</td></tr> 1547 <tr><td>BRect</td><td>\c B_RECT_TYPE</td><td>FindRect()</td></tr> 1548 </table> 1549*/ 1550 1551 1552//! @{ 1553 1554 1555/*! 1556 \fn status_t BMessage::FindData(const char* name, type_code type, 1557 int32 index, const void** data, ssize_t* numBytes) const 1558 \brief Find \a data that is stored in this message at an 1559 \a index. 1560 1561 This method matches the label \a name with the \a type you 1562 are asking for, and it looks for the data that is stored at a certain 1563 \a index number. If all these things match, you will get a pointer 1564 to the internal buffer, and the method will put the size of the item in 1565 \a numBytes. 1566 1567 Note that only this method, and FindString(const char*, const char**), 1568 pass a pointer to the internal buffer. The other more specific methods, 1569 such as FindBool() and FindRect() copy the data into a buffer you specify. 1570 This means that the data retrieved with this method is valid until the 1571 message is deleted. 1572 1573 \param name The label the data should be associated with. 1574 \param type The type of data you want to retrieve. You can pass 1575 \c B_ANY_TYPE if you don't mind which type the data is. 1576 \param index The index in the array of the data that you want to retrieve. 1577 Note that the array is zero-based. 1578 \param[out] data A pointer to a pointer where the data can point to. 1579 \param[out] numBytes The size of the data will be put in this parameter. 1580 1581 \returns A status code, \c B_OK on success or an error code. 1582 \retval B_OK The \a name was found, matches the type, and the data 1583 at \a index has been put in \a data. 1584 \retval B_BAD_VALUE One of the output arguments were \c NULL. 1585 \retval B_BAD_INDEX The \a index does not exist. 1586 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1587 1588 \see status_t FindData(const char*, type_code, int32, 1589 const void**, ssize_t*) const 1590 1591 \since BeOS R3 1592*/ 1593 1594 1595/*! 1596 \fn status_t BMessage::FindData(const char* name, type_code type, 1597 const void** data, ssize_t* numBytes) const 1598 \brief Find \a data that is stored in this message. 1599 1600 This is an overloaded version of 1601 FindData(const char*, type_code, int32, const void**, ssize_t*) const 1602 where data is sought at \a index \c 0. 1603 1604 \since BeOS R3 1605*/ 1606 1607 1608/*! 1609 \fn status_t BMessage::FindAlignment(const char* name, 1610 BAlignment* alignment) const 1611 \brief Find an alignment at the label \a name. 1612 1613 This is an overloaded version of 1614 FindAlignment(const char*, int32, BAlignment*) const 1615 where the data is sought at \a index \c 0. 1616 1617 \since Haiku R1 1618*/ 1619 1620 1621/*! 1622 \fn status_t BMessage::FindAlignment(const char* name, int32 index, 1623 BAlignment* alignment) const 1624 \brief Find an alignment at the label \a name at an \a index. 1625 1626 This method looks for the data with the \c B_ALIGNMENT_TYPE, and copies 1627 it into a provided buffer. 1628 1629 \param name The label to which the data is associated. 1630 \param index The index from which the data should be copied. 1631 \param alignment The object in which the data should be copied. 1632 1633 \returns A status code, \c B_OK on success or an error code. 1634 \retval B_OK The object now contains the requested data. 1635 \retval B_BAD_INDEX The \a index does not exist. 1636 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1637 1638 \see FindAlignment(const char*, BAlignment*) const 1639 1640 \since Haiku R1 1641*/ 1642/*! 1643 \fn status_t BMessage::FindRect(const char* name, BRect* rect) const 1644 \brief Find a rectangle at the label \a name. 1645 1646 This is an overloaded version of 1647 FindRect(const char*, int32, BRect*) const 1648 where the data is sought at \a index \c 0. 1649 1650 \since BeOS R3 1651*/ 1652 1653 1654/*! 1655 \fn status_t BMessage::FindRect(const char* name, int32 index, 1656 BRect* rect) const 1657 \brief Find a rectangle at the label \a name at an \a index. 1658 1659 This method looks for the data with the \c B_RECT_TYPE, and copies it into 1660 a provided buffer. 1661 1662 \param name The label to which the data is associated. 1663 \param index The index from which the data should be copied. 1664 \param rect The object in which the data should be copied. 1665 1666 \returns A status code, \c B_OK on success or an error code. 1667 \retval B_OK The object now contains the requested data. 1668 \retval B_BAD_INDEX The \a index does not exist. 1669 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1670 1671 \see FindRect(const char*, BRect*) const 1672 1673 \since BeOS R3 1674*/ 1675 1676 1677/*! 1678 \fn status_t BMessage::FindPoint(const char* name, BPoint* point) const 1679 \brief Find a point at the label \a name. 1680 1681 This is an overloaded version of 1682 FindPoint(const char*, int32, BPoint*) const 1683 where the data is sought at \a index \c 0. 1684 1685 \since BeOS R3 1686*/ 1687 1688 1689/*! 1690 \fn status_t BMessage::FindPoint(const char* name, int32 index, 1691 BPoint* point) const 1692 \brief Find a point at the label \a name at an \a index. 1693 1694 This method looks for the data with the \c B_POINT_TYPE, and copies it into 1695 a provided buffer. 1696 1697 \param name The label to which the data is associated. 1698 \param index The index from which the data should be copied. 1699 \param point The object in which the data should be copied. 1700 1701 \returns A status code, \c B_OK on success or an error code. 1702 \retval B_OK The object now contains the requested data. 1703 \retval B_BAD_INDEX The \a index does not exist. 1704 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1705 1706 \see FindPoint(const char*, BPoint*) const 1707 1708 \since BeOS R3 1709*/ 1710 1711 1712/*! 1713 \fn status_t BMessage::FindSize(const char* name, BSize* size) const 1714 \brief Find a size at the label \a name. 1715 1716 This is an overloaded version of 1717 FindSize(const char*, int32, BSize*) const 1718 where the data is sought at \a index \c 0. 1719 1720 \since Haiku R1 1721*/ 1722 1723 1724/*! 1725 \fn status_t BMessage::FindSize(const char* name, int32 index, 1726 BSize* size) const 1727 \brief Find a size at the label \a name at an \a index. 1728 1729 This method looks for the data with the \c B_SIZE_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 size 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 FindSize(const char*, BSize*) const 1742 1743 \since Haiku R1 1744*/ 1745 1746 1747/*! 1748 \fn status_t BMessage::FindString(const char* name, 1749 const char** string) const 1750 \brief Find a string at the label \a name. 1751 1752 This is an overloaded version of 1753 FindString(const char*, int32, const char**) const 1754 where the data is sought at \a index \c 0. 1755 1756 \since BeOS R3 1757*/ 1758 1759 1760/*! 1761 \fn status_t BMessage::FindString(const char* name, int32 index, 1762 const char** string) const 1763 \brief Find a string at the label \a name at an \a index. 1764 1765 This method looks for the data with the \c B_STRING_TYPE, and returns a 1766 pointer to the internal buffer of the message. Note that this pointer is 1767 valid, until the message is deleted. 1768 1769 \param name The label to which the data is associated. 1770 \param index The index from which the data should be copied. 1771 \param string The object in which the data should be copied. 1772 1773 \returns A status code, \c B_OK on success or an error code. 1774 \retval B_OK The object now contains the requested data. 1775 \retval B_BAD_INDEX The \a index does not exist. 1776 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1777 1778 \see FindString(const char*, const char**) const 1779 \see FindString(const char*, int32, BString*) const 1780 1781 \since BeOS R3 1782*/ 1783 1784 1785/*! 1786 \fn status_t BMessage::FindString(const char* name, BString* string) const 1787 \brief Find a string at the label \a name. 1788 1789 This is an overloaded version of 1790 FindString(const char*, int32, BString*) const 1791 where the data is sought at \a index \c 0. 1792 1793 \since BeOS R5 1794*/ 1795 1796 1797/*! 1798 \fn status_t BMessage::FindString(const char* name, int32 index, 1799 BString* string) const 1800 \brief Find a string at the label \a name at an \a index. 1801 1802 This method looks for the data with the \c B_STRING_TYPE, and copies it 1803 into the \a string object. 1804 1805 \param name The label to which the data is associated. 1806 \param index The index from which the data should be copied. 1807 \param string The object in which the data should be copied. 1808 1809 \returns A status code, \c B_OK on success or an error code. 1810 \retval B_OK The object now contains the requested data. 1811 \retval B_BAD_INDEX The \a index does not exist. 1812 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1813 1814 \see FindString(const char*, BString*) const 1815 \see FindString(const char*, int32, const char**) const 1816 1817 \since BeOS R5 1818*/ 1819 1820 1821/*! 1822 \fn status_t BMessage::FindStrings(const char* name, 1823 BStringList* list) const 1824 \brief Find all the strings at the label \a name. 1825 1826 This method fetches all the strings that are stored at label \a name, and 1827 copies all the entries into the \a list. 1828 1829 \since Haiku R1 1830*/ 1831 1832 1833/*! 1834 \fn status_t BMessage::FindInt8(const char* name, int8* value) const 1835 \brief Find an integer at the label \a name. 1836 1837 This is an overloaded version of 1838 FindInt8(const char*, int32, int8*) const 1839 where the data is sought at \a index \c 0. 1840 1841 \since BeOS R3 1842*/ 1843 1844 1845/*! 1846 \fn status_t BMessage::FindInt8(const char* name, int32 index, 1847 int8* value) const 1848 \brief Find an integer at the label \a name at an \a index. 1849 1850 This method looks for the data with the \c B_INT8_TYPE, and copies it into 1851 a provided buffer. 1852 1853 \param name The label to which the data is associated. 1854 \param index The index from which the data should be copied. 1855 \param value The object in which the data should be copied. 1856 1857 \returns A status code, \c B_OK on success or an error code. 1858 \retval B_OK The object now contains the requested data. 1859 \retval B_BAD_INDEX The \a index does not exist. 1860 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1861 1862 \see FindInt8(const char*, int8*) const 1863 1864 \since BeOS R3 1865*/ 1866 1867 1868/*! 1869 \fn status_t BMessage::FindUInt8(const char* name, uint8* value) const 1870 \brief Find an integer at the label \a name. 1871 1872 This is an overloaded version of 1873 FindUInt8(const char*, int32, uint8*) const 1874 where the data is sought at \a index \c 0. 1875 1876 \since BeOS R3 1877*/ 1878 1879 1880/*! 1881 \fn status_t BMessage::FindUInt8(const char* name, int32 index, 1882 uint8* value) const 1883 \brief Find an integer at the label \a name at an \a index. 1884 1885 This method looks for the data with the \c B_UINT8_TYPE, and copies it into 1886 a provided buffer. 1887 1888 \param name The label to which the data is associated. 1889 \param index The index from which the data should be copied. 1890 \param value The object in which the data should be copied. 1891 1892 \returns A status code, \c B_OK on success or an error code. 1893 \retval B_OK The object now contains the requested data. 1894 \retval B_BAD_INDEX The \a index does not exist. 1895 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1896 1897 \see FindUInt8(const char*, uint8*) const 1898 1899 \since BeOS R3 1900*/ 1901 1902 1903/*! 1904 \fn status_t BMessage::FindInt16(const char* name, int16* value) const 1905 \brief Find an integer at the label \a name. 1906 1907 This is an overloaded version of FindInt16(const char*, int32, int16*) const 1908 where the data is sought at \a index \c 0. 1909 1910 \param name The label to which the data is associated. 1911 \param value The object in which the data should be copied. 1912 1913 \returns A status code, \c B_OK on success or an error code. 1914 \retval B_OK The object now contains the requested data. 1915 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1916 1917 \since BeOS R3 1918*/ 1919 1920 1921/*! 1922 \fn status_t BMessage::FindInt16(const char* name, int32 index, 1923 int16* value) const 1924 \brief Find an integer at the label \a name at an \a index. 1925 1926 This method looks for the data with the \c B_INT16_TYPE, and copies it into 1927 a provided buffer. 1928 1929 \param name The label to which the data is associated. 1930 \param index The index from which the data should be copied. 1931 \param value 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_BAD_INDEX The \a index does not exist. 1936 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1937 1938 \see FindInt16(const char*, int16*) const 1939 1940 \since BeOS R3 1941*/ 1942 1943 1944/*! 1945 \fn status_t BMessage::FindUInt16(const char* name, uint16* value) const 1946 \brief Find an integer at the label \a name. 1947 1948 This is an overloaded version of FindUInt16(const char*, int32, uint16*) const 1949 where the data is sought at \a index \c 0. 1950 1951 \param name The label to which the data is associated. 1952 \param value The object in which the data should be copied. 1953 1954 \returns A status code, \c B_OK on success or an error code. 1955 \retval B_OK The object now contains the requested data. 1956 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1957 1958 \since BeOS R3 1959*/ 1960 1961 1962/*! 1963 \fn status_t BMessage::FindUInt16(const char* name, int32 index, 1964 uint16* value) const 1965 \brief Find an integer at the label \a name at an \a index. 1966 1967 This method looks for the data with the \c B_UINT16_TYPE, and copies it 1968 into a provided buffer. 1969 1970 \param name The label to which the data is associated. 1971 \param index The index from which the data should be copied. 1972 \param value The object in which the data should be copied. 1973 1974 \returns A status code, \c B_OK on success or an error code. 1975 \retval B_OK The object now contains the requested data. 1976 \retval B_BAD_INDEX The \a index does not exist. 1977 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1978 1979 \see FindUInt16(const char*, uint16*) const 1980 1981 \since BeOS R3 1982*/ 1983 1984 1985/*! 1986 \fn status_t BMessage::FindInt32(const char* name, int32* value) const 1987 \brief Find an integer at the label \a name. 1988 1989 This is an overloaded version of 1990 FindInt32(const char*, int32, int32*) const 1991 where the data is sought at \a index \c 0. 1992 1993 \param name The label to which the data is associated. 1994 \param value 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_NAME_NOT_FOUND There is no field with this \a name. 1999 2000 \since BeOS R3 2001*/ 2002 2003 2004/*! 2005 \fn status_t BMessage::FindInt32(const char* name, int32 index, 2006 int32* value) const 2007 \brief Find an integer at the label \a name at an \a index. 2008 2009 This method looks for the data with the \c B_INT32_TYPE, and copies 2010 it into a provided buffer. 2011 2012 \param name The label to which the data is associated. 2013 \param index The index from which the data should be copied. 2014 \param value The object in which the data should be copied. 2015 2016 \returns A status code, \c B_OK on success or an error code. 2017 \retval B_OK The object now contains the requested data. 2018 \retval B_BAD_INDEX The \a index does not exist. 2019 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2020 2021 \see FindInt32(const char*, int32*) const 2022 2023 \since BeOS R3 2024*/ 2025 2026 2027/*! 2028 \fn status_t BMessage::FindUInt32(const char* name, uint32* value) const 2029 \brief Find an integer at the label \a name. 2030 2031 This is an overloaded version of 2032 FindUInt32(const char*, int32, uint32*) const 2033 where the data is sought at \a index \c 0. 2034 2035 \param name The label to which the data is associated. 2036 \param value The object in which the data should be copied. 2037 2038 \returns A status code, \c B_OK on success or an error code. 2039 \retval B_OK The object now contains the requested data. 2040 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2041 2042 \since BeOS R3 2043*/ 2044 2045 2046/*! 2047 \fn status_t BMessage::FindUInt32(const char* name, int32 index, 2048 uint32* value) const 2049 \brief Find an integer at the label \a name at an \a index. 2050 2051 This method looks for the data with the \c B_UINT32_TYPE, and copies 2052 it into a provided buffer. 2053 2054 \param name The label to which the data is associated. 2055 \param index The index from which the data should be copied. 2056 \param value The object in which the data should be copied. 2057 2058 \returns A status code, \c B_OK on success or an error code. 2059 \retval B_OK The object now contains the requested data. 2060 \retval B_BAD_INDEX The \a index does not exist. 2061 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2062 2063 \see FindUInt32(const char*, uint32*) const 2064 2065 \since BeOS R3 2066*/ 2067 2068 2069/*! 2070 \fn status_t BMessage::FindInt64(const char* name, int64* value) const 2071 \brief Find an integer at the label \a name. 2072 2073 This is an overloaded version of 2074 FindInt64(const char*, int32, int64*) const 2075 where the data is sought at \a index \c 0. 2076 2077 \param name The label to which the data is associated. 2078 \param value The object in which the data should be copied. 2079 2080 \returns A status code, \c B_OK on success or an error code. 2081 \retval B_OK The object now contains the requested data. 2082 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2083 2084 \since BeOS R3 2085*/ 2086 2087 2088/*! 2089 \fn status_t BMessage::FindInt64(const char* name, int32 index, 2090 int64* value) const 2091 \brief Find an integer at the label \a name at an \a index. 2092 2093 This method looks for the data with the \c B_INT64_TYPE, and copies 2094 it into a provided buffer. 2095 2096 \param name The label to which the data is associated. 2097 \param index The index from which the data should be copied. 2098 \param value The object in which the data should be copied. 2099 2100 \returns A status code, \c B_OK on success or an error code. 2101 \retval B_OK The object now contains the requested data. 2102 \retval B_BAD_INDEX The \a index does not exist. 2103 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2104 2105 \see FindInt64(const char*, int64*) const 2106 2107 \since BeOS R3 2108*/ 2109 2110 2111/*! 2112 \fn status_t BMessage::FindUInt64(const char* name, uint64* value) const 2113 \brief Find an integer at the label \a name. 2114 2115 This is an overloaded version of 2116 FindUInt64(const char*, int32, uint64*) const 2117 where the data is sought at \a index \c 0. 2118 2119 \param name The label to which the data is associated. 2120 \param value The object in which the data should be copied. 2121 2122 \returns A status code, \c B_OK on success or an error code. 2123 \retval B_OK The object now contains the requested data. 2124 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2125 2126 \since BeOS R3 2127*/ 2128 2129 2130/*! 2131 \fn status_t BMessage::FindUInt64(const char* name, int32 index, 2132 uint64* value) const 2133 \brief Find an integer at the label \a name at an \a index. 2134 2135 This method looks for the data with the \c B_UINT64_TYPE, and copies 2136 it into a provided buffer. 2137 2138 \param name The label to which the data is associated. 2139 \param index The index from which the data should be copied. 2140 \param value The object in which the data should be copied. 2141 2142 \returns A status code, \c B_OK on success or an error code. 2143 \retval B_OK The object now contains the requested data. 2144 \retval B_BAD_INDEX The \a index does not exist. 2145 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2146 2147 \see FindUInt64(const char*, uint64*) const 2148 2149 \since BeOS R3 2150*/ 2151 2152 2153/*! 2154 \fn status_t BMessage::FindBool(const char* name, bool* value) const 2155 \brief Find a boolean at the label \a name. 2156 2157 This is an overloaded version of 2158 FindBool(const char*, int32, bool*) const 2159 where the data is sought at \a index \c 0. 2160 2161 \param name The label to which the data is associated. 2162 \param value The object in which the data should be copied. 2163 2164 \returns A status code, \c B_OK on success or an error code. 2165 \retval B_OK The object now contains the requested data. 2166 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2167 2168 \since BeOS R3 2169*/ 2170 2171 2172/*! 2173 \fn status_t BMessage::FindBool(const char* name, int32 index, 2174 bool* value) const 2175 \brief Find a boolean at the label \a name at an \a index. 2176 2177 This method looks for the data with the \c B_BOOL_TYPE, and copies it into 2178 a provided buffer. 2179 2180 \param name The label to which the data is associated. 2181 \param index The index from which the data should be copied. 2182 \param value The object in which the data should be copied. 2183 2184 \returns A status code, \c B_OK on success or an error code. 2185 \retval B_OK The object now contains the requested data. 2186 \retval B_BAD_INDEX The \a index does not exist. 2187 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2188 2189 \see FindBool(const char*, bool*) const 2190 2191 \since BeOS R3 2192*/ 2193 2194 2195/*! 2196 \fn status_t BMessage::FindFloat(const char* name, float* value) const 2197 \brief Find a float at the label \a name. 2198 2199 This is an overloaded version of 2200 FindFloat(const char*, int32, float*) const 2201 where the data is sought at \a index \c 0. 2202 2203 \param name The label to which the data is associated. 2204 \param value The object in which the data should be copied. 2205 2206 \returns A status code, \c B_OK on success or an error code. 2207 \retval B_OK The object now contains the requested data. 2208 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2209 2210 \since BeOS R3 2211*/ 2212 2213 2214/*! 2215 \fn status_t BMessage::FindFloat(const char* name, int32 index, 2216 float* value) const 2217 \brief Find a float at the label \a name at an \a index. 2218 2219 This method looks for the data with the \c B_FLOAT_TYPE, and copies 2220 it into a provided buffer. 2221 2222 \param name The label to which the data is associated. 2223 \param index The index from which the data should be copied. 2224 \param value The object in which the data should be copied. 2225 2226 \returns A status code, \c B_OK on success or an error code. 2227 \retval B_OK The object now contains the requested data. 2228 \retval B_BAD_INDEX The \a index does not exist. 2229 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2230 2231 \see FindFloat(const char*, float*) const 2232 2233 \since BeOS R3 2234*/ 2235 2236 2237/*! 2238 \fn status_t BMessage::FindDouble(const char* name, double* value) const 2239 \brief Find a double at the label \a name. 2240 2241 This is an overloaded version of 2242 FindDouble(const char*, int32, double*) const 2243 where the data is sought at \a index \c 0. 2244 2245 \param name The label to which the data is associated. 2246 \param value The object in which the data should be copied. 2247 2248 \returns A status code, \c B_OK on success or an error code. 2249 \retval B_OK The object now contains the requested data. 2250 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2251 2252 \since BeOS R3 2253*/ 2254 2255 2256/*! 2257 \fn status_t BMessage::FindDouble(const char* name, int32 index, 2258 double* value) const 2259 \brief Find a double at the label \a name at an \a index. 2260 2261 This method looks for the data with the \c B_DOUBLE_TYPE, and copies it into 2262 a provided buffer. 2263 2264 \param name The label to which the data is associated. 2265 \param index The index from which the data should be copied. 2266 \param value The object in which the data should be copied. 2267 2268 \returns A status code, \c B_OK on success or an error code. 2269 \retval B_OK The object now contains the requested data. 2270 \retval B_BAD_INDEX The \a index does not exist. 2271 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2272 2273 \see FindDouble(const char*, double*) const 2274 2275 \since BeOS R3 2276*/ 2277 2278 2279/*! 2280 \fn status_t BMessage::FindColor(const char* name, rgb_color* value) const 2281 \brief Find a color with the label \a name. 2282 2283 This is an overloaded version of 2284 FindColor(const char*, int32, rgb_color*) const 2285 where the data is sought at \a index \c 0. 2286 2287 \param name The label to which the data is associated. 2288 \param value The object in which the data should be copied. 2289 2290 \returns A status code, \c B_OK on success or an error code. 2291 \retval B_OK The object now contains the requested data. 2292 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2293 2294 \since Haiku R1 2295*/ 2296 2297 2298/*! 2299 \fn status_t BMessage::FindColor(const char* name, int32 index, 2300 rgb_color* value) const 2301 \brief Find a color at the label \a name at an \a index. 2302 2303 This method looks for the data with the \c B_RGB_32_BIT_TYPE, and copies 2304 it into a provided buffer. 2305 2306 \param name The label to which the data is associated. 2307 \param index The index from which the data should be copied. 2308 \param value The object in which the data should be copied. 2309 2310 \returns A status code, \c B_OK on success or an error code. 2311 \retval B_OK The object now contains the requested data. 2312 \retval B_BAD_INDEX The \a index does not exist. 2313 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2314 2315 \see FindColor(const char*, rgb_color*) const 2316 2317 \since BeOS R3 2318*/ 2319 2320 2321/*! 2322 \fn status_t BMessage::FindPointer(const char* name, void** pointer) const 2323 \brief Find a pointer at the label \a name. 2324 2325 This is an overloaded version of 2326 FindPointer(const char*, int32, void*) const 2327 where the data is sought at \a index \c 0. 2328 2329 \param name The label to which the data is associated. 2330 \param pointer The object in which the data should be copied. 2331 2332 \returns A status code, \c B_OK on success or an error code. 2333 \retval B_OK The object now contains the requested data. 2334 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2335 2336 \since BeOS R3 2337*/ 2338 2339 2340/*! 2341 \fn status_t BMessage::FindPointer(const char* name, int32 index, 2342 void** pointer) const 2343 \brief Find a pointer at the label \a name at an \a index. 2344 2345 This method looks for the data with the \c B_POINTER_TYPE, and copies 2346 it into a provided buffer. 2347 2348 \warning If you want to share objects between applications, remember 2349 that each application has its own address space, and that it 2350 therefore is useless to try to pass around objects by sending 2351 pointers in messages. You should think about copying the entire 2352 object in the message, or you should consider using shared memory. 2353 2354 \param name The label to which the data is associated. 2355 \param index The index from which the data should be copied. 2356 \param pointer The object in which the data should be copied. 2357 2358 \returns A status code, \c B_OK on success or an error code. 2359 \retval B_OK The object now contains the requested data. 2360 \retval B_BAD_INDEX The \a index does not exist. 2361 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2362 2363 \see FindPointer(const char*, void*) const 2364 2365 \since BeOS R3 2366*/ 2367 2368 2369/*! 2370 \fn status_t BMessage::FindMessenger(const char* name, 2371 BMessenger* messenger) const 2372 \brief Find a messenger at the label \a name. 2373 2374 This is an overloaded version of 2375 FindMessenger(const char*, int32, BMessenger*) const 2376 where the data is sought at \a index \c 0. 2377 2378 \param name The label to which the data is associated. 2379 \param messenger The object in which the data should be copied. 2380 2381 \returns A status code, \c B_OK on success or an error code. 2382 \retval B_OK The object now contains the requested data. 2383 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2384 2385 \since BeOS R3 2386*/ 2387 2388 2389/*! 2390 \fn status_t BMessage::FindMessenger(const char* name, int32 index, 2391 BMessenger* messenger) const 2392 \brief Find a messenger at the label \a name at an \a index. 2393 2394 This method looks for the data with the \c B_MESSENGER_TYPE, and copies it 2395 into a provided buffer. 2396 2397 \param name The label to which the data is associated. 2398 \param index The index from which the data should be copied. 2399 \param messenger The object in which the data should be copied. 2400 2401 \returns A status code, \c B_OK on success or an error code. 2402 \retval B_OK The object now contains the requested data. 2403 \retval B_BAD_INDEX The \a index does not exist. 2404 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2405 2406 \see FindMessenger(const char*, BMessenger*) const 2407 2408 \since BeOS R3 2409*/ 2410 2411 2412/*! 2413 \fn status_t BMessage::FindRef(const char* name, entry_ref* ref) const 2414 \brief Find a reference to a file at the label \a name. 2415 2416 This is an overloaded version of 2417 FindRef(const char*, int32, entry_ref*) const 2418 where the data is sought at \a index \c 0. 2419 2420 \param name The label to which the data is associated. 2421 \param ref The object in which the data should be copied. 2422 2423 \returns A status code, \c B_OK on success or an error code. 2424 \retval B_OK The object now contains the requested data. 2425 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2426 2427 \since BeOS R3 2428*/ 2429 2430 2431/*! 2432 \fn status_t BMessage::FindRef(const char* name, int32 index, 2433 entry_ref* ref) const 2434 \brief Find a reference to a file at the label \a name at an 2435 \a index. 2436 2437 This method looks for the data with the \c B_REF_TYPE, and copies it into 2438 a provided buffer. 2439 2440 \param name The label to which the data is associated. 2441 \param index The index from which the data should be copied. 2442 \param ref The object in which the data should be copied. 2443 2444 \returns A status code, \c B_OK on success or an error code. 2445 \retval B_OK The object now contains the requested data. 2446 \retval B_BAD_INDEX The \a index does not exist. 2447 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2448 2449 \see FindRef(const char*, entry_ref*) const 2450 2451 \since BeOS R3 2452*/ 2453 2454 2455/*! 2456 \fn status_t BMessage::FindNodeRef(const char* name, node_ref* ref) const 2457 \brief Find a reference to a node at the label \a name. 2458 2459 This is an overloaded version of 2460 FindNodeRef(const char*, int32, node_ref*) const 2461 where the data is sought at \a index \c 0. 2462 2463 \param name The label to which the data is associated. 2464 \param ref The object into which the data should be copied. 2465 2466 \returns A status code, \c B_OK on success or an error code. 2467 \retval B_OK The object now contains the requested data. 2468 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2469 2470 \since Haiku R1 2471*/ 2472 2473 2474/*! 2475 \fn status_t BMessage::FindNodeRef(const char* name, int32 index, 2476 node_ref* ref) const 2477 \brief Find a reference to a node at the label \a name at an 2478 \a index. 2479 2480 This method looks for the data with the \c B_NODE_REF_TYPE, and copies 2481 it into a provided buffer. 2482 2483 \param name The label to which the data is associated. 2484 \param index The index from which the data should be copied. 2485 \param ref The object in which the data should be copied. 2486 2487 \returns A status code, \c B_OK on success or an error code. 2488 \retval B_OK The object now contains the requested data. 2489 \retval B_BAD_INDEX The \a index does not exist. 2490 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2491 2492 \see FindNodeRef(const char*, node_ref*) const 2493 2494 \since Haiku R1 2495*/ 2496 2497 2498/*! 2499 \fn status_t BMessage::FindMessage(const char* name, 2500 BMessage* message) const 2501 \brief Find a message at the label \a name. 2502 2503 This is an overloaded version of 2504 FindMessage(const char*, int32, BMessage*) const 2505 where the data is sought at \a index \c 0. 2506 2507 \param name The label to which the data is associated. 2508 \param message The object in which the data should be copied. 2509 2510 \returns A status code, \c B_OK on success or an error code. 2511 \retval B_OK The object now contains the requested data. 2512 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2513 2514 \since BeOS R3 2515*/ 2516 2517 2518/*! 2519 \fn status_t BMessage::FindMessage(const char* name, int32 index, 2520 BMessage* message) const 2521 \brief Find a message at the label \a name at an \a index. 2522 2523 This method looks for the data with the \c B_MESSAGE_TYPE, and 2524 copies it into a provided buffer. 2525 2526 \param name The label to which the data is associated. 2527 \param index The index from which the data should be copied. 2528 \param message The object in which the data should be copied. 2529 2530 \returns A status code, \c B_OK on success or an error code. 2531 \retval B_OK The object now contains the requested data. 2532 \retval B_BAD_INDEX The \a index does not exist. 2533 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2534 2535 \see FindMessage(const char*, BMessage*) const 2536 2537 \since BeOS R3 2538*/ 2539 2540 2541/*! 2542 \fn status_t BMessage::FindFlat(const char* name, 2543 BFlattenable* object) const 2544 \brief Find a flattened object at the label \a name. 2545 2546 This is an overloaded version of 2547 FindFlat(const char*, int32, BFlattenable*) const 2548 where the data is sought at \a index \c 0. 2549 2550 \param name The label to which the data is associated. 2551 \param object The object in which the data should be unflattened. 2552 2553 \returns A status code, \c B_OK on success or an error code. 2554 \retval B_OK The object now contains the requested data. 2555 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2556 2557 \since BeOS R3 2558*/ 2559 2560 2561/*! 2562 \fn status_t BMessage::FindFlat(const char* name, int32 index, 2563 BFlattenable* object) const 2564 \brief Find a flattened object at the label \a name at an 2565 \a index. 2566 2567 The type is determined by the type of the passed object. If that type is 2568 available at the specified label, then the Unflatten() method of that 2569 object will be called. 2570 2571 \param name The label to which the data is associated. 2572 \param index The index from which the data should be unflattened. 2573 \param object The object in which the data should be unflattened. 2574 2575 \returns A status code, \c B_OK on success or an error code. 2576 \retval B_OK The object now contains the requested data. 2577 \retval B_BAD_INDEX The \a index does not exist. 2578 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2579 2580 \see FindFlat(const char*, BFlattenable*) const 2581 2582 \since BeOS R3 2583*/ 2584 2585 2586//! @} 2587 2588 2589/*! 2590 \name Replacing Data 2591 2592 Look at ReplaceData() for a general introduction to replacing data. 2593*/ 2594 2595 2596//! @{ 2597 2598 2599/*! 2600 \fn status_t BMessage::ReplaceData(const char* name, type_code type, 2601 const void* data, ssize_t numBytes) 2602 \brief Replace the data at label \a name. 2603 2604 This method is an overloaded method that replaces the data at 2605 \a index \c 0. See 2606 ReplaceData(const char*, type_code, int32, const void*, ssize_t). 2607 2608 \param name The name associated with the data to replace. 2609 \param type The type of the data. 2610 \param data A pointer to the new data that needs to be copied into 2611 the message. 2612 \param numBytes The size of the new data. 2613 2614 \returns A status code, \c B_OK on success or an error code. 2615 2616 \since BeOS R3 2617*/ 2618 2619 2620/*! 2621 \fn status_t BMessage::ReplaceData(const char* name, type_code type, 2622 int32 index, const void* data, ssize_t numBytes) 2623 \brief Replace the data at label \a name at a specified 2624 \a index. 2625 2626 The conditions for replacing data are that the\a name is correct, 2627 the \a type matches and the data entry at \a index exists. 2628 2629 There is also a collection of convenience methods, that allow you to 2630 efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()), 2631 and so on. 2632 2633 \param name The name associated with the data to replace. 2634 \param type The type of the data. 2635 \param index The index in the array to replace. 2636 \param data A pointer to the new data that needs to be copied into 2637 the message. 2638 \param numBytes The size of the new data. 2639 2640 \returns A status code, \c B_OK on success or an error code. 2641 \retval B_OK The operation succeeded. 2642 \retval B_BAD_VALUE One of the input parameters are invalid. Check that 2643 you did not pass \c NULL, and in case the field has fixed sized 2644 data, check that \a numBytes is the same as the specified fixed 2645 size. 2646 \retval B_BAD_INDEX The \a index is out of range. 2647 2648 \since BeOS R3 2649*/ 2650 2651 2652/*! 2653 \fn status_t BMessage::ReplaceAlignment(const char* name, 2654 const BAlignment& alignment) 2655 \brief Replace an alignment at the label \a name. 2656 2657 This method is an overloaded method of 2658 ReplaceAlignment(const char*, int32, const BAlignment&). 2659 It replaces the data at \a index \c 0. 2660 2661 \param name The name associated with the data to replace. 2662 \param alignment The object to store in the message. 2663 2664 \returns A status code, \c B_OK on success or an error code. 2665 \retval B_OK The object now contains the requested data. 2666 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2667 2668 \since Haiku R1 2669*/ 2670 2671 2672/*! 2673 \fn status_t BMessage::ReplaceAlignment(const char* name, int32 index, 2674 const BAlignment& alignment) 2675 \brief Replace an alignment at the label \a name at a specified 2676 \a index. 2677 2678 The data at the specified \a name and \a index will be replaced, if it 2679 matches the \c B_ALIGNMENT_TYPE. 2680 2681 \param name The name associated with the data to replace. 2682 \param index The index in the array to replace. 2683 \param alignment The object to store in the message. 2684 2685 \returns A status code, \c B_OK on success or an error code. 2686 \retval B_OK The operation succeeded. 2687 \retval B_BAD_INDEX The index was out of range. 2688 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2689 2690 \see ReplaceAlignment(const char*, const BAlignment&) 2691 2692 \since Haiku R1 2693*/ 2694 2695 2696/*! 2697 \fn status_t BMessage::ReplaceRect(const char* name, BRect aRect) 2698 \brief Replace a rectangle at the label \a name. 2699 2700 This method is an overloaded method of 2701 ReplaceRect(const char*, int32, BRect). 2702 It replaces the data at \a index \c 0. 2703 2704 \param name The name associated with the data to replace. 2705 \param aRect The object to store in the message. 2706 2707 \returns A status code, \c B_OK on success or an error code. 2708 \retval B_OK The object now contains the requested data. 2709 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2710 2711 \since BeOS R3 2712*/ 2713 2714 2715/*! 2716 \fn status_t BMessage::ReplaceRect(const char* name, int32 index, 2717 BRect aRect) 2718 \brief Replace a rectangle at the label \a name at a specified 2719 \a index. 2720 2721 The data at the specified \a name and \a index will be replaced, if it 2722 matches the \c B_RECT_TYPE. 2723 2724 \param name The name associated with the data to replace. 2725 \param index The index in the array to replace. 2726 \param aRect The object to store in the message. 2727 2728 \returns A status code, \c B_OK on success or an error code. 2729 \retval B_OK The operation succeeded. 2730 \retval B_BAD_INDEX The index was out of range. 2731 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2732 2733 \see ReplaceRect(const char*, BRect) 2734 2735 \since BeOS R3 2736*/ 2737 2738 2739/*! 2740 \fn status_t BMessage::ReplacePoint(const char* name, BPoint aPoint) 2741 \brief Replace a point at the label \a name. 2742 2743 This method is an overloaded method of 2744 ReplacePoint(const char*, int32, BPoint). 2745 It replaces the data at \a index \c 0. 2746 2747 \param name The name associated with the data to replace. 2748 \param aPoint The object to store in the message. 2749 2750 \returns A status code, \c B_OK on success or an error code. 2751 \retval B_OK The object now contains the requested data. 2752 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2753 2754 \since BeOS R3 2755*/ 2756 2757 2758/*! 2759 \fn status_t BMessage::ReplacePoint(const char* name, int32 index, 2760 BPoint aPoint) 2761 \brief Replace a point at the label \a name at a specified 2762 \a index. 2763 2764 The data at the specified \a name and \a index will be replaced, if it 2765 matches the \c B_POINT_TYPE. 2766 2767 \param name The name associated with the data to replace. 2768 \param index The index in the array to replace. 2769 \param aPoint The object to store in the message. 2770 2771 \returns A status code, \c B_OK on success or an error code. 2772 \retval B_OK The operation succeeded. 2773 \retval B_BAD_INDEX The index was out of range. 2774 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2775 2776 \see ReplacePoint(const char*, BPoint) 2777 2778 \since BeOS R3 2779*/ 2780 2781 2782/*! 2783 \fn status_t BMessage::ReplaceSize(const char* name, BSize aSize) 2784 \brief Replace a size at the label \a name. 2785 2786 This method is an overloaded method of 2787 ReplaceSize(const char*, int32, BSize). 2788 It replaces the data at \a index \c 0. 2789 2790 \param name The name associated with the data to replace. 2791 \param aSize The object to store in the message. 2792 2793 \returns A status code, \c B_OK on success or an error code. 2794 \retval B_OK The object now contains the requested data. 2795 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2796 2797 \since Haiku R1 2798*/ 2799 2800 2801/*! 2802 \fn status_t BMessage::ReplaceSize(const char* name, int32 index, 2803 BSize aSize) 2804 \brief Replace a size at the label \a name at a specified 2805 \a index. 2806 2807 The data at the specified \a name and \a index will be replaced, if it 2808 matches the \c B_SIZE_TYPE. 2809 2810 \param name The name associated with the data to replace. 2811 \param index The index in the array to replace. 2812 \param aSize The object to store in the message. 2813 2814 \returns A status code, \c B_OK on success or an error code. 2815 \retval B_OK The operation succeeded. 2816 \retval B_BAD_INDEX The index was out of range. 2817 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2818 2819 \see ReplaceSize(const char*, BSize) 2820 2821 \since Haiku R1 2822*/ 2823 2824 2825/*! 2826 \fn status_t BMessage::ReplaceString(const char* name, const char* aString) 2827 \brief Replace a string at the label \a name. 2828 2829 This method is an overloaded method of 2830 ReplaceString(const char*, int32, const char*). 2831 It replaces the data at \a index \c 0. 2832 2833 \param name The name associated with the data to replace. 2834 \param aString The object to store in the message. 2835 2836 \returns A status code, \c B_OK on success or an error code. 2837 \retval B_OK The operation succeeded. 2838 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2839 2840 \since BeOS R3 2841*/ 2842 2843 2844/*! 2845 \fn status_t BMessage::ReplaceString(const char* name, int32 index, 2846 const char* aString) 2847 \brief Replace a string at the label \a name at a specified 2848 \a index. 2849 2850 The data at the specified \a name and \a index will be 2851 replaced, if it matches the \c B_STRING_TYPE. 2852 2853 \param name The name associated with the data to replace. 2854 \param index The index in the array to replace. 2855 \param aString The object to store in the message. 2856 2857 \returns A status code, \c B_OK on success or an error code. 2858 \retval B_OK The operation succeeded. 2859 \retval B_BAD_INDEX The index was out of range. 2860 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2861 2862 \see ReplaceString(const char*, const char*) 2863 2864 \since BeOS R3 2865*/ 2866 2867 2868/*! 2869 \fn status_t BMessage::ReplaceString(const char* name, 2870 const BString& aString) 2871 \brief Replace a string at the label \a name. 2872 2873 This method is an overloaded method of 2874 ReplaceString(const char*, int32, BString&). 2875 It replaces the data at \a index \c 0. 2876 2877 \param name The name associated with the data to replace. 2878 \param aString The object to store in the message. 2879 2880 \returns A status code, \c B_OK on success or an error code. 2881 \retval B_OK The operation succeeded. 2882 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2883 2884 \since BeOS R5 2885*/ 2886 2887 2888/*! 2889 \fn status_t BMessage::ReplaceString(const char* name, int32 index, 2890 const BString& aString) 2891 \brief Replace a string at the label \a name at a specified 2892 \a index. 2893 2894 The data at the specified \a name and \a index will be replaced, if it 2895 matches the \c B_STRING_TYPE. 2896 2897 \param name The name associated with the data to replace. 2898 \param index The index in the array to replace. 2899 \param aString The object to store in the message. 2900 2901 \returns A status code, \c B_OK on success or an error code. 2902 \retval B_OK The operation succeeded. 2903 \retval B_BAD_INDEX The index was out of range. 2904 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2905 2906 \see ReplaceString(const char*, BString&) 2907 2908 \since BeOS R5 2909*/ 2910 2911 2912/*! 2913 \fn status_t BMessage::ReplaceInt8(const char* name, int8 value) 2914 \brief Replace an integer at the label \a name. 2915 2916 This method is an overloaded method of 2917 ReplaceInt8(const char*, int32, int8). 2918 It replaces the data at \a index \c 0. 2919 2920 \param name The name associated with the data to replace. 2921 \param value Where to store in the message. 2922 2923 \returns A status code, \c B_OK on success or an error code. 2924 \retval B_OK The operation succeeded. 2925 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2926 2927 \since BeOS R3 2928*/ 2929 2930 2931/*! 2932 \fn status_t BMessage::ReplaceInt8(const char* name, int32 index, 2933 int8 value) 2934 \brief Replace an integer at the label \a name at a specified 2935 \a index. 2936 2937 The data at the specified \a name and \a index will be replaced, if it 2938 matches the \c B_INT8_TYPE. 2939 2940 \param name The name associated with the data to replace. 2941 \param index The index in the array to replace. 2942 \param value Where to store in the message. 2943 2944 \returns A status code, \c B_OK on success or an error code. 2945 \retval B_OK The operation succeeded. 2946 \retval B_BAD_INDEX The index was out of range. 2947 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2948 2949 \see ReplaceInt8(const char*, int8) 2950 2951 \since BeOS R3 2952*/ 2953 2954 2955/*! 2956 \fn status_t BMessage::ReplaceUInt8(const char* name, uint8 value) 2957 \brief Replace an integer at the label \a name. 2958 2959 This method is an overloaded method of 2960 ReplaceUInt8(const char*, int32, uint8). 2961 It replaces the data at \a index \c 0. 2962 2963 \param name The name associated with the data to replace. 2964 \param value Where to store in the message. 2965 2966 \returns A status code, \c B_OK on success or an error code. 2967 \retval B_OK The operation succeeded. 2968 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2969 2970 \since BeOS R3 2971*/ 2972 2973 2974/*! 2975 \fn status_t BMessage::ReplaceUInt8(const char* name, int32 index, 2976 uint8 value) 2977 \brief Replace an integer at the label \a name at a specified 2978 \a index. 2979 2980 The data at the specified \a name and \a index will be replaced, if it 2981 matches the \c B_UINT8_TYPE. 2982 2983 \param name The name associated with the data to replace. 2984 \param index The index in the array to replace. 2985 \param value Where to store in the message. 2986 2987 \returns A status code, \c B_OK on success or an error code. 2988 \retval B_OK The operation succeeded. 2989 \retval B_BAD_INDEX The index was out of range. 2990 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2991 2992 \see ReplaceUInt8(const char*, uint8) 2993 2994 \since BeOS R3 2995*/ 2996 2997 2998/*! 2999 \fn status_t BMessage::ReplaceInt16(const char* name, int16 value) 3000 \brief Replace an integer at the label \a name. 3001 3002 This method is an overloaded method of 3003 ReplaceInt16(const char*, int32, int16). 3004 It replaces the data at \a index \c 0. 3005 3006 \param name The name associated with the data to replace. 3007 \param value Where to store in the message. 3008 3009 \returns A status code, \c B_OK on success or an error code. 3010 \retval B_OK The operation succeeded. 3011 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3012 3013 \since BeOS R3 3014*/ 3015 3016 3017/*! 3018 \fn status_t BMessage::ReplaceInt16(const char* name, int32 index, 3019 int16 value) 3020 \brief Replace an integer at the label \a name at a specified 3021 \a index. 3022 3023 The data at the specified \a name and \a index will be replaced, if it 3024 matches the \c B_INT16_TYPE. 3025 3026 \param name The name associated with the data to replace. 3027 \param index The index in the array to replace. 3028 \param value Where to store in the message. 3029 3030 \returns A status code, \c B_OK on success or an error code. 3031 \retval B_OK The operation succeeded. 3032 \retval B_BAD_INDEX The index was out of range. 3033 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3034 3035 \see ReplaceInt16(const char*, int16) 3036 3037 \since BeOS R3 3038*/ 3039 3040 3041/*! 3042 \fn status_t BMessage::ReplaceUInt16(const char* name, uint16 value) 3043 \brief Replace an integer at the label \a name. 3044 3045 This method is an overloaded method of 3046 ReplaceUInt16(const char*, int32, uint16). 3047 It replaces the data at \a index \c 0. 3048 3049 \param name The name associated with the data to replace. 3050 \param value Where to store in the message. 3051 3052 \returns A status code, \c B_OK on success or an error code. 3053 \retval B_OK The operation succeeded. 3054 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3055 3056 \since BeOS R3 3057*/ 3058 3059 3060/*! 3061 \fn status_t BMessage::ReplaceUInt16(const char* name, int32 index, 3062 uint16 value) 3063 \brief Replace an integer at the label \a name at a specified 3064 \a index. 3065 3066 The data at the specified \a name and \a index will be replaced, if it 3067 matches the \c B_UINT16_TYPE. 3068 3069 \param name The name associated with the data to replace. 3070 \param index The index in the array to replace. 3071 \param value Where to store in the message. 3072 3073 \returns A status code, \c B_OK on success or an error code. 3074 \retval B_OK The operation succeeded. 3075 \retval B_BAD_INDEX The index was out of range. 3076 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3077 3078 \see ReplaceUInt16(const char*, uint16) 3079 3080 \since BeOS R3 3081*/ 3082 3083 3084/*! 3085 \fn status_t BMessage::ReplaceInt32(const char* name, int32 value) 3086 \brief Replace an integer at the label \a name. 3087 3088 This method is an overloaded method of 3089 ReplaceInt32(const char*, int32, int32). 3090 It replaces the data at \a index \c 0. 3091 3092 \param name The name associated with the data to replace. 3093 \param value Where to store in the message. 3094 3095 \returns A status code, \c B_OK on success or an error code. 3096 \retval B_OK The operation succeeded. 3097 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3098 3099 \since BeOS R3 3100*/ 3101 3102 3103/*! 3104 \fn status_t BMessage::ReplaceInt32(const char* name, int32 index, 3105 int32 value) 3106 \brief Replace an integer at the label \a name at a specified 3107 \a index. 3108 3109 The data at the specified \a name and \a index will be replaced, if it 3110 matches the \c B_INT32_TYPE. 3111 3112 \param name The name associated with the data to replace. 3113 \param index The index in the array to replace. 3114 \param value The object to store in the message. 3115 3116 \returns A status code, \c B_OK on success or an error code. 3117 \retval B_OK The operation succeeded. 3118 \retval B_BAD_INDEX The index was out of range. 3119 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3120 3121 \see ReplaceInt32(const char*, int32) 3122 3123 \since BeOS R3 3124*/ 3125 3126 3127/*! 3128 \fn status_t BMessage::ReplaceUInt32(const char* name, uint32 value) 3129 \brief Replace an integer at the label \a name. 3130 3131 This method is an overloaded method of 3132 ReplaceUInt32(const char*, int32, uint32). 3133 It replaces the data at \a index \c 0. 3134 3135 \param name The name associated with the data to replace. 3136 \param value Where to store in the message. 3137 3138 \returns A status code, \c B_OK on success or an error code. 3139 \retval B_OK The operation succeeded. 3140 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3141 3142 \since BeOS R3 3143*/ 3144 3145 3146/*! 3147 \fn status_t BMessage::ReplaceUInt32(const char* name, int32 index, 3148 uint32 value) 3149 \brief Replace an integer at the label \a name at a specified 3150 \a index. 3151 3152 The data at the specified \a name and \a index will be replaced, if it 3153 matches the \c B_UINT32_TYPE. 3154 3155 \param name The name associated with the data to replace. 3156 \param index The index in the array to replace. 3157 \param value The object to store in the message. 3158 3159 \returns A status code, \c B_OK on success or an error code. 3160 \retval B_OK The operation succeeded. 3161 \retval B_BAD_INDEX The index was out of range. 3162 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3163 3164 \see ReplaceUInt32(const char*, uint32) 3165 3166 \since BeOS R3 3167*/ 3168 3169 3170/*! 3171 \fn status_t BMessage::ReplaceInt64(const char* name, int64 value) 3172 \brief Replace an integer at the label \a name. 3173 3174 This method is an overloaded method of 3175 ReplaceInt64(const char*, int32, int64). 3176 It replaces the data at \a index \c 0. 3177 3178 \param name The name associated with the data to replace. 3179 \param value Where to store in the message. 3180 3181 \returns A status code, \c B_OK on success or an error code. 3182 \retval B_OK The operation succeeded. 3183 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3184 3185 \since BeOS R3 3186*/ 3187 3188 3189/*! 3190 \fn status_t BMessage::ReplaceInt64(const char* name, int32 index, 3191 int64 value) 3192 \brief Replace an integer at the label \a name at a specified 3193 \a index. 3194 3195 The data at the specified \a name and \a index will be replaced, if it 3196 matches the \c B_INT64_TYPE. 3197 3198 \param name The name associated with the data to replace. 3199 \param index The index in the array to replace. 3200 \param value The object to store in the message. 3201 3202 \returns A status code, \c B_OK on success or an error code. 3203 \retval B_OK The operation succeeded. 3204 \retval B_BAD_INDEX The index was out of range. 3205 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3206 3207 \see ReplaceInt64(const char*, int64) 3208 3209 \since BeOS R3 3210*/ 3211 3212 3213/*! 3214 \fn status_t BMessage::ReplaceUInt64(const char* name, uint64 value) 3215 \brief Replace an integer at the label \a name. 3216 3217 This method is an overloaded method of 3218 ReplaceUInt64(const char*, int32, uint64). 3219 It replaces the data at \a index \c 0. 3220 3221 \param name The name associated with the data to replace. 3222 \param value Where to store in the message. 3223 3224 \returns A status code, \c B_OK on success or an error code. 3225 \retval B_OK The operation succeeded. 3226 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3227 3228 \since BeOS R3 3229*/ 3230 3231 3232/*! 3233 \fn status_t BMessage::ReplaceUInt64(const char* name, int32 index, 3234 uint64 value) 3235 \brief Replace an integer at the label \a name at a specified 3236 \a index. 3237 3238 The data at the specified \a name and \a index will be replaced, if it 3239 matches the \c B_UINT64_TYPE. 3240 3241 \param name The name associated with the data to replace. 3242 \param index The index in the array to replace. 3243 \param value The object to store in the message. 3244 3245 \returns A status code, \c B_OK on success or an error code. 3246 \retval B_OK The operation succeeded. 3247 \retval B_BAD_INDEX The index was out of range. 3248 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3249 3250 \see ReplaceUInt64(const char*, uint64) 3251 3252 \since BeOS R3 3253*/ 3254 3255 3256/*! 3257 \fn status_t BMessage::ReplaceBool(const char* name, bool aBoolean) 3258 \brief Replace a boolean at the label \a name. 3259 3260 This method is an overloaded method of 3261 ReplaceBool(const char*, int32, bool). 3262 It replaces the data at \a index \c 0. 3263 3264 \param name The name associated with the data to replace. 3265 \param aBoolean Where to store in the message. 3266 3267 \returns A status code, \c B_OK on success or an error code. 3268 \retval B_OK The operation succeeded. 3269 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3270 3271 \since BeOS R3 3272*/ 3273 3274 3275/*! 3276 \fn status_t BMessage::ReplaceBool(const char* name, int32 index, 3277 bool aBoolean) 3278 \brief Replace a boolean at the label \a name at a specified 3279 \a index. 3280 3281 The data at the specified \a name and \a index will be replaced, if it 3282 matches the \c B_BOOL_TYPE. 3283 3284 \param name The name associated with the data to replace. 3285 \param index The index in the array to replace. 3286 \param aBoolean Where to store in the message. 3287 3288 \returns A status code, \c B_OK on success or an error code. 3289 \retval B_OK The operation succeeded. 3290 \retval B_BAD_INDEX The index was out of range. 3291 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3292 3293 \see ReplaceBool(const char*, bool) 3294 3295 \since BeOS R5 3296*/ 3297 3298 3299/*! 3300 \fn status_t BMessage::ReplaceFloat(const char* name, float aFloat) 3301 \brief Replace a float at the label \a name. 3302 3303 This method is an overloaded method of 3304 ReplaceFloat(const char*, int32, float). 3305 It replaces the data at \a index \c 0. 3306 3307 \param name The name associated with the data to replace. 3308 \param aFloat The object to store in the message. 3309 3310 \returns A status code, \c B_OK on success or an error code. 3311 \retval B_OK The operation succeeded. 3312 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3313 3314 \since BeOS R3 3315*/ 3316 3317 3318/*! 3319 \fn status_t BMessage::ReplaceFloat(const char* name, int32 index, 3320 float aFloat) 3321 \brief Replace a float at the label \a name at a specified 3322 \a index. 3323 3324 The data at the specified \a name and \a index will be replaced, if it 3325 matches the \c B_FLOAT_TYPE. 3326 3327 \param name The name associated with the data to replace. 3328 \param index The index in the array to replace. 3329 \param aFloat The object to store in the message. 3330 3331 \returns A status code, \c B_OK on success or an error code. 3332 \retval B_OK The operation succeeded. 3333 \retval B_BAD_INDEX The index was out of range. 3334 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3335 3336 \see ReplaceFloat(const char*, float) 3337 3338 \since BeOS R3 3339*/ 3340 3341 3342/*! 3343 \fn status_t BMessage::ReplaceDouble(const char* name, double aDouble) 3344 \brief Replace a double at the label \a name. 3345 3346 This method is an overloaded method of 3347 ReplaceDouble(const char*, int32, double). 3348 It replaces the data at \a index \c 0. 3349 3350 \param name The name associated with the data to replace. 3351 \param aDouble Where to store in the message. 3352 3353 \returns A status code, \c B_OK on success or an error code. 3354 \retval B_OK The operation succeeded. 3355 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3356 3357 \since BeOS R3 3358*/ 3359 3360 3361/*! 3362 \fn status_t BMessage::ReplaceDouble(const char* name, int32 index, 3363 double aDouble) 3364 \brief Replace a double at the label \a name at a specified 3365 \a index. 3366 3367 The data at the specified \a name and \a index will be replaced, if it 3368 matches the \c B_DOUBLE_TYPE. 3369 3370 \param name The name associated with the data to replace. 3371 \param index The index in the array to replace. 3372 \param aDouble Where to store in the message. 3373 3374 \returns A status code, \c B_OK on success or an error code. 3375 \retval B_OK The operation succeeded. 3376 \retval B_BAD_INDEX The index was out of range. 3377 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3378 3379 \see ReplaceDouble(const char*, double) 3380 3381 \since BeOS R3 3382*/ 3383 3384 3385/*! 3386 \fn status_t BMessage::ReplaceColor(const char* name, rgb_color aColor) 3387 \brief Replace a color at the label \a name. 3388 3389 This method is an overloaded method of 3390 ReplaceColor(const char*, int32, rgb_color). 3391 It replaces the data at \a index \c 0. 3392 3393 \param name The name associated with the data to replace. 3394 \param aColor Where to store in the message. 3395 3396 \returns A status code, \c B_OK on success or an error code. 3397 \retval B_OK The operation succeeded. 3398 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3399 3400 \since Haiku R1 3401*/ 3402 3403 3404/*! 3405 \fn status_t BMessage::ReplaceColor(const char* name, int32 index, 3406 rgb_color aColor) 3407 \brief Replace a rgb_color at the label \a name at a specified 3408 \a index. 3409 3410 The data at the specified \a name and \a index will be replaced, if it 3411 matches the \c B_RGB_32_BIT_TYPE. 3412 3413 \param name The name associated with the data to replace. 3414 \param index The index in the array to replace. 3415 \param aColor Where to store in the message. 3416 3417 \returns A status code, \c B_OK on success or an error code. 3418 \retval B_OK The operation succeeded. 3419 \retval B_BAD_INDEX The index was out of range. 3420 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3421 3422 \see ReplaceColor(const char*, rgb_color) 3423 3424 \since Haiku R1 3425*/ 3426 3427 3428/*! 3429 \fn status_t BMessage::ReplacePointer(const char* name, 3430 const void* pointer) 3431 \brief Replace a pointer at the label \a name. 3432 3433 This method is an overloaded method of 3434 ReplacePointer(const char*, int32, const void*). 3435 It replaces the data at \a index \c 0. 3436 3437 \param name The name associated with the data to replace. 3438 \param pointer Where to store in the message. 3439 3440 \returns A status code, \c B_OK on success or an error code. 3441 \retval B_OK The operation succeeded. 3442 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3443 3444 \since BeOS R3 3445*/ 3446 3447 3448/*! 3449 \fn status_t BMessage::ReplacePointer(const char* name, int32 index, 3450 const void* pointer) 3451 \brief Replace a pointer at the label \a name at a specified \a index. 3452 3453 The data at the specified \a name and \a index will be replaced, if it 3454 matches the \c B_POINTER_TYPE. 3455 3456 \param name The name associated with the data to replace. 3457 \param index The index in the array to replace. 3458 \param pointer Where to store in the message. 3459 3460 \returns A status code, \c B_OK on success or an error code. 3461 \retval B_OK The operation succeeded. 3462 \retval B_BAD_INDEX The index was out of range. 3463 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3464 3465 \see ReplacePointer(const char*, const void*) 3466 3467 \since BeOS R3 3468*/ 3469 3470 3471/*! 3472 \fn status_t BMessage::ReplaceMessenger(const char* name, 3473 BMessenger messenger) 3474 \brief Replace a messenger at the label \a name. 3475 3476 This method is an overloaded method of 3477 ReplaceMessenger(const char*, int32, BMessenger). 3478 It replaces the data at \a index \c 0. 3479 3480 \param name The name associated with the data to replace. 3481 \param messenger The object to store in the message. 3482 3483 \returns A status code, \c B_OK on success or an error code. 3484 \retval B_OK The operation succeeded. 3485 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3486 3487 \since BeOS R3 3488*/ 3489 3490 3491/*! 3492 \fn status_t BMessage::ReplaceMessenger(const char* name, int32 index, 3493 BMessenger messenger) 3494 \brief Replace a messenger at the label \a name at a specified 3495 \a index. 3496 3497 The data at the specified \a name and \a index will be replaced, if it 3498 matches the \c B_MESSENGER_TYPE. 3499 3500 \param name The name associated with the data to replace. 3501 \param index The index in the array to replace. 3502 \param messenger The object to store in the message. 3503 3504 \returns A status code, \c B_OK on success or an error code. 3505 \retval B_OK The operation succeeded. 3506 \retval B_BAD_INDEX The index was out of range. 3507 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3508 3509 \see ReplaceMessenger(const char*, BMessenger) 3510 3511 \since BeOS R3 3512*/ 3513 3514 3515/*! 3516 \fn status_t BMessage::ReplaceRef(const char* name, const entry_ref* ref) 3517 \brief Replace a reference to a file at the label \a name. 3518 3519 This method is an overloaded method of 3520 ReplaceRef(const char*, int32, entry_ref*). 3521 It replaces the data at \a index \c 0. 3522 3523 \param name The name associated with the data to replace. 3524 \param ref The object to store in the message. 3525 3526 \returns A status code, \c B_OK on success or an error code. 3527 \retval B_OK The operation succeeded. 3528 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3529 3530 \since BeOS R3 3531*/ 3532 3533 3534/*! 3535 \fn status_t BMessage::ReplaceRef(const char* name, int32 index, 3536 const entry_ref* ref) 3537 \brief Replace a reference to a file at the label \a name at a 3538 specified \a index. 3539 3540 The data at the specified \a name and \a index will be replaced, if it 3541 matches the \c B_REF_TYPE. 3542 3543 \param name The name associated with the data to replace. 3544 \param index The index in the array to replace. 3545 \param ref The object to store in the message. 3546 3547 \returns A status code, \c B_OK on success or an error code. 3548 \retval B_OK The operation succeeded. 3549 \retval B_BAD_INDEX The index was out of range. 3550 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3551 3552 \see ReplaceRef(const char*, entry_ref*) 3553 3554 \since BeOS R3 3555*/ 3556 3557 3558/*! 3559 \fn status_t BMessage::ReplaceNodeRef(const char* name, 3560 const node_ref* ref) 3561 \brief Replace a reference to a node at the label \a name. 3562 3563 This method is an overloaded method of 3564 ReplaceNodeRef(const char*, int32, node_ref*). 3565 It replaces the data at \a index \c 0. 3566 3567 \param name The name associated with the data to replace. 3568 \param ref The object to store in the message. 3569 3570 \returns A status code, \c B_OK on success or an error code. 3571 \retval B_OK The operation succeeded. 3572 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3573 3574 \since Haiku R1 3575*/ 3576 3577 3578/*! 3579 \fn status_t BMessage::ReplaceNodeRef(const char* name, int32 index, 3580 const node_ref* ref) 3581 \brief Replace a reference to a node at the label \a name at a 3582 specified \a index. 3583 3584 The data at the specified \a name and \a index will be replaced, if it 3585 matches the \c B_NODE_REF_TYPE. 3586 3587 \param name The name associated with the data to replace. 3588 \param index The index in the array to replace. 3589 \param ref The object to store in the message. 3590 3591 \returns A status code, \c B_OK on success or an error code. 3592 \retval B_OK The operation succeeded. 3593 \retval B_BAD_INDEX The index was out of range. 3594 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3595 3596 \see ReplaceNodeRef(const char*, node_ref*) 3597 3598 \since Haiku R1 3599*/ 3600 3601 3602/*! 3603 \fn status_t BMessage::ReplaceMessage(const char* name, 3604 const BMessage* message) 3605 \brief Replace a message at the label \a name. 3606 3607 This method is an overloaded method of 3608 ReplaceMessage(const char*, int32, BMessage*). 3609 It replaces the data at \a index \c 0. 3610 3611 \param name The name associated with the data to replace. 3612 \param message The object to store in the message. 3613 3614 \returns A status code, \c B_OK on success or an error code. 3615 \retval B_OK The operation succeeded. 3616 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3617 3618 \since BeOS R3 3619*/ 3620 3621 3622/*! 3623 \fn status_t BMessage::ReplaceMessage(const char* name, int32 index, 3624 const BMessage* message) 3625 \brief Replace a message at the label \a name at a specified 3626 \a index. 3627 3628 The data at the specified \a name and \a index will be replaced, if it 3629 matches the \c B_MESSAGE_TYPE. 3630 3631 \param name The name associated with the data to replace. 3632 \param index The index in the array to replace. 3633 \param message The object to store in the message. 3634 3635 \returns A status code, \c B_OK on success or an error code. 3636 \retval B_OK The operation succeeded. 3637 \retval B_BAD_INDEX The index was out of range. 3638 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3639 3640 \see ReplaceMessage(const char*, BMessage*) 3641 3642 \since BeOS R3 3643*/ 3644 3645 3646/*! 3647 \fn status_t BMessage::ReplaceFlat(const char* name, BFlattenable* object) 3648 \brief Replace a flattened object at the label \a name. 3649 3650 This method is an overloaded method of 3651 ReplaceFlat(const char*, int32, BFlattenable*). 3652 3653 It replaces the data at \a index \c 0. 3654 3655 \param name The name associated with the data to replace. 3656 \param object The object to store in the message. 3657 3658 \returns A status code, \c B_OK on success or an error code. 3659 \retval B_OK The operation succeeded. 3660 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3661 3662 \since BeOS R3 3663*/ 3664 3665 3666/*! 3667 \fn status_t BMessage::ReplaceFlat(const char* name, int32 index, 3668 BFlattenable* object) 3669 \brief Replace a flattened object at the label \a name at a 3670 specified \a index. 3671 3672 The data at the specified \a name and \a index will be 3673 replaced, if it matches the type returned by your object. This method uses 3674 BFlattenable::TypeCode() to determine the type of the object. 3675 3676 \param name The name associated with the data to replace. 3677 \param index The index in the array to replace. 3678 \param object The object to store in the message. 3679 3680 \returns A status code, \c B_OK on success or an error code. 3681 \retval B_OK The operation succeeded. 3682 \retval B_BAD_INDEX The index was out of range. 3683 \retval B_NAME_NOT_FOUND There is no field with this \a name. 3684 3685 \see ReplaceFlat(const char*, BFlattenable*) 3686 3687 \since BeOS R3 3688*/ 3689 3690 3691//! @} 3692 3693 3694/*! 3695 \name Message comparison 3696*/ 3697 3698 3699//! @{ 3700 3701 3702/*! 3703 \fn bool BMessage::HasSameData(const BMessage& other, 3704 bool ignoreFieldOrder = true, bool deep = false) const 3705 \brief Experimental method to compare two messages 3706 3707 This helper method will compare the data of this message to another 3708 message. The name if the fields, and the contents of the fields are 3709 compared. Metadata (like the delivery status) and the BMessage::what 3710 field are not compared. 3711 3712 The order of the fields is determined by the order that the fields are 3713 added. You may use the \a ignoreFieldOrder argument to tweak whether you 3714 care that not only the data is identical, but also the ordering of the 3715 data. 3716 3717 When there are BMessages attached to this message, you might want to use 3718 this algorithm to compare them as well (as to ignore non-data fields of the 3719 \a other message or the ordering of fields during the comparison). Setting 3720 the \a deep parameter will cause any data of the \c B_MESSAGE_TYPE to be 3721 compared using this method, thus ignoring non-data differences. If you set 3722 \a deep to \c false, the data will be compared on a byte by byte basis and 3723 these differences in the non-data fields will not be ignored. 3724 3725 \param other The other message to compare to. 3726 \param ignoreFieldOrder Whether you want to see if the field order is the 3727 same. 3728 \param deep Whether you want to recursively inspect BMessages embedded in 3729 this message. 3730 3731 \returns \c true if the data is the same, \c false otherwise 3732 3733 \since Haiku R1 3734*/ 3735 3736 3737//! @} 3738 3739 3740/*! 3741 \name Deprecated Methods 3742 3743 These methods are likely to disappear as they have been replaced by safer 3744 and more powerful methods but are implemented for the purpose of binary 3745 compatibility. 3746*/ 3747 3748 3749//! @{ 3750 3751 3752/*! 3753 \fn bool BMessage::HasAlignment(const char*, int32) const 3754 \brief Deprecated. 3755 3756 \warning This method is deprecated, do not use. 3757 3758 \since Haiku R1 3759*/ 3760 3761 3762/*! 3763 \fn bool BMessage::HasRect(const char*, int32) const 3764 \brief Deprecated. 3765 3766 \warning This method is deprecated, do not use. 3767 3768 \since BeOS R3 3769*/ 3770 3771 3772/*! 3773 \fn bool BMessage::HasPoint(const char*, int32) const 3774 \brief Deprecated. 3775 3776 \warning This method is deprecated, do not use. 3777 3778 \since BeOS R3 3779*/ 3780 3781 3782/*! 3783 \fn bool BMessage::HasSize(const char*, int32) const 3784 \brief Deprecated. 3785 3786 \warning This method is deprecated, do not use. 3787 3788 \since Haiku R1 3789*/ 3790 3791 3792/*! 3793 \fn bool BMessage::HasString(const char*, int32) const 3794 \brief Deprecated. 3795 3796 \warning This method is deprecated, do not use. 3797 3798 \since BeOS R3 3799*/ 3800 3801 3802/*! 3803 \fn bool BMessage::HasInt8(const char*, int32) const 3804 \brief Deprecated. 3805 3806 \warning This method is deprecated, do not use. 3807 3808 \since BeOS R3 3809*/ 3810 3811 3812/*! 3813 \fn bool BMessage::HasUInt8(const char*, int32) const 3814 \brief Deprecated. 3815 3816 \warning This method is deprecated, do not use. 3817 3818 \since BeOS R3 3819*/ 3820 3821 3822/*! 3823 \fn bool BMessage::HasInt16(const char*, int32) const 3824 \brief Deprecated. 3825 3826 \warning This method is deprecated, do not use. 3827 3828 \since BeOS R3 3829*/ 3830 3831 3832/*! 3833 \fn bool BMessage::HasUInt16(const char*, int32) const 3834 \brief Deprecated. 3835 3836 \warning This method is deprecated, do not use. 3837 3838 \since BeOS R3 3839*/ 3840 3841 3842/*! 3843 \fn bool BMessage::HasInt32(const char*, int32) const 3844 \brief Deprecated. 3845 3846 \warning This method is deprecated, do not use. 3847 3848 \since BeOS R3 3849*/ 3850 3851 3852/*! 3853 \fn bool BMessage::HasUInt32(const char*, int32) const 3854 \brief Deprecated. 3855 3856 \warning This method is deprecated, do not use. 3857 3858 \since BeOS R3 3859*/ 3860 3861 3862/*! 3863 \fn bool BMessage::HasInt64(const char*, int32) const 3864 \brief Deprecated. 3865 3866 \warning This method is deprecated, do not use. 3867 3868 \since BeOS R3 3869*/ 3870 3871 3872/*! 3873 \fn bool BMessage::HasUInt64(const char*, int32) const 3874 \brief Deprecated. 3875 3876 \warning This method is deprecated, do not use. 3877 3878 \since BeOS R3 3879*/ 3880 3881 3882/*! 3883 \fn bool BMessage::HasBool(const char*, int32) const 3884 \brief Deprecated. 3885 3886 \warning This method is deprecated, do not use. 3887 3888 \since BeOS R3 3889*/ 3890 3891 3892/*! 3893 \fn bool BMessage::HasFloat(const char*, int32) const 3894 \brief Deprecated. 3895 3896 \warning This method is deprecated, do not use. 3897 3898 \since BeOS R3 3899*/ 3900 3901 3902/*! 3903 \fn bool BMessage::HasDouble(const char*, int32) const 3904 \brief Deprecated. 3905 3906 \warning This method is deprecated, do not use. 3907 3908 \since BeOS R3 3909*/ 3910 3911 3912/*! 3913 \fn bool BMessage::HasColor(const char*, int32) const 3914 \brief Deprecated. 3915 3916 \warning This method is deprecated, do not use. 3917 3918 \since Haiku R1 3919*/ 3920 3921 3922/*! 3923 \fn bool BMessage::HasPointer(const char*, int32) const 3924 \brief Deprecated. 3925 3926 \warning This method is deprecated, do not use. 3927 3928 \since BeOS R3 3929*/ 3930 3931 3932/*! 3933 \fn bool BMessage::HasMessenger(const char*, int32) const 3934 \brief Deprecated. 3935 3936 \warning This method is deprecated, do not use. 3937 3938 \since BeOS R3 3939*/ 3940 3941 3942/*! 3943 \fn bool BMessage::HasRef(const char*, int32) const 3944 \brief Deprecated. 3945 3946 \warning This method is deprecated, do not use. 3947 3948 \since BeOS R3 3949*/ 3950 3951 3952/*! 3953 \fn bool BMessage::HasNodeRef(const char*, int32) const 3954 \brief Deprecated. 3955 3956 \warning This method is deprecated, do not use. 3957 3958 \since Haiku R1. 3959*/ 3960 3961 3962/*! 3963 \fn bool BMessage::HasMessage(const char*, int32) const 3964 \brief Deprecated. 3965 3966 \warning This method is deprecated, do not use. 3967 3968 \since BeOS R3 3969*/ 3970 3971 3972/*! 3973 \fn bool BMessage::HasFlat(const char*, const BFlattenable*) const 3974 \brief Deprecated. 3975 3976 \warning This method is deprecated, do not use. 3977 3978 \since BeOS R3 3979*/ 3980 3981 3982/*! 3983 \fn bool BMessage::HasFlat(const char*, int32, const BFlattenable*) const 3984 \brief Deprecated. 3985 3986 \warning This method is deprecated, do not use. 3987 3988 \since BeOS R3 3989*/ 3990 3991 3992/*! 3993 \fn bool BMessage::HasData(const char*, type_code, int32) const 3994 \brief Deprecated. 3995 3996 \warning This method is deprecated, do not use. 3997 3998 \since BeOS R3 3999*/ 4000 4001 4002/*! 4003 \fn BRect BMessage::FindRect(const char*, int32) const 4004 \brief Deprecated. 4005 4006 \warning This method is deprecated, do not use. 4007 4008 \since BeOS R3 4009*/ 4010 4011 4012/*! 4013 \fn BPoint BMessage::FindPoint(const char*, int32) const 4014 \brief Deprecated. 4015 4016 \warning This method is deprecated, do not use. 4017 4018 \since BeOS R3 4019*/ 4020 4021 4022/*! 4023 \fn const char* BMessage::FindString(const char*, int32) const 4024 \brief Deprecated. 4025 4026 \warning This method is deprecated, do not use. 4027 4028 \since BeOS R3 4029*/ 4030 4031 4032/*! 4033 \fn int8 BMessage::FindInt8(const char*, int32) const 4034 \brief Deprecated. 4035 4036 \warning This method is deprecated, do not use. 4037 4038 \since BeOS R3 4039*/ 4040 4041 4042/*! 4043 \fn int16 BMessage::FindInt16(const char*, int32) const 4044 \brief Deprecated. 4045 4046 \warning This method is deprecated, do not use. 4047 4048 \since BeOS R3 4049*/ 4050 4051 4052/*! 4053 \fn int32 BMessage::FindInt32(const char*, int32) const 4054 \brief Deprecated. 4055 4056 \warning This method is deprecated, do not use. 4057 4058 \since BeOS R3 4059*/ 4060 4061 4062/*! 4063 \fn int64 BMessage::FindInt64(const char*, int32) const 4064 \brief Deprecated. 4065 4066 \warning This method is deprecated, do not use. 4067 4068 \since BeOS R3 4069*/ 4070 4071 4072/*! 4073 \fn bool BMessage::FindBool(const char*, int32) const 4074 \brief Deprecated. 4075 4076 \warning This method is deprecated, do not use. 4077 4078 \since BeOS R3 4079*/ 4080 4081 4082/*! 4083 \fn float BMessage::FindFloat(const char*, int32) const 4084 \brief Deprecated. 4085 4086 \warning This method is deprecated, do not use. 4087 4088 \since BeOS R3 4089*/ 4090 4091 4092/*! 4093 \fn double BMessage::FindDouble(const char*, int32) const 4094 \brief Deprecated. 4095 4096 \warning This method is deprecated, do not use. 4097 4098 \since BeOS R3 4099*/ 4100 4101 4102//! @} 4103 4104 4105/*! 4106 \name Allocation Operators 4107*/ 4108 4109 4110//! @{ 4111 4112 4113/*! 4114 \fn BMessage& BMessage::operator=(const BMessage& other) 4115 \brief Copy one message into another. 4116 4117 See the copy constructor, BMessage(const BMessage& other), for details on 4118 what is copied, and what isn't. 4119 4120 \since BeOS R3 4121*/ 4122 4123 4124/*! 4125 \fn void* BMessage::operator new(size_t size) 4126 \brief Allocates \a size bytes of memory for a BMessage. 4127 4128 \since BeOS R3 4129*/ 4130 4131 4132/*! 4133 \fn void* BMessage::operator new(size_t, void* pointer) 4134 \brief Allocates \a size bytes of memory for a BMessage. 4135 4136 \since BeOS R3 4137*/ 4138 4139 4140/*! 4141 \fn void* BMessage::operator new(size_t, const std::nothrow_t&) 4142 \brief Allocates \a size bytes of memory for a BMessage. 4143 4144 \since Haiku R1 4145*/ 4146 4147/*! 4148 \fn void BMessage::operator delete(void* pointer, size_t size) 4149 \brief Frees memory allocated by new. 4150 4151 \since BeOS R5 4152*/ 4153 4154 4155//! @} 4156 4157 4158/*! 4159 \name Finding Data Convenience Methods 4160 4161 These methods may be used as alternatives to the Find data methods above 4162 which allow you to specify a default value to use if the value you are 4163 looking for is not found and return the result instead of filling out an 4164 out parameter and status code. If you are not interested in the status code 4165 these methods allow for some code simplification. 4166 4167 For example, instead of writing: 4168 4169\code 4170bool enabled; 4171if (FindBool("enabled", &enabled) != B_OK) 4172 enabled = false; 4173\endcode 4174 4175 you can write the following: 4176 4177\code 4178bool enabled = GetBool("enabled", false); 4179\endcode 4180 4181 reducing the example to a single line. 4182*/ 4183 4184 4185//! @{ 4186 4187 4188/*! 4189 \fn bool BMessage::GetBool(const char* name, bool defaultValue) const 4190 \brief Return the boolean value from message with \a name, or 4191 \a defaultValue if not found. 4192 4193 \param name The name of the item to retrieve. 4194 \param defaultValue The value to use if the item specified by \a name 4195 is not found. 4196 4197 \return The item with \a name, or \a defaultValue if not found. 4198 4199 \since Haiku R1 4200*/ 4201 4202 4203/*! 4204 \fn bool BMessage::GetBool(const char* name, int32 index, 4205 bool defaultValue) const 4206 \brief Return the boolean value from message with \a name and \a index, or 4207 \a defaultValue if not found. 4208 4209 \param name The name of the item to retrieve. 4210 \param index The index of the item to retrieve if there is more than one. 4211 \param defaultValue The value to use if the item specified by \a name 4212 is not found. 4213 4214 \return The item with \a name, or \a defaultValue if not found. 4215 4216 \since Haiku R1 4217*/ 4218 4219 4220/*! 4221 \fn int8 BMessage::GetInt8(const char* name, int8 defaultValue) const 4222 \brief Return the int8 value from message with \a name, or \a defaultValue 4223 if not found. 4224 4225 \param name The name of the item to retrieve. 4226 \param defaultValue The value to use if the item specified by \a name 4227 is not found. 4228 4229 \return The item with \a name, or \a defaultValue if not found. 4230 4231 \since Haiku R1 4232*/ 4233 4234 4235/*! 4236 \fn int8 BMessage::GetInt8(const char* name, int32 index, 4237 int8 defaultValue) const 4238 \brief Return the int8 value from message with \a name and \a index, or 4239 \a defaultValue if not found. 4240 4241 \param name The name of the item to retrieve. 4242 \param index The index of the item to retrieve if there is more than one. 4243 \param defaultValue The value to use if the item specified by \a name 4244 is not found. 4245 4246 \return The item with \a name, or \a defaultValue if not found. 4247 4248 \since Haiku R1 4249*/ 4250 4251 4252/*! 4253 \fn uint8 BMessage::GetUInt8(const char* name, uint8 defaultValue) const 4254 \brief Return the uint8 value from message with \a name, or \a defaultValue 4255 if not found. 4256 4257 \param name The name of the item to retrieve. 4258 \param defaultValue The value to use if the item specified by \a name 4259 is not found. 4260 4261 \return The item with \a name, or \a defaultValue if not found. 4262 4263 \since Haiku R1 4264*/ 4265 4266 4267/*! 4268 \fn uint8 BMessage::GetUInt8(const char* name, int32 index, 4269 uint8 defaultValue) const 4270 \brief Return the uint8 message from message with \a name and \a index, or 4271 \a defaultValue if not found. 4272 4273 \param name The name of the item to retrieve. 4274 \param index The index of the item to retrieve if there is more than one. 4275 \param defaultValue The value to use if the item specified by \a name 4276 is not found. 4277 4278 \return The item with \a name, or \a defaultValue if not found. 4279 4280 \since Haiku R1 4281*/ 4282 4283 4284/*! 4285 \fn int16 BMessage::GetInt16(const char* name, int16 defaultValue) const 4286 \brief Return the int16 value from message with \a name, or \a defaultValue 4287 if not found. 4288 4289 \param name The name of the item to retrieve. 4290 \param defaultValue The value to use if the item specified by \a name 4291 is not found. 4292 4293 \return The item with \a name, or \a defaultValue if not found. 4294 4295 \since Haiku R1 4296*/ 4297 4298 4299/*! 4300 \fn int16 BMessage::GetInt16(const char* name, int32 index, 4301 int16 defaultValue) const 4302 \brief Return the int16 value from message with \a name and \a index, or 4303 \a defaultValue if not found. 4304 4305 \param name The name of the item to retrieve. 4306 \param index The index of the item to retrieve if there is more than one. 4307 \param defaultValue The value to use if the item specified by \a name 4308 is not found. 4309 4310 \return The item with \a name, or \a defaultValue if not found. 4311 4312 \since Haiku R1 4313*/ 4314 4315 4316/*! 4317 \fn uint16 BMessage::GetUInt16(const char* name, uint16 defaultValue) const 4318 \brief Return the uint16 value from message with \a name, or 4319 \a defaultValue if not found. 4320 4321 \param name The name of the item to retrieve. 4322 \param defaultValue The value to use if the item specified by \a name 4323 is not found. 4324 4325 \return The item with \a name, or \a defaultValue if not found. 4326 4327 \since Haiku R1 4328*/ 4329 4330 4331/*! 4332 \fn uint16 BMessage::GetUInt16(const char* name, int32 index, 4333 uint16 defaultValue) const 4334 \brief Return the uint16 value from message with \a name and \a index, or 4335 \a defaultValue if not found. 4336 4337 \param name The name of the item to retrieve. 4338 \param index The index of the item to retrieve if there is more than one. 4339 \param defaultValue The value to use if the item specified by \a name 4340 is not found. 4341 4342 \return The item with \a name, or \a defaultValue if not found. 4343 4344 \since Haiku R1 4345*/ 4346 4347 4348/*! 4349 \fn int32 BMessage::GetInt32(const char* name, int32 defaultValue) const 4350 \brief Return the int32 value from message with \a name, or \a defaultValue 4351 if not found. 4352 4353 \param name The name of the item to retrieve. 4354 \param defaultValue The value to use if the item specified by \a name 4355 is not found. 4356 4357 \return The item with \a name, or \a defaultValue if not found. 4358 4359 \since Haiku R1 4360*/ 4361 4362 4363/*! 4364 \fn int32 BMessage::GetInt32(const char* name, int32 index, 4365 int32 defaultValue) const 4366 \brief Return the int32 value from message with \a name and \a index, or 4367 \a defaultValue if not found. 4368 4369 \param name The name of the item to retrieve. 4370 \param index The index of the item to retrieve if there is more than one. 4371 \param defaultValue The value to use if the item specified by \a name 4372 is not found. 4373 4374 \return The item with \a name, or \a defaultValue if not found. 4375 4376 \since Haiku R1 4377*/ 4378 4379 4380/*! 4381 \fn uint32 BMessage::GetUInt32(const char* name, uint32 defaultValue) const 4382 \brief Return the uint32 value from message with \a name, or 4383 \a defaultValue if not found. 4384 4385 \param name The name of the item to retrieve. 4386 \param defaultValue The value to use if the item specified by \a name 4387 is not found. 4388 4389 \return The item with \a name, or \a defaultValue if not found. 4390 4391 \since Haiku R1 4392*/ 4393 4394 4395/*! 4396 \fn uint32 BMessage::GetUInt32(const char* name, int32 index, 4397 uint32 defaultValue) const 4398 \brief Return the uint32 value from message with \a name and \a index, or 4399 \a defaultValue if not found. 4400 4401 \param name The name of the item to retrieve. 4402 \param index The index of the item to retrieve if there is more than one. 4403 \param defaultValue The value to use if the item specified by \a name 4404 is not found. 4405 4406 \return The item with \a name, or \a defaultValue if not found. 4407 4408 \since Haiku R1 4409*/ 4410 4411 4412/*! 4413 \fn int64 BMessage::GetInt64(const char* name, int64 defaultValue) const 4414 \brief Return the int64 value from message with \a name, or \a defaultValue 4415 if not found. 4416 4417 \param name The name of the item to retrieve. 4418 \param defaultValue The value to use if the item specified by \a name 4419 is not found. 4420 4421 \return The item with \a name, or \a defaultValue if not found. 4422 4423 \since Haiku R1 4424*/ 4425 4426 4427/*! 4428 \fn int64 BMessage::GetInt64(const char* name, int32 index, 4429 int64 defaultValue) const 4430 \brief Return the int64 value from message with \a name and \a index, or 4431 \a defaultValue if not found. 4432 4433 \param name The name of the item to retrieve. 4434 \param index The index of the item to retrieve if there is more than one. 4435 \param defaultValue The value to use if the item specified by \a name 4436 is not found. 4437 4438 \return The item with \a name, or \a defaultValue if not found. 4439 4440 \since Haiku R1 4441*/ 4442 4443 4444/*! 4445 \fn uint64 BMessage::GetUInt64(const char* name, uint64 defaultValue) const 4446 \brief Return the uint64 value from message with \a name, or 4447 \a defaultValue if not found. 4448 4449 \param name The name of the item to retrieve. 4450 \param defaultValue The value to use if the item specified by \a name 4451 is not found. 4452 4453 \return The item with \a name, or \a defaultValue if not found. 4454 4455 \since Haiku R1 4456*/ 4457 4458 4459/*! 4460 \fn uint64 BMessage::GetUInt64(const char* name, int32 index, 4461 uint64 defaultValue) const 4462 \brief Return the uint64 value from message with \a name and \a index, or 4463 \a defaultValue if not found. 4464 4465 \param name The name of the item to retrieve. 4466 \param index The index of the item to retrieve if there is more than one. 4467 \param defaultValue The value to use if the item specified by \a name 4468 is not found. 4469 4470 \return The item with \a name, or \a defaultValue if not found. 4471 4472 \since Haiku R1 4473*/ 4474 4475 4476/*! 4477 \fn float BMessage::GetFloat(const char* name, float defaultValue) const 4478 \brief Return the float value from message with \a name, or \a defaultValue 4479 if not found. 4480 4481 \param name The name of the item to retrieve. 4482 \param defaultValue The value to use if the item specified by \a name 4483 is not found. 4484 4485 \return The item with \a name, or \a defaultValue if not found. 4486 4487 \since Haiku R1 4488*/ 4489 4490 4491/*! 4492 \fn float BMessage::GetFloat(const char* name, int32 index, 4493 float defaultValue) const 4494 \brief Return the float value from message with \a name and \a index, or 4495 \a defaultValue if not found. 4496 4497 \param name The name of the item to retrieve. 4498 \param index The index of the item to retrieve if there is more than one. 4499 \param defaultValue The value to use if the item specified by \a name 4500 is not found. 4501 4502 \return The item with \a name, or \a defaultValue if not found. 4503 4504 \since Haiku R1 4505*/ 4506 4507 4508/*! 4509 \fn double BMessage::GetDouble(const char* name, double defaultValue) const 4510 \brief Return the double value from message with \a name, or 4511 \a defaultValue if not found. 4512 4513 \param name The name of the item to retrieve. 4514 \param defaultValue The value to use if the item specified by \a name 4515 is not found. 4516 4517 \return The item with \a name, or \a defaultValue if not found. 4518 4519 \since Haiku R1 4520*/ 4521 4522 4523/*! 4524 \fn double BMessage::GetDouble(const char* name, int32 index, 4525 double defaultValue) const 4526 \brief Return the double value from message with \a name and \a index, or 4527 \a defaultValue if not found. 4528 4529 \param name The name of the item to retrieve. 4530 \param index The index of the item to retrieve if there is more than one. 4531 \param defaultValue The value to use if the item specified by \a name 4532 is not found. 4533 4534 \return The item with \a name, or \a defaultValue if not found. 4535 4536 \since Haiku R1 4537*/ 4538 4539 4540/*! 4541 \fn rgb_color BMessage::GetColor(const char* name, 4542 rgb_color defaultValue) const 4543 \brief Return the rgb_color value from message with \a name, or 4544 \a defaultValue if not found. 4545 4546 \param name The name of the item to retrieve. 4547 \param defaultValue The value to use if the item specified by \a name 4548 is not found. 4549 4550 \return The item with \a name, or \a defaultValue if not found. 4551 4552 \since Haiku R1 4553*/ 4554 4555 4556/*! 4557 \fn rgb_color BMessage::GetColor(const char* name, int32 index, 4558 rgb_color defaultValue) const 4559 \brief Return the rgb_color value from message with \a name and \a index, 4560 or \a defaultValue if not found. 4561 4562 \param name The name of the item to retrieve. 4563 \param index The index of the item to retrieve if there is more than one. 4564 \param defaultValue The value to use if the item specified by \a name 4565 is not found. 4566 4567 \return The item with \a name, or \a defaultValue if not found. 4568 4569 \since Haiku R1 4570*/ 4571 4572 4573/*! 4574 \fn const void* BMessage::GetPointer(const char* name, 4575 const void* defaultValue = NULL) const 4576 \brief Return the pointer type from message with \a name, or 4577 \a defaultValue if not found. 4578 4579 \param name The name of the item to retrieve. 4580 \param defaultValue The value to use if the item specified by \a name 4581 is not found. 4582 4583 \return The item with \a name, or \a defaultValue if not found. 4584 4585 \since Haiku R1 4586*/ 4587 4588 4589/*! 4590 \fn rgb_color BMessage::GetPointer(const char* name, int32 index, 4591 const void* defaultValue = NULL) const 4592 \brief Return the pointer type from message with \a name and \a index, or 4593 \a defaultValue if not found. 4594 4595 \param name The name of the item to retrieve. 4596 \param index The index of the item to retrieve if there is more than one. 4597 \param defaultValue The value to use if the item specified by \a name 4598 is not found. 4599 4600 \return The item with \a name, or \a defaultValue if not found. 4601 4602 \since Haiku R1 4603*/ 4604 4605 4606/*! 4607 \fn const char* BMessage::GetString(const char* name, 4608 const char* defaultValue) const 4609 \brief Return the string from message with \a name, or \a defaultValue if 4610 not found. 4611 4612 \param name The name of the item to retrieve. 4613 \param defaultValue The value to use if the item specified by \a name 4614 is not found. 4615 4616 \return The item with \a name, or \a defaultValue if not found. 4617 4618 \since Haiku R1 4619*/ 4620 4621 4622/*! 4623 \fn const char* BMessage::GetString(const char* name, int32 index, 4624 const char* defaultValue) const 4625 \brief Return the string from message with \a name and \a index, or 4626 \a defaultValue if not found. 4627 4628 \param name The name of the item to retrieve. 4629 \param index The index of the item to retrieve if there is more than one. 4630 \param defaultValue The value to use if the item specified by \a name 4631 is not found. 4632 4633 \return The item with \a name, or \a defaultValue if not found. 4634 4635 \since Haiku R1 4636*/ 4637 4638 4639/*! 4640 \fn BAlignment BMessage::GetAlignment(const char* name, 4641 const BAlignment& defaultValue) const 4642 \brief Return the BAlignment object from message with \a name, or 4643 \a defaultValue if not found. 4644 4645 \param name The name of the item to retrieve. 4646 \param defaultValue The value to use if the item specified by \a name 4647 is not found. 4648 4649 \return The item with \a name, or \a defaultValue if not found. 4650 4651 \since Haiku R1 4652*/ 4653 4654 4655/*! 4656 \fn BAlignment BMessage::GetAlignment(const char* name, int32 index, 4657 const BAlignment& defaultValue) const 4658 \brief Return the BAlignment object from message with \a name and \a index, 4659 or \a defaultValue if not found. 4660 4661 \param name The name of the item to retrieve. 4662 \param index The index of the item to retrieve if there is more than one. 4663 \param defaultValue The value to use if the item specified by \a name 4664 is not found. 4665 4666 \return The item with \a name, or \a defaultValue if not found. 4667 4668 \since Haiku R1 4669*/ 4670 4671 4672/*! 4673 \fn BRect BMessage::GetRect(const char* name, 4674 const BRect& defaultValue) const 4675 \brief Return the BRect object from message with \a name, or 4676 \a defaultValue if not found. 4677 4678 \param name The name of the item to retrieve. 4679 \param defaultValue The value to use if the item specified by \a name 4680 is not found. 4681 4682 \return The item with \a name, or \a defaultValue if not found. 4683 4684 \since Haiku R1 4685*/ 4686 4687 4688/*! 4689 \fn BRect BMessage::GetRect(const char* name, int32 index, 4690 const BRect& defaultValue) const 4691 \brief Return the BRect object from message with \a name and \a index, 4692 or \a defaultValue if not found. 4693 4694 \param name The name of the item to retrieve. 4695 \param index The index of the item to retrieve if there is more than one. 4696 \param defaultValue The value to use if the item specified by \a name 4697 is not found. 4698 4699 \return The item with \a name, or \a defaultValue if not found. 4700 4701 \since Haiku R1 4702*/ 4703 4704 4705/*! 4706 \fn BPoint BMessage::GetPoint(const char* name, 4707 const BPoint& defaultValue) const 4708 \brief Return the BPoint object from message with \a name, or 4709 \a defaultValue if not found. 4710 4711 \param name The name of the item to retrieve. 4712 \param defaultValue The value to use if the item specified by \a name 4713 is not found. 4714 4715 \return The item with \a name, or \a defaultValue if not found. 4716 4717 \since Haiku R1 4718*/ 4719 4720 4721/*! 4722 \fn BPoint BMessage::GetPoint(const char* name, int32 index, 4723 const BPoint& defaultValue) const 4724 \brief Return the BPoint object from message with \a name and \a index, 4725 or \a defaultValue if not found. 4726 4727 \param name The name of the item to retrieve. 4728 \param index The index of the item to retrieve if there is more than one. 4729 \param defaultValue The value to use if the item specified by \a name 4730 is not found. 4731 4732 \return The item with \a name, or \a defaultValue if not found. 4733 4734 \since Haiku R1 4735*/ 4736 4737 4738/*! 4739 \fn BSize BMessage::GetSize(const char* name, 4740 const BSize& defaultValue) const 4741 \brief Return the BSize object from message with \a name, or 4742 \a defaultValue if not found. 4743 4744 \param name The name of the item to retrieve. 4745 \param defaultValue The value to use if the item specified by \a name 4746 is not found. 4747 4748 \return The item with \a name, or \a defaultValue if not found. 4749 4750 \since Haiku R1 4751*/ 4752 4753 4754/*! 4755 \fn BSize BMessage::GetSize(const char* name, int32 index, 4756 const BSize& defaultValue) const 4757 \brief Return the BSize object from message with \a name and \a index, 4758 or \a defaultValue if not found. 4759 4760 \param name The name of the item to retrieve. 4761 \param index The index of the item to retrieve if there is more than one. 4762 \param defaultValue The value to use if the item specified by \a name 4763 is not found. 4764 4765 \return The item with \a name, or \a defaultValue if not found. 4766 4767 \since Haiku R1 4768*/ 4769 4770 4771//! @} 4772 4773/*! 4774 \name Setting Data Convenience Methods 4775 4776 These methods may be used as alternatives to the Add data methods above. 4777 Using them, will set the data stored at index 0 to the value that you pass 4778 to the method. If the data already exists, then it is overwritten. 4779 4780 For example, calling the SetBool(const char *, bool) method is like calling 4781 AddBool(const char*, bool) in case the item does not exist yet, and 4782 ReplaceBool(const char*, bool) in case it does. 4783 4784 Note that this call will fail if there already is data for that label, with 4785 a different type. If that might be the case, you will be better of using a 4786 combination of RemoveName(const char*) and the Add methods. Also note that 4787 this method will always work on the first element of the data (at index 0). 4788 In case there are more values stored, the other ones will not be altered. 4789*/ 4790 4791 4792//! @{ 4793 4794 4795/*! 4796 \fn status_t BMessage::SetBool(const char* name, bool value) 4797 \brief Set the data with at the label \a name to \a value. 4798 4799 \param name The name of the item. 4800 \param value The value to set the item to. 4801 4802 This function calls AddBool(const char*, bool) in case the item does not 4803 exist yet, and ReplaceBool(const char*, bool) in case it does. 4804 4805 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4806 case the item already exists with a different data type. 4807 4808 \since Haiku R1 4809*/ 4810 4811 4812/*! 4813 \fn status_t BMessage::SetInt8(const char* name, int8 value) 4814 \brief Set the data with at the label \a name to \a value. 4815 4816 \param name The name of the item. 4817 \param value The value to set the item to. 4818 4819 This function calls AddInt8(const char*, int8) in case the item does not 4820 exist yet, and ReplaceInt8(const char*, int8) in case it does. 4821 4822 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4823 case the item already exists with a different data type. 4824 4825 \since Haiku R1 4826*/ 4827 4828 4829/*! 4830 \fn status_t BMessage::SetUInt8(const char* name, uint8 value) 4831 \brief Set the data with at the label \a name to \a value. 4832 4833 \param name The name of the item. 4834 \param value The value to set the item to. 4835 4836 This function calls AddUInt8(const char*, uint8) in case the item does not 4837 exist yet, and ReplaceUInt8(const char*, uint8) in case it does. 4838 4839 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4840 case the item already exists with a different data type. 4841 4842 \since Haiku R1 4843*/ 4844 4845 4846/*! 4847 \fn status_t BMessage::SetInt16(const char* name, int16 value) 4848 \brief Set the data with at the label \a name to \a value. 4849 4850 \param name The name of the item. 4851 \param value The value to set the item to. 4852 4853 This function calls AddInt16(const char*, int16) in case the item does not 4854 exist yet, and ReplaceInt16(const char*, int16) in case it does. 4855 4856 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4857 case the item already exists with a different data type. 4858 4859 \since Haiku R1 4860*/ 4861 4862 4863/*! 4864 \fn status_t BMessage::SetUInt16(const char* name, uint16 value) 4865 \brief Set the data with at the label \a name to \a value. 4866 4867 \param name The name of the item. 4868 \param value The value to set the item to. 4869 4870 This function calls AddUInt16(const char*, uint16) in case the item does 4871 not exist yet, and ReplaceUInt16(const char*, uint16) in case it does. 4872 4873 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4874 case the item already exists with a different data type. 4875 4876 \since Haiku R1 4877*/ 4878 4879 4880/*! 4881 \fn status_t BMessage::SetInt32(const char* name, int32 value) 4882 \brief Set the data with at the label \a name to \a value. 4883 4884 \param name The name of the item. 4885 \param value The value to set the item to. 4886 4887 This function calls AddInt32(const char*, int32) in case the item does not 4888 exist yet, and ReplaceInt32(const char*, int32) in case it does. 4889 4890 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4891 case the item already exists with a different data type. 4892 4893 \since Haiku R1 4894*/ 4895 4896 4897/*! 4898 \fn status_t BMessage::SetUInt32(const char* name, uint32 value) 4899 \brief Set the data with at the label \a name to \a value. 4900 4901 \param name The name of the item. 4902 \param value The value to set the item to. 4903 4904 This function calls AddUInt32(const char*, uint32) in case the item does not 4905 exist yet, and ReplaceUInt32(const char*, uint32) in case it does. 4906 4907 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4908 case the item already exists with a different data type. 4909 4910 \since Haiku R1 4911*/ 4912 4913 4914/*! 4915 \fn status_t BMessage::SetInt64(const char* name, int64 value) 4916 \brief Set the data with at the label \a name to \a value. 4917 4918 \param name The name of the item. 4919 \param value The value to set the item to. 4920 4921 This function calls AddInt64(const char*, int64) in case the item does not 4922 exist yet, and ReplaceInt64(const char*, int64) in case it does. 4923 4924 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4925 case the item already exists with a different data type. 4926 4927 \since Haiku R1 4928*/ 4929 4930 4931/*! 4932 \fn status_t BMessage::SetUInt64(const char* name, uint64 value) 4933 \brief Set the data with at the label \a name to \a value. 4934 4935 \param name The name of the item. 4936 \param value The value to set the item to. 4937 4938 This function calls AddUInt64(const char*, uint64) in case the item does 4939 not exist yet, and ReplaceUInt64(const char*, uint64) in case it does. 4940 4941 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4942 case the item already exists with a different data type. 4943 4944 \since Haiku R1 4945*/ 4946 4947 4948/*! 4949 \fn status_t BMessage::SetColor(const char* name, rgb_color value) 4950 \brief Set the data with at the label \a name to \a value. 4951 4952 \param name The name of the item. 4953 \param value The value to set the item to. 4954 4955 This function calls AddColor(const char*, rgb_color) in case the item does 4956 not exist yet, and ReplaceColor(const char*, rgb_color) in case it does. 4957 4958 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4959 case the item already exists with a different data type. 4960 4961 \since Haiku R1 4962*/ 4963 4964 4965/*! 4966 \fn status_t BMessage::SetPointer(const char* name, const void* value) 4967 \brief Set the data with at the label \a name to \a value. 4968 4969 \param name The name of the item. 4970 \param value The value to set the item to. 4971 4972 This function calls AddPointer(const char*, const void*) in case the item 4973 does not exist yet, and ReplacePointer(const char*, const void*) in case 4974 it does. 4975 4976 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4977 case the item already exists with a different data type. 4978 4979 \since Haiku R1 4980*/ 4981 4982 4983/*! 4984 \fn status_t BMessage::SetString(const char* name, const char* string) 4985 \brief Set the string with at the label \a name to \a string. 4986 4987 \param name The name of the item. 4988 \param string The value to set the item to. 4989 4990 This function calls AddString(const char*, const char*) in case the item 4991 does not exist yet, and ReplaceString(const char*, const char*) in case 4992 it does. 4993 4994 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 4995 case the item already exists with a different data type. 4996 4997 \since Haiku R1 4998*/ 4999 5000 5001/*! 5002 \fn status_t BMessage::SetString(const char* name, const BString& string) 5003 \brief Set the string with at the label \a name to \a string. 5004 5005 \param name The name of the item. 5006 \param string The value to set the item to. 5007 5008 This function calls AddString(const char*, const BString&) in case the item 5009 does not exist yet, and ReplaceString(const char*, const BString&) in case 5010 it does. 5011 5012 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5013 case the item already exists with a different data type. 5014 5015 \since Haiku R1 5016*/ 5017 5018 5019/*! 5020 \fn status_t BMessage::SetFloat(const char* name, float value) 5021 \brief Set the data with at the label \a name to \a value. 5022 5023 \param name The name of the item. 5024 \param value The value to set the item to. 5025 5026 This function calls AddFloat(const char*, float) in case the item does not 5027 exist yet, and ReplaceFloat(const char*, float) in case it does. 5028 5029 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5030 case the item already exists with a different data type. 5031 5032 \since Haiku R1 5033*/ 5034 5035 5036/*! 5037 \fn status_t BMessage::SetDouble(const char* name, double value) 5038 \brief Set the data with at the label \a name to \a value. 5039 5040 \param name The name of the item. 5041 \param value The value to set the item to. 5042 5043 This function calls AddDouble(const char*, double) in case the item does not 5044 exist yet, and ReplaceDouble(const char*, double) in case it does. 5045 5046 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5047 case the item already exists with a different data type. 5048 5049 \since Haiku R1 5050*/ 5051 5052 5053/*! 5054 \fn status_t BMessage::SetAlignment(const char* name, 5055 const BAlignment& value) 5056 \brief Set the data with at the label \a name to \a value. 5057 5058 \param name The name of the item. 5059 \param value The value to set the item to. 5060 5061 This function calls AddAlignment(const char*, const BAlignment &) in case 5062 the item does not exist yet, and 5063 ReplaceAlignment(const char*, const BAlignment &) in case it does. 5064 5065 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5066 case the item already exists with a different data type. 5067 5068 \since Haiku R1 5069*/ 5070 5071 5072/*! 5073 \fn status_t BMessage::SetPoint(const char* name, const BPoint& value) 5074 \brief Set the data with at the label \a name to \a value. 5075 5076 \param name The name of the item. 5077 \param value The value to set the item to. 5078 5079 This function calls AddPoint(const char*, const BPoint &) in case the item 5080 does not exist yet, and ReplacePoint(const char*, const BPoint &) in case 5081 it does. 5082 5083 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5084 case the item already exists with a different data type. 5085 5086 \since Haiku R1 5087*/ 5088 5089 5090/*! 5091 \fn status_t BMessage::SetRect(const char* name, const BRrect& value) 5092 \brief Set the data with at the label \a name to \a value. 5093 5094 \param name The name of the item. 5095 \param value The value to set the item to. 5096 5097 This function calls AddRect(const char*, const BRect &) in case the item 5098 does not exist yet, and ReplaceRect(const char*, const BRect &) in case 5099 it does. 5100 5101 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5102 case the item already exists with a different data type. 5103 5104 \since Haiku R1 5105*/ 5106 5107 5108/*! 5109 \fn status_t BMessage::SetSize(const char* name, const BSize& value) 5110 \brief Set the data with at the label \a name to \a value. 5111 5112 \param name The name of the item. 5113 \param value The value to set the item to. 5114 5115 This function calls AddSize(const char*, const BSize &) in case the item 5116 does not exist yet, and ReplaceSize(const char*, const BSize &) in case 5117 it does. 5118 5119 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5120 case the item already exists with a different data type. 5121 5122 \since Haiku R1 5123*/ 5124 5125 5126/*! 5127 \fn status_t BMessage::SetData(const char* name, type_code type, 5128 const void* data, ssize_t numBytes, bool fixedSize = true, 5129 int count = 1) 5130 \brief Low level function to set data to a certain value. 5131 5132 This method is used internally. Use the Set* methods above. 5133 5134 \returns A status code, \c B_OK in case of success and \c B_BAD_TYPE in 5135 case the item already exists with a different data type. 5136 5137 \since Haiku R1 5138*/ 5139 5140 5141//! @} 5142