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