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