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 ReplacePointer() 1142 1143 \since BeOS R3 1144*/ 1145 1146 1147/*! 1148 \fn status_t BMessage::AddMessenger(const char* name, BMessenger messenger) 1149 \brief Convenience method to add a messenger to the label \a name. 1150 1151 This method calls AddData() with the \c B_MESSENGER_TYPE \a type. 1152 1153 \param name The label to associate the data with. 1154 \param messenger The messenger to store in the message. 1155 1156 \returns A status code, \c B_OK on success or an error code. 1157 1158 \see AddData() for a more detailed overview of the inner workings. 1159 \see FindMessenger() 1160 \see ReplaceMessenger() 1161 1162 \since BeOS R3 1163*/ 1164 1165 1166/*! 1167 \fn status_t BMessage::AddRef(const char* name, const entry_ref* ref) 1168 \brief Convenience method to add an \c entry_ref to the label 1169 \a name. 1170 1171 This method calls AddData() with the \c B_REF_TYPE \a type. 1172 1173 \param name The label to associate the data with. 1174 \param ref The reference to store in the message. 1175 1176 \returns A status code, \c B_OK on success or an error code. 1177 1178 \see AddData() for a more detailed overview of the inner workings. 1179 \see FindRef() 1180 \see ReplaceRef() 1181 1182 \since BeOS R3 1183*/ 1184 1185 1186/*! 1187 \fn status_t BMessage::AddMessage(const char* name, 1188 const BMessage* message) 1189 \brief Convenience method to add a message to the label \a name. 1190 1191 This method calls AddData() with the \c B_MESSAGE_TYPE \a type. 1192 1193 \param name The label to associate the data with. 1194 \param message The message to store in this message. 1195 1196 \returns A status code, \c B_OK on success or an error code. 1197 1198 \see AddData() for a more detailed overview of the inner workings. 1199 \see FindMessage() 1200 \see ReplaceMessage() 1201 1202 \since BeOS R3 1203*/ 1204 1205 1206/*! 1207 \fn status_t BMessage::AddFlat(const char* name, BFlattenable* object, 1208 int32 count = 1) 1209 \brief Convenience method to add a flattenable to the label \a name. 1210 1211 This method uses BFlattenable::TypeCode() to determine the type. It also 1212 uses BFlattenable::IsFixedSize() to determine whether or not the size of 1213 the object is supposedly always the same. You can specify a 1214 \a count, to pre-allocate more entries if you are going to add 1215 more than one of this type. 1216 1217 \param name The label to associate the data with. 1218 \param object The object to flatten into the message. 1219 \param count The number of items to pre-allocate associated with this 1220 \a name. 1221 1222 \returns A status code, \c B_OK on success or an error code. 1223 1224 \see AddData() for a more detailed overview of the inner workings. 1225 \see FindFlat() 1226 \see ReplaceFlat() 1227 1228 \since BeOS R3 1229*/ 1230 1231 1232//! @} 1233 1234 1235/*! 1236 \name Removing Data 1237*/ 1238 1239 1240//! @{ 1241 1242 1243/*! 1244 \fn status_t BMessage::RemoveData(const char* name, int32 index) 1245 \brief Remove data associated with \a name at a specified 1246 \a index. 1247 1248 If this is the only instance of the data, then the entire label will be 1249 removed. This means you can recreate it with another type. 1250 1251 \param name The \a name of which the associated data should be cleared. 1252 \param index The \a index of the item that should be cleared. 1253 1254 \returns A status code, \c B_OK on success or an error code. 1255 \retval B_OK The data has been removed. 1256 \retval B_BAD_VALUE The \a index is less than \c 0. 1257 \retval B_BAD_INDEX The \a index is out of bounds. 1258 \retval B_NAME_NOT_FOUND The \a name does not have any data associated 1259 with it. 1260 1261 \see RemoveName() 1262 \see MakeEmpty() 1263 1264 \since BeOS R3 1265*/ 1266 1267 1268/*! 1269 \fn status_t BMessage::RemoveName(const char* name) 1270 \brief Remove all data associated with a \a name. 1271 1272 This also removes the label, so that you can recreate it with another type, 1273 if you want to. 1274 1275 \param name The \a name that refers to the data you want to clear out. 1276 1277 \returns A status code, \c B_OK on success or an error code. 1278 \retval B_OK All the data is removed. 1279 \retval B_BAD_VALUE The \a name pointer points to \c NULL. 1280 \retval B_NAME_NOT_FOUND The \a name does not exist in this message. 1281 1282 \see RemoveData() 1283 \see MakeEmpty() 1284 1285 \since BeOS R3 1286*/ 1287 1288 1289/*! 1290 \fn status_t BMessage::MakeEmpty() 1291 \brief Clear all data and metadata in this message. 1292 1293 Everything is cleared out, all labels and all associated data, as well 1294 as metadata such as reply info. 1295 1296 \return This method always returns \c B_OK. 1297 1298 \see RemoveData() 1299 \see RemoveName() 1300 1301 \since BeOS R3 1302*/ 1303 1304 1305//! @} 1306 1307 1308/*! 1309 \name Finding Data 1310 1311 Look at FindData() for a general introduction to finding data. 1312*/ 1313 1314/* TODO: 1315 Quick overview: 1316 1317 <table> 1318 <tr><th>Type of data</th><th>Type code</th><th>Method</td></tr> 1319 <tr><td>BRect</td><td>\c B_RECT_TYPE</td><td>FindRect()</td></tr> 1320 </table> 1321*/ 1322 1323 1324//! @{ 1325 1326 1327/*! 1328 \fn status_t BMessage::FindData(const char* name, type_code type, 1329 int32 index, const void** data, ssize_t* numBytes) const 1330 \brief Find \a data that is stored in this message at an 1331 \a index. 1332 1333 This method matches the label \a name with the \a type you 1334 are asking for, and it looks for the data that is stored at a certain 1335 \a index number. If all these things match, you will get a pointer 1336 to the internal buffer, and the method will put the size of the item in 1337 \a numBytes. 1338 1339 Note that only this method, and FindString(const char*, const char**), 1340 pass a pointer to the internal buffer. The other more specific methods, 1341 such as FindBool() and FindRect() copy the data into a buffer you specify. 1342 This means that the data retrieved with this method is valid until the 1343 message is deleted. 1344 1345 \param name The label the data should be associated with. 1346 \param type The type of data you want to retrieve. You can pass 1347 \c B_ANY_TYPE if you don't mind which type the data is. 1348 \param index The index in the array of the data that you want to retrieve. 1349 Note that the array is zero-based. 1350 \param[out] data A pointer to a pointer where the data can point to. 1351 \param[out] numBytes The size of the data will be put in this parameter. 1352 1353 \returns A status code, \c B_OK on success or an error code. 1354 \retval B_OK The \a name was found, matches the type, and the data 1355 at \a index has been put in \a data. 1356 \retval B_BAD_VALUE One of the output arguments were \c NULL. 1357 \retval B_BAD_INDEX The \a index does not exist. 1358 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1359 1360 \see status_t FindData(const char*, type_code, int32, 1361 const void**, ssize_t*) const 1362 1363 \since BeOS R3 1364*/ 1365 1366 1367/*! 1368 \fn status_t BMessage::FindData(const char* name, type_code type, 1369 const void** data, ssize_t* numBytes) const 1370 \brief Find \a data that is stored in this message. 1371 1372 This is an overloaded version of 1373 FindData(const char*, type_code, int32, const void**, ssize_t*) const 1374 where data is sought at \a index \c 0. 1375 1376 \since BeOS R3 1377*/ 1378 1379 1380/*! 1381 \fn status_t BMessage::FindRect(const char* name, BRect* rect) const 1382 \brief Find a rectangle at the label \a name. 1383 1384 This is an overloaded version of 1385 FindRect(const char*, int32, BRect*) const 1386 where the data is sought at \a index \c 0. 1387 1388 \since BeOS R3 1389*/ 1390 1391 1392/*! 1393 \fn status_t BMessage::FindRect(const char* name, int32 index, 1394 BRect* rect) const 1395 \brief Find a rectangle at the label \a name at an \a index. 1396 1397 This method looks for the data with the \c B_RECT_TYPE, and copies it into 1398 a provided buffer. 1399 1400 \param name The label to which the data is associated. 1401 \param index The index from which the data should be copied. 1402 \param rect The object in which the data should be copied. 1403 1404 \returns A status code, \c B_OK on success or an error code. 1405 \retval B_OK The object now contains the requested data. 1406 \retval B_BAD_INDEX The \a index does not exist. 1407 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1408 1409 \see FindRect(const char*, BRect*) const 1410 1411 \since BeOS R3 1412*/ 1413 1414 1415/*! 1416 \fn status_t BMessage::FindPoint(const char* name, BPoint* point) const 1417 \brief Find a point at the label \a name. 1418 1419 This is an overloaded version of 1420 FindPoint(const char*, int32, BPoint*) const 1421 where the data is sought at \a index \c 0. 1422 1423 \since BeOS R3 1424*/ 1425 1426 1427/*! 1428 \fn status_t BMessage::FindPoint(const char* name, int32 index, 1429 BPoint* point) const 1430 \brief Find a point at the label \a name at an \a index. 1431 1432 This method looks for the data with the \c B_POINT_TYPE, and copies it into 1433 a provided buffer. 1434 1435 \param name The label to which the data is associated. 1436 \param index The index from which the data should be copied. 1437 \param point The object in which the data should be copied. 1438 1439 \returns A status code, \c B_OK on success or an error code. 1440 \retval B_OK The object now contains the requested data. 1441 \retval B_BAD_INDEX The \a index does not exist. 1442 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1443 1444 \see FindPoint(const char*, BPoint*) const 1445 1446 \since BeOS R3 1447*/ 1448 1449 1450/*! 1451 \fn status_t BMessage::FindString(const char* name, 1452 const char** string) const 1453 \brief Find a string at the label \a name. 1454 1455 This is an overloaded version of 1456 FindString(const char*, int32, const char**) const 1457 where the data is sought at \a index \c 0. 1458 1459 \since BeOS R3 1460*/ 1461 1462 1463/*! 1464 \fn status_t BMessage::FindString(const char* name, int32 index, 1465 const char** string) const 1466 \brief Find a string at the label \a name at an \a index. 1467 1468 This method looks for the data with the \c B_STRING_TYPE, and returns a 1469 pointer to the internal buffer of the message. Note that this pointer is 1470 valid, until the message is deleted. 1471 1472 \param name The label to which the data is associated. 1473 \param index The index from which the data should be copied. 1474 \param string The object in which the data should be copied. 1475 1476 \returns A status code, \c B_OK on success or an error code. 1477 \retval B_OK The object now contains the requested data. 1478 \retval B_BAD_INDEX The \a index does not exist. 1479 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1480 1481 \see FindString(const char*, const char**) const 1482 \see FindString(const char*, int32, BString*) const 1483 1484 \since BeOS R3 1485*/ 1486 1487 1488/*! 1489 \fn status_t BMessage::FindString(const char* name, BString* string) const 1490 \brief Find a string at the label \a name. 1491 1492 This is an overloaded version of 1493 FindString(const char*, int32, BString*) const 1494 where the data is sought at \a index \c 0. 1495 1496 \since BeOS R5 1497*/ 1498 1499 1500/*! 1501 \fn status_t BMessage::FindString(const char* name, int32 index, 1502 BString* string) const 1503 \brief Find a string at the label \a name at an \a index. 1504 1505 This method looks for the data with the \c B_STRING_TYPE, and copies it 1506 into the \a string object. 1507 1508 \param name The label to which the data is associated. 1509 \param index The index from which the data should be copied. 1510 \param string The object in which the data should be copied. 1511 1512 \returns A status code, \c B_OK on success or an error code. 1513 \retval B_OK The object now contains the requested data. 1514 \retval B_BAD_INDEX The \a index does not exist. 1515 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1516 1517 \see FindString(const char*, BString*) const 1518 \see FindString(const char*, int32, const char**) const 1519 1520 \since BeOS R5 1521*/ 1522 1523 1524/*! 1525 \fn status_t BMessage::FindInt8(const char* name, int8* value) const 1526 \brief Find an integer at the label \a name. 1527 1528 This is an overloaded version of 1529 FindInt8(const char*, int32, int8*) const 1530 where the data is sought at \a index \c 0. 1531 1532 \since BeOS R3 1533*/ 1534 1535 1536/*! 1537 \fn status_t BMessage::FindInt8(const char* name, int32 index, 1538 int8* value) const 1539 \brief Find an integer at the label \a name at an \a index. 1540 1541 This method looks for the data with the \c B_INT8_TYPE, and copies it into 1542 a provided buffer. 1543 1544 \param name The label to which the data is associated. 1545 \param index The index from which the data should be copied. 1546 \param value The object in which the data should be copied. 1547 1548 \returns A status code, \c B_OK on success or an error code. 1549 \retval B_OK The object now contains the requested data. 1550 \retval B_BAD_INDEX The \a index does not exist. 1551 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1552 1553 \see FindInt8(const char*, int8*) const 1554 1555 \since BeOS R3 1556*/ 1557 1558 1559/*! 1560 \fn status_t BMessage::FindInt16(const char* name, int16* value) const 1561 \brief Find an integer at the label \a name. 1562 1563 This is an overloaded version of FindInt8(const char*, int32, int16*) const 1564 where the data is sought at \a index \c 0. 1565 1566 \param name The label to which the data is associated. 1567 \param value The object in which the data should be copied. 1568 1569 \returns A status code, \c B_OK on success or an error code. 1570 \retval B_OK The object now contains the requested data. 1571 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1572 1573 \since BeOS R3 1574*/ 1575 1576 1577/*! 1578 \fn status_t BMessage::FindInt16(const char* name, int32 index, 1579 int16* value) const 1580 \brief Find an integer at the label \a name at an \a index. 1581 1582 This method looks for the data with the \c B_INT16_TYPE, and copies it into 1583 a provided buffer. 1584 1585 \param name The label to which the data is associated. 1586 \param index The index from which the data should be copied. 1587 \param value The object in which the data should be copied. 1588 1589 \returns A status code, \c B_OK on success or an error code. 1590 \retval B_OK The object now contains the requested data. 1591 \retval B_BAD_INDEX The \a index does not exist. 1592 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1593 1594 \see FindInt16(const char*, int16*) const 1595 1596 \since BeOS R3 1597*/ 1598 1599 1600/*! 1601 \fn status_t BMessage::FindInt32(const char* name, int32* value) const 1602 \brief Find an integer at the label \a name. 1603 1604 This is an overloaded version of 1605 FindInt32(const char*, int32, int32*) const 1606 where the data is sought at \a index \c 0. 1607 1608 \param name The label to which the data is associated. 1609 \param value The object in which the data should be copied. 1610 1611 \returns A status code, \c B_OK on success or an error code. 1612 \retval B_OK The object now contains the requested data. 1613 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1614 1615 \since BeOS R3 1616*/ 1617 1618 1619/*! 1620 \fn status_t BMessage::FindInt32(const char* name, int32 index, 1621 int32* value) const 1622 \brief Find an integer at the label \a name at an \a index. 1623 1624 This method looks for the data with the \c B_INT32_TYPE, and copies 1625 it into a provided buffer. 1626 1627 \param name The label to which the data is associated. 1628 \param index The index from which the data should be copied. 1629 \param value The object in which the data should be copied. 1630 1631 \returns A status code, \c B_OK on success or an error code. 1632 \retval B_OK The object now contains the requested data. 1633 \retval B_BAD_INDEX The \a index does not exist. 1634 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1635 1636 \see FindInt32(const char*, int32*) const 1637 1638 \since BeOS R3 1639*/ 1640 1641 1642/*! 1643 \fn status_t BMessage::FindInt64(const char* name, int64* value) const 1644 \brief Find an integer at the label \a name. 1645 1646 This is an overloaded version of 1647 FindInt64(const char*, int32, int64*) const 1648 where the data is sought at \a index \c 0. 1649 1650 \param name The label to which the data is associated. 1651 \param value The object in which the data should be copied. 1652 1653 \returns A status code, \c B_OK on success or an error code. 1654 \retval B_OK The object now contains the requested data. 1655 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1656 1657 \since BeOS R3 1658*/ 1659 1660 1661/*! 1662 \fn status_t BMessage::FindInt64(const char* name, int32 index, 1663 int64* value) const 1664 \brief Find an integer at the label \a name at an \a index. 1665 1666 This method looks for the data with the \c B_INT64_TYPE, and copies 1667 it into a provided buffer. 1668 1669 \param name The label to which the data is associated. 1670 \param index The index from which the data should be copied. 1671 \param value The object in which the data should be copied. 1672 1673 \returns A status code, \c B_OK on success or an error code. 1674 \retval B_OK The object now contains the requested data. 1675 \retval B_BAD_INDEX The \a index does not exist. 1676 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1677 1678 \see FindInt64(const char*, int64*) const 1679 1680 \since BeOS R3 1681*/ 1682 1683 1684/*! 1685 \fn status_t BMessage::FindBool(const char* name, bool* value) const 1686 \brief Find a boolean at the label \a name. 1687 1688 This is an overloaded version of 1689 FindBool(const char*, int32, bool*) const 1690 where the data is sought at \a index \c 0. 1691 1692 \param name The label to which the data is associated. 1693 \param value The object in which the data should be copied. 1694 1695 \returns A status code, \c B_OK on success or an error code. 1696 \retval B_OK The object now contains the requested data. 1697 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1698 1699 \since BeOS R3 1700*/ 1701 1702 1703/*! 1704 \fn status_t BMessage::FindBool(const char* name, int32 index, 1705 bool* value) const 1706 \brief Find a boolean at the label \a name at an \a index. 1707 1708 This method looks for the data with the \c B_BOOL_TYPE, and copies it into 1709 a provided buffer. 1710 1711 \param name The label to which the data is associated. 1712 \param index The index from which the data should be copied. 1713 \param value The object in which the data should be copied. 1714 1715 \returns A status code, \c B_OK on success or an error code. 1716 \retval B_OK The object now contains the requested data. 1717 \retval B_BAD_INDEX The \a index does not exist. 1718 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1719 1720 \see FindBool(const char*, bool*) const 1721 1722 \since BeOS R3 1723*/ 1724 1725 1726/*! 1727 \fn status_t BMessage::FindFloat(const char* name, float* value) const 1728 \brief Find a float at the label \a name. 1729 1730 This is an overloaded version of 1731 FindFloat(const char*, int32, float*) const 1732 where the data is sought at \a index \c 0. 1733 1734 \param name The label to which the data is associated. 1735 \param value The object in which the data should be copied. 1736 1737 \returns A status code, \c B_OK on success or an error code. 1738 \retval B_OK The object now contains the requested data. 1739 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1740 1741 \since BeOS R3 1742*/ 1743 1744 1745/*! 1746 \fn status_t BMessage::FindFloat(const char* name, int32 index, 1747 float* value) const 1748 \brief Find a float at the label \a name at an \a index. 1749 1750 This method looks for the data with the \c B_FLOAT_TYPE, and copies 1751 it into a provided buffer. 1752 1753 \param name The label to which the data is associated. 1754 \param index The index from which the data should be copied. 1755 \param value The object in which the data should be copied. 1756 1757 \returns A status code, \c B_OK on success or an error code. 1758 \retval B_OK The object now contains the requested data. 1759 \retval B_BAD_INDEX The \a index does not exist. 1760 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1761 1762 \see FindFloat(const char*, float*) const 1763 1764 \since BeOS R3 1765*/ 1766 1767 1768/*! 1769 \fn status_t BMessage::FindDouble(const char* name, double* value) const 1770 \brief Find a double at the label \a name. 1771 1772 This is an overloaded version of 1773 FindDouble(const char*, int32, double*) const 1774 where the data is sought at \a index \c 0. 1775 1776 \param name The label to which the data is associated. 1777 \param value The object in which the data should be copied. 1778 1779 \returns A status code, \c B_OK on success or an error code. 1780 \retval B_OK The object now contains the requested data. 1781 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1782 1783 \since BeOS R3 1784*/ 1785 1786 1787/*! 1788 \fn status_t BMessage::FindDouble(const char* name, int32 index, 1789 double* value) const 1790 \brief Find a double at the label \a name at an \a index. 1791 1792 This method looks for the data with the \c B_DOUBLE_TYPE, and copies it into 1793 a provided buffer. 1794 1795 \param name The label to which the data is associated. 1796 \param index The index from which the data should be copied. 1797 \param value The object in which the data should be copied. 1798 1799 \returns A status code, \c B_OK on success or an error code. 1800 \retval B_OK The object now contains the requested data. 1801 \retval B_BAD_INDEX The \a index does not exist. 1802 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1803 1804 \see FindDouble(const char*, double*) const 1805 1806 \since BeOS R3 1807*/ 1808 1809 1810/*! 1811 \fn status_t BMessage::FindPointer(const char* name, void** pointer) const 1812 \brief Find a pointer at the label \a name. 1813 1814 This is an overloaded version of 1815 FindPointer(const char*, int32, void*) const 1816 where the data is sought at \a index \c 0. 1817 1818 \param name The label to which the data is associated. 1819 \param pointer The object in which the data should be copied. 1820 1821 \returns A status code, \c B_OK on success or an error code. 1822 \retval B_OK The object now contains the requested data. 1823 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1824 1825 \since BeOS R3 1826*/ 1827 1828 1829/*! 1830 \fn status_t BMessage::FindPointer(const char* name, int32 index, 1831 void** pointer) const 1832 \brief Find a pointer at the label \a name at an \a index. 1833 1834 This method looks for the data with the \c B_POINTER_TYPE, and copies 1835 it into a provided buffer. 1836 1837 \warning If you want to share objects between applications, remember 1838 that each application has its own address space, and that it 1839 therefore is useless to try to pass around objects by sending 1840 pointers in messages. You should think about copying the entire 1841 object in the message, or you should consider using shared memory. 1842 1843 \param name The label to which the data is associated. 1844 \param index The index from which the data should be copied. 1845 \param pointer The object in which the data should be copied. 1846 1847 \returns A status code, \c B_OK on success or an error code. 1848 \retval B_OK The object now contains the requested data. 1849 \retval B_BAD_INDEX The \a index does not exist. 1850 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1851 1852 \see FindPointer(const char*, double*) const 1853 1854 \since BeOS R3 1855*/ 1856 1857 1858/*! 1859 \fn status_t BMessage::FindMessenger(const char* name, 1860 BMessenger* messenger) const 1861 \brief Find a messenger at the label \a name. 1862 1863 This is an overloaded version of 1864 FindMessenger(const char*, int32, BMessenger*) const 1865 where the data is sought at \a index \c 0. 1866 1867 \param name The label to which the data is associated. 1868 \param messenger The object in which the data should be copied. 1869 1870 \returns A status code, \c B_OK on success or an error code. 1871 \retval B_OK The object now contains the requested data. 1872 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1873 1874 \since BeOS R3 1875*/ 1876 1877 1878/*! 1879 \fn status_t BMessage::FindMessenger(const char* name, int32 index, 1880 BMessenger* messenger) const 1881 \brief Find a messenger at the label \a name at an \a index. 1882 1883 This method looks for the data with the \c B_MESSENGER_TYPE, and copies it 1884 into a provided buffer. 1885 1886 \param name The label to which the data is associated. 1887 \param index The index from which the data should be copied. 1888 \param messenger The object in which the data should be copied. 1889 1890 \returns A status code, \c B_OK on success or an error code. 1891 \retval B_OK The object now contains the requested data. 1892 \retval B_BAD_INDEX The \a index does not exist. 1893 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1894 1895 \see FindMessenger(const char*, BMessenger*) const 1896 1897 \since BeOS R3 1898*/ 1899 1900 1901/*! 1902 \fn status_t BMessage::FindRef(const char* name, entry_ref* ref) const 1903 \brief Find a reference to a file at the label \a name. 1904 1905 This is an overloaded version of 1906 FindRef(const char*, int32, entry_ref*) const 1907 where the data is sought at \a index \c 0. 1908 1909 \param name The label to which the data is associated. 1910 \param ref The object in which the data should be copied. 1911 1912 \returns A status code, \c B_OK on success or an error code. 1913 \retval B_OK The object now contains the requested data. 1914 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1915 1916 \since BeOS R3 1917*/ 1918 1919 1920/*! 1921 \fn status_t BMessage::FindRef(const char* name, int32 index, 1922 entry_ref* ref) const 1923 \brief Find a reference to a file at the label \a name at an 1924 \a index. 1925 1926 This method looks for the data with the \c B_REF_TYPE, and copies it into 1927 a provided buffer. 1928 1929 \param name The label to which the data is associated. 1930 \param index The index from which the data should be copied. 1931 \param ref The object in which the data should be copied. 1932 1933 \returns A status code, \c B_OK on success or an error code. 1934 \retval B_OK The object now contains the requested data. 1935 \retval B_BAD_INDEX The \a index does not exist. 1936 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1937 1938 \see FindRef(const char*, entry_ref*) const 1939 1940 \since BeOS R3 1941*/ 1942 1943 1944/*! 1945 \fn status_t BMessage::FindMessage(const char* name, 1946 BMessage* message) const 1947 \brief Find a message at the label \a name. 1948 1949 This is an overloaded version of 1950 FindMessage(const char*, int32, BMessage*) const 1951 where the data is sought at \a index \c 0. 1952 1953 \param name The label to which the data is associated. 1954 \param message The object in which the data should be copied. 1955 1956 \returns A status code, \c B_OK on success or an error code. 1957 \retval B_OK The object now contains the requested data. 1958 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1959 1960 \since BeOS R3 1961*/ 1962 1963 1964/*! 1965 \fn status_t BMessage::FindMessage(const char* name, int32 index, 1966 BMessage* message) const 1967 \brief Find a message at the label \a name at an \a index. 1968 1969 This method looks for the data with the \c B_MESSAGE_TYPE, and 1970 copies it into a provided buffer. 1971 1972 \param name The label to which the data is associated. 1973 \param index The index from which the data should be copied. 1974 \param message The object in which the data should be copied. 1975 1976 \returns A status code, \c B_OK on success or an error code. 1977 \retval B_OK The object now contains the requested data. 1978 \retval B_BAD_INDEX The \a index does not exist. 1979 \retval B_NAME_NOT_FOUND There is no field with this \a name. 1980 1981 \see FindMessage(const char*, BMessage*) const 1982 1983 \since BeOS R3 1984*/ 1985 1986 1987/*! 1988 \fn status_t BMessage::FindFlat(const char* name, 1989 BFlattenable* object) const 1990 \brief Find a flattened object at the label \a name. 1991 1992 This is an overloaded version of 1993 FindFlat(const char*, int32, BFlattenable*) const 1994 where the data is sought at \a index \c 0. 1995 1996 \param name The label to which the data is associated. 1997 \param object The object in which the data should be unflattened. 1998 1999 \returns A status code, \c B_OK on success or an error code. 2000 \retval B_OK The object now contains the requested data. 2001 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2002 2003 \since BeOS R3 2004*/ 2005 2006 2007/*! 2008 \fn status_t BMessage::FindFlat(const char* name, int32 index, 2009 BFlattenable* object) const 2010 \brief Find a flattened object at the label \a name at an 2011 \a index. 2012 2013 The type is determined by the type of the passed object. If that type is 2014 available at the specified label, then the Unflatten() method of that 2015 object will be called. 2016 2017 \param name The label to which the data is associated. 2018 \param index The index from which the data should be unflattened. 2019 \param object The object in which the data should be unflattened. 2020 2021 \returns A status code, \c B_OK on success or an error code. 2022 \retval B_OK The object now contains the requested data. 2023 \retval B_BAD_INDEX The \a index does not exist. 2024 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2025 2026 \see FindFlat(const char*, BFlattenable*) const 2027 2028 \since BeOS R3 2029*/ 2030 2031 2032//! @} 2033 2034 2035/*! 2036 \name Replacing Data 2037 2038 Look at ReplaceData() for a general introduction to replacing data. 2039*/ 2040 2041 2042//! @{ 2043 2044 2045/*! 2046 \fn status_t BMessage::ReplaceData(const char* name, type_code type, 2047 const void* data, ssize_t numBytes) 2048 \brief Replace the data at label \a name. 2049 2050 This method is an overloaded method that replaces the data at 2051 \a index \c 0. See 2052 ReplaceData(const char*, type_code, int32, const void*, ssize_t). 2053 2054 \param name The name associated with the data to replace. 2055 \param type The type of the data. 2056 \param data A pointer to the new data that needs to be copied into 2057 the message. 2058 \param numBytes The size of the new data. 2059 2060 \returns A status code, \c B_OK on success or an error code. 2061 2062 \since BeOS R3 2063*/ 2064 2065 2066/*! 2067 \fn status_t BMessage::ReplaceData(const char* name, type_code type, 2068 int32 index, const void* data, ssize_t numBytes) 2069 \brief Replace the data at label \a name at a specified 2070 \a index. 2071 2072 The conditions for replacing data are that the\a name is correct, 2073 the \a type matches and the data entry at \a index exists. 2074 2075 There is also a collection of convenience methods, that allow you to 2076 efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()), 2077 and so on. 2078 2079 \param name The name associated with the data to replace. 2080 \param type The type of the data. 2081 \param index The index in the array to replace. 2082 \param data A pointer to the new data that needs to be copied into 2083 the message. 2084 \param numBytes The size of the new data. 2085 2086 \returns A status code, \c B_OK on success or an error code. 2087 \retval B_OK The operation succeeded. 2088 \retval B_BAD_VALUE One of the input parameters are invalid. Check that 2089 you did not pass \c NULL, and in case the field has fixed sized 2090 data, check that \a numBytes is the same as the specified fixed 2091 size. 2092 \retval B_BAD_INDEX The \a index is out of range. 2093 2094 \since BeOS R3 2095*/ 2096 2097 2098/*! 2099 \fn status_t BMessage::ReplaceRect(const char* name, BRect aRect) 2100 \brief Replace a rectangle at the label \a name. 2101 2102 This method is an overloaded method of 2103 ReplaceRect(const char*, int32, BRect). 2104 It replaces the data at \a index \c 0. 2105 2106 \param name The name associated with the data to replace. 2107 \param aRect The object to store in the message. 2108 2109 \returns A status code, \c B_OK on success or an error code. 2110 \retval B_OK The object now contains the requested data. 2111 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2112 2113 \since BeOS R3 2114*/ 2115 2116 2117/*! 2118 \fn status_t BMessage::ReplaceRect(const char* name, int32 index, 2119 BRect aRect) 2120 \brief Replace a rectangle at the label \a name at a specified 2121 \a index. 2122 2123 The data at the specified \a name and \a index will be replaced, if it 2124 matches the \c B_RECT_TYPE. 2125 2126 \param name The name associated with the data to replace. 2127 \param index The index in the array to replace. 2128 \param aRect The object to store in the message. 2129 2130 \returns A status code, \c B_OK on success or an error code. 2131 \retval B_OK The operation succeeded. 2132 \retval B_BAD_INDEX The index was out of range. 2133 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2134 2135 \see ReplaceRect(const char*, BRect) 2136 2137 \since BeOS R3 2138*/ 2139 2140 2141/*! 2142 \fn status_t BMessage::ReplacePoint(const char* name, BPoint aPoint) 2143 \brief Replace a point at the label \a name. 2144 2145 This method is an overloaded method of 2146 ReplacePoint(const char*, int32, BPoint). 2147 It replaces the data at \a index \c 0. 2148 2149 \param name The name associated with the data to replace. 2150 \param aPoint The object to store in the message. 2151 2152 \returns A status code, \c B_OK on success or an error code. 2153 \retval B_OK The object now contains the requested data. 2154 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2155 2156 \since BeOS R3 2157*/ 2158 2159 2160/*! 2161 \fn status_t BMessage::ReplacePoint(const char* name, int32 index, 2162 BPoint aPoint) 2163 \brief Replace a point at the label \a name at a specified 2164 \a index. 2165 2166 The data at the specified \a name and \a index will be replaced, if it 2167 matches the \c B_POINT_TYPE. 2168 2169 \param name The name associated with the data to replace. 2170 \param index The index in the array to replace. 2171 \param aPoint The object to store in the message. 2172 2173 \returns A status code, \c B_OK on success or an error code. 2174 \retval B_OK The operation succeeded. 2175 \retval B_BAD_INDEX The index was out of range. 2176 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2177 2178 \see ReplacePoint(const char*, aPoint) 2179 2180 \since BeOS R3 2181*/ 2182 2183 2184/*! 2185 \fn status_t BMessage::ReplaceString(const char* name, const char* aString) 2186 \brief Replace a string at the label \a name. 2187 2188 This method is an overloaded method of 2189 ReplaceString(const char*, int32, const char*). 2190 It replaces the data at \a index \c 0. 2191 2192 \param name The name associated with the data to replace. 2193 \param aString The object to store in the message. 2194 2195 \returns A status code, \c B_OK on success or an error code. 2196 \retval B_OK The operation succeeded. 2197 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2198 2199 \since BeOS R3 2200*/ 2201 2202 2203/*! 2204 \fn status_t BMessage::ReplaceString(const char* name, int32 index, 2205 const char* aString) 2206 \brief Replace a string at the label \a name at a specified 2207 \a index. 2208 2209 The data at the specified \a name and \a index will be 2210 replaced, if it matches the \c B_STRING_TYPE. 2211 2212 \param name The name associated with the data to replace. 2213 \param index The index in the array to replace. 2214 \param aString The object to store in the message. 2215 2216 \returns A status code, \c B_OK on success or an error code. 2217 \retval B_OK The operation succeeded. 2218 \retval B_BAD_INDEX The index was out of range. 2219 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2220 2221 \see ReplaceString(const char*, const char*) 2222 2223 \since BeOS R3 2224*/ 2225 2226 2227/*! 2228 \fn status_t BMessage::ReplaceString(const char* name, 2229 const BString& aString) 2230 \brief Replace a string at the label \a name. 2231 2232 This method is an overloaded method of 2233 ReplaceString(const char*, int32, BString&). 2234 It replaces the data at \a index \c 0. 2235 2236 \param name The name associated with the data to replace. 2237 \param aString The object to store in the message. 2238 2239 \returns A status code, \c B_OK on success or an error code. 2240 \retval B_OK The operation succeeded. 2241 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2242 2243 \since BeOS R5 2244*/ 2245 2246 2247/*! 2248 \fn status_t BMessage::ReplaceString(const char* name, int32 index, 2249 const BString& aString) 2250 \brief Replace a string at the label \a name at a specified 2251 \a index. 2252 2253 The data at the specified \a name and \a index will be replaced, if it 2254 matches the \c B_STRING_TYPE. 2255 2256 \param name The name associated with the data to replace. 2257 \param index The index in the array to replace. 2258 \param aString The object to store in the message. 2259 2260 \returns A status code, \c B_OK on success or an error code. 2261 \retval B_OK The operation succeeded. 2262 \retval B_BAD_INDEX The index was out of range. 2263 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2264 2265 \see ReplaceString(const char*, BString&) 2266 2267 \since BeOS R5 2268*/ 2269 2270 2271/*! 2272 \fn status_t BMessage::ReplaceInt8(const char* name, int8 value) 2273 \brief Replace an integer at the label \a name. 2274 2275 This method is an overloaded method of 2276 ReplaceInt8(const char*, int32, int8). 2277 It replaces the data at \a index \c 0. 2278 2279 \param name The name associated with the data to replace. 2280 \param value Where to store in the message. 2281 2282 \returns A status code, \c B_OK on success or an error code. 2283 \retval B_OK The operation succeeded. 2284 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2285 2286 \since BeOS R3 2287*/ 2288 2289 2290/*! 2291 \fn status_t BMessage::ReplaceInt8(const char* name, int32 index, 2292 int8 value) 2293 \brief Replace an integer at the label \a name at a specified 2294 \a index. 2295 2296 The data at the specified \a name and \a index will be replaced, if it 2297 matches the \c B_INT8_TYPE. 2298 2299 \param name The name associated with the data to replace. 2300 \param index The index in the array to replace. 2301 \param value Where to store in the message. 2302 2303 \returns A status code, \c B_OK on success or an error code. 2304 \retval B_OK The operation succeeded. 2305 \retval B_BAD_INDEX The index was out of range. 2306 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2307 2308 \see ReplaceInt8(const char*, int8) 2309 2310 \since BeOS R3 2311*/ 2312 2313 2314/*! 2315 \fn status_t BMessage::ReplaceInt16(const char* name, int16 value) 2316 \brief Replace an integer at the label \a name. 2317 2318 This method is an overloaded method of 2319 ReplaceInt16(const char*, int32, int16). 2320 It replaces the data at \a index \c 0. 2321 2322 \param name The name associated with the data to replace. 2323 \param value Where to store in the message. 2324 2325 \returns A status code, \c B_OK on success or an error code. 2326 \retval B_OK The operation succeeded. 2327 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2328 2329 \since BeOS R3 2330*/ 2331 2332 2333/*! 2334 \fn status_t BMessage::ReplaceInt16(const char* name, int32 index, 2335 int16 value) 2336 \brief Replace an integer at the label \a name at a specified 2337 \a index. 2338 2339 The data at the specified \a name and \a index will be replaced, if it 2340 matches the \c B_INT16_TYPE. 2341 2342 \param name The name associated with the data to replace. 2343 \param index The index in the array to replace. 2344 \param value Where to store in the message. 2345 2346 \returns A status code, \c B_OK on success or an error code. 2347 \retval B_OK The operation succeeded. 2348 \retval B_BAD_INDEX The index was out of range. 2349 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2350 2351 \see ReplaceInt16(const char*, int16) 2352 2353 \since BeOS R3 2354*/ 2355 2356 2357/*! 2358 \fn status_t BMessage::ReplaceInt32(const char* name, int32 value) 2359 \brief Replace an integer at the label \a name. 2360 2361 This method is an overloaded method of 2362 ReplaceInt8(const char*, int32, int32). 2363 It replaces the data at \a index \c 0. 2364 2365 \param name The name associated with the data to replace. 2366 \param value Where to store in the message. 2367 2368 \returns A status code, \c B_OK on success or an error code. 2369 \retval B_OK The operation succeeded. 2370 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2371 2372 \since BeOS R3 2373*/ 2374 2375 2376/*! 2377 \fn status_t BMessage::ReplaceInt32(const char* name, int32 index, 2378 int32 value) 2379 \brief Replace an integer at the label \a name at a specified 2380 \a index. 2381 2382 The data at the specified \a name and \a index will be replaced, if it 2383 matches the \c B_INT32_TYPE. 2384 2385 \param name The name associated with the data to replace. 2386 \param index The index in the array to replace. 2387 \param value The object to store in the message. 2388 2389 \returns A status code, \c B_OK on success or an error code. 2390 \retval B_OK The operation succeeded. 2391 \retval B_BAD_INDEX The index was out of range. 2392 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2393 2394 \see ReplaceInt32(const char*, int32) 2395 2396 \since BeOS R3 2397*/ 2398 2399 2400/*! 2401 \fn status_t BMessage::ReplaceInt64(const char* name, int64 value) 2402 \brief Replace an integer at the label \a name. 2403 2404 This method is an overloaded method of 2405 ReplaceInt8(const char*, int32, int64). 2406 It replaces the data at \a index \c 0. 2407 2408 \param name The name associated with the data to replace. 2409 \param value Where to store in the message. 2410 2411 \returns A status code, \c B_OK on success or an error code. 2412 \retval B_OK The operation succeeded. 2413 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2414 2415 \since BeOS R3 2416*/ 2417 2418 2419/*! 2420 \fn status_t BMessage::ReplaceInt64(const char* name, int32 index, 2421 int64 value) 2422 \brief Replace an integer at the label \a name at a specified 2423 \a index. 2424 2425 The data at the specified \a name and \a index will be replaced, if it 2426 matches the \c B_INT64_TYPE. 2427 2428 \param name The name associated with the data to replace. 2429 \param index The index in the array to replace. 2430 \param value The object to store in the message. 2431 2432 \returns A status code, \c B_OK on success or an error code. 2433 \retval B_OK The operation succeeded. 2434 \retval B_BAD_INDEX The index was out of range. 2435 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2436 2437 \see ReplaceInt64(const char*, int64) 2438 2439 \since BeOS R3 2440*/ 2441 2442 2443/*! 2444 \fn status_t BMessage::ReplaceBool(const char* name, bool aBoolean) 2445 \brief Replace a boolean at the label \a name. 2446 2447 This method is an overloaded method of 2448 ReplaceBool(const char*, int32, bool). 2449 It replaces the data at \a index \c 0. 2450 2451 \param name The name associated with the data to replace. 2452 \param aBoolean Where to store in the message. 2453 2454 \returns A status code, \c B_OK on success or an error code. 2455 \retval B_OK The operation succeeded. 2456 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2457 2458 \since BeOS R3 2459*/ 2460 2461 2462/*! 2463 \fn status_t BMessage::ReplaceBool(const char* name, int32 index, 2464 bool aBoolean) 2465 \brief Replace a boolean at the label \a name at a specified 2466 \a index. 2467 2468 The data at the specified \a name and \a index will be replaced, if it 2469 matches the \c B_BOOL_TYPE. 2470 2471 \param name The name associated with the data to replace. 2472 \param index The index in the array to replace. 2473 \param aBoolean Where to store in the message. 2474 2475 \returns A status code, \c B_OK on success or an error code. 2476 \retval B_OK The operation succeeded. 2477 \retval B_BAD_INDEX The index was out of range. 2478 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2479 2480 \see ReplaceBool(const char*, bool) 2481 2482 \since BeOS R5 2483*/ 2484 2485 2486/*! 2487 \fn status_t BMessage::ReplaceFloat(const char* name, float aFloat) 2488 \brief Replace a float at the label \a name. 2489 2490 This method is an overloaded method of 2491 ReplaceFloat(const char*, int32, float). 2492 It replaces the data at \a index \c 0. 2493 2494 \param name The name associated with the data to replace. 2495 \param aFloat The object to store in the message. 2496 2497 \returns A status code, \c B_OK on success or an error code. 2498 \retval B_OK The operation succeeded. 2499 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2500 2501 \since BeOS R3 2502*/ 2503 2504 2505/*! 2506 \fn status_t BMessage::ReplaceFloat(const char* name, int32 index, 2507 float aFloat) 2508 \brief Replace a float at the label \a name at a specified 2509 \a index. 2510 2511 The data at the specified \a name and \a index will be replaced, if it 2512 matches the \c B_FLOAT_TYPE. 2513 2514 \param name The name associated with the data to replace. 2515 \param index The index in the array to replace. 2516 \param aFloat The object to store in the message. 2517 2518 \returns A status code, \c B_OK on success or an error code. 2519 \retval B_OK The operation succeeded. 2520 \retval B_BAD_INDEX The index was out of range. 2521 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2522 2523 \see ReplaceFloat(const char*, float) 2524 2525 \since BeOS R3 2526*/ 2527 2528 2529/*! 2530 \fn status_t BMessage::ReplaceDouble(const char* name, double aDouble) 2531 \brief Replace a double at the label \a name. 2532 2533 This method is an overloaded method of 2534 ReplaceDouble(const char*, int32, double). 2535 It replaces the data at \a index \c 0. 2536 2537 \param name The name associated with the data to replace. 2538 \param aDouble Where to store in the message. 2539 2540 \returns A status code, \c B_OK on success or an error code. 2541 \retval B_OK The operation succeeded. 2542 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2543 2544 \since BeOS R3 2545*/ 2546 2547 2548/*! 2549 \fn status_t BMessage::ReplaceDouble(const char* name, int32 index, 2550 double aDouble) 2551 \brief Replace a double at the label \a name at a specified 2552 \a index. 2553 2554 The data at the specified \a name and \a index will be replaced, if it 2555 matches the \c B_DOUBLE_TYPE. 2556 2557 \param name The name associated with the data to replace. 2558 \param index The index in the array to replace. 2559 \param aDouble Where to store in the message. 2560 2561 \returns A status code, \c B_OK on success or an error code. 2562 \retval B_OK The operation succeeded. 2563 \retval B_BAD_INDEX The index was out of range. 2564 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2565 2566 \see ReplaceDouble(const char*, double) 2567 2568 \since BeOS R3 2569*/ 2570 2571 2572/*! 2573 \fn status_t BMessage::ReplacePointer(const char* name, 2574 const void* pointer) 2575 \brief Replace a pointer at the label \a name. 2576 2577 This method is an overloaded method of 2578 ReplacePointer(const char*, int32, const void*). 2579 It replaces the data at \a index \c 0. 2580 2581 \param name The name associated with the data to replace. 2582 \param pointer Where to store in the message. 2583 2584 \returns A status code, \c B_OK on success or an error code. 2585 \retval B_OK The operation succeeded. 2586 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2587 2588 \since BeOS R3 2589*/ 2590 2591 2592/*! 2593 \fn status_t BMessage::ReplacePointer(const char* name, int32 index, 2594 const void* pointer) 2595 \brief Replace a pointer at the label \a name at a specified \a index. 2596 2597 The data at the specified \a name and \a index will be replaced, if it 2598 matches the \c B_POINTER_TYPE. 2599 2600 \param name The name associated with the data to replace. 2601 \param index The index in the array to replace. 2602 \param pointer Where to store in the message. 2603 2604 \returns A status code, \c B_OK on success or an error code. 2605 \retval B_OK The operation succeeded. 2606 \retval B_BAD_INDEX The index was out of range. 2607 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2608 2609 \see ReplacePointer(const char*, const void*) 2610 2611 \since BeOS R3 2612*/ 2613 2614 2615/*! 2616 \fn status_t BMessage::ReplaceMessenger(const char* name, 2617 BMessenger messenger) 2618 \brief Replace a messenger at the label \a name. 2619 2620 This method is an overloaded method of 2621 ReplaceMessenger(const char*, int32, BMessenger). 2622 It replaces the data at \a index \c 0. 2623 2624 \param name The name associated with the data to replace. 2625 \param messenger The object to store in the message. 2626 2627 \returns A status code, \c B_OK on success or an error code. 2628 \retval B_OK The operation succeeded. 2629 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2630 2631 \since BeOS R3 2632*/ 2633 2634 2635/*! 2636 \fn status_t BMessage::ReplaceMessenger(const char* name, int32 index, 2637 BMessenger messenger) 2638 \brief Replace a messenger at the label \a name at a specified 2639 \a index. 2640 2641 The data at the specified \a name and \a index will be replaced, if it 2642 matches the \c B_MESSENGER_TYPE. 2643 2644 \param name The name associated with the data to replace. 2645 \param index The index in the array to replace. 2646 \param messenger The object to store in the message. 2647 2648 \returns A status code, \c B_OK on success or an error code. 2649 \retval B_OK The operation succeeded. 2650 \retval B_BAD_INDEX The index was out of range. 2651 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2652 2653 \see ReplaceMessenger(const char*, BMessenger) 2654 2655 \since BeOS R3 2656*/ 2657 2658 2659/*! 2660 \fn status_t BMessage::ReplaceRef(const char* name, const entry_ref* ref) 2661 \brief Replace a reference to a file at the label \a name. 2662 2663 This method is an overloaded method of 2664 ReplaceRef(const char*, int32, entry_ref*). 2665 It replaces the data at \a index \c 0. 2666 2667 \param name The name associated with the data to replace. 2668 \param ref The object to store in the message. 2669 2670 \returns A status code, \c B_OK on success or an error code. 2671 \retval B_OK The operation succeeded. 2672 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2673 2674 \since BeOS R3 2675*/ 2676 2677 2678/*! 2679 \fn status_t BMessage::ReplaceRef(const char* name, int32 index, 2680 const entry_ref* ref) 2681 \brief Replace a reference to a file at the label \a name at a 2682 specified \a index. 2683 2684 The data at the specified \a name and \a index will be replaced, if it 2685 matches the \c B_REF_TYPE. 2686 2687 \param name The name associated with the data to replace. 2688 \param index The index in the array to replace. 2689 \param ref The object to store in the message. 2690 2691 \returns A status code, \c B_OK on success or an error code. 2692 \retval B_OK The operation succeeded. 2693 \retval B_BAD_INDEX The index was out of range. 2694 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2695 2696 \see ReplaceRef(const char*, entry_ref*) 2697 2698 \since BeOS R3 2699*/ 2700 2701 2702/*! 2703 \fn status_t BMessage::ReplaceMessage(const char* name, 2704 const BMessage* message) 2705 \brief Replace a message at the label \a name. 2706 2707 This method is an overloaded method of 2708 ReplaceMessage(const char*, int32, BMessage*). 2709 It replaces the data at \a index \c 0. 2710 2711 \param name The name associated with the data to replace. 2712 \param message The object to store in the message. 2713 2714 \returns A status code, \c B_OK on success or an error code. 2715 \retval B_OK The operation succeeded. 2716 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2717 2718 \since BeOS R3 2719*/ 2720 2721 2722/*! 2723 \fn status_t BMessage::ReplaceMessage(const char* name, int32 index, 2724 const BMessage* message) 2725 \brief Replace a message at the label \a name at a specified 2726 \a index. 2727 2728 The data at the specified \a name and \a index will be replaced, if it 2729 matches the \c B_MESSAGE_TYPE. 2730 2731 \param name The name associated with the data to replace. 2732 \param index The index in the array to replace. 2733 \param message The object to store in the message. 2734 2735 \returns A status code, \c B_OK on success or an error code. 2736 \retval B_OK The operation succeeded. 2737 \retval B_BAD_INDEX The index was out of range. 2738 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2739 2740 \see ReplaceMessage(const char*, BMessage*) 2741 2742 \since BeOS R3 2743*/ 2744 2745 2746/*! 2747 \fn status_t BMessage::ReplaceFlat(const char* name, BFlattenable* object) 2748 \brief Replace a flattened object at the label \a name. 2749 2750 This method is an overloaded method of 2751 ReplaceFlat(const char*, int32, BFlattenable*). 2752 2753 It replaces the data at \a index \c 0. 2754 2755 \param name The name associated with the data to replace. 2756 \param object The object to store in the message. 2757 2758 \returns A status code, \c B_OK on success or an error code. 2759 \retval B_OK The operation succeeded. 2760 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2761 2762 \since BeOS R3 2763*/ 2764 2765 2766/*! 2767 \fn status_t BMessage::ReplaceFlat(const char* name, int32 index, 2768 BFlattenable* object) 2769 \brief Replace a flattened object at the label \a name at a 2770 specified \a index. 2771 2772 The data at the specified \a name and \a index will be 2773 replaced, if it matches the type returned by your object. This method uses 2774 BFlattenable::TypeCode() to determine the type of the object. 2775 2776 \param name The name associated with the data to replace. 2777 \param index The index in the array to replace. 2778 \param object The object to store in the message. 2779 2780 \returns A status code, \c B_OK on success or an error code. 2781 \retval B_OK The operation succeeded. 2782 \retval B_BAD_INDEX The index was out of range. 2783 \retval B_NAME_NOT_FOUND There is no field with this \a name. 2784 2785 \see ReplaceFlat(const char*, BFlattenable*) 2786 2787 \since BeOS R3 2788*/ 2789 2790 2791//! @} 2792 2793 2794/*! 2795 \name Operators 2796 2797 The new and delete operators are deprecated and are only provided for 2798 backwards compatibility. 2799*/ 2800 2801 2802//! @{ 2803 2804 2805/*! 2806 \fn BMessage& BMessage::operator=(const BMessage& other) 2807 \brief Copy one message into another. 2808 2809 See the copy constructor, BMessage(const BMessage& other), for details on 2810 what is copied, and what isn't. 2811 2812 \since BeOS R3 2813*/ 2814 2815 2816/*! 2817 \fn void* BMessage::operator new(size_t size) 2818 \brief Allocates \a size bytes of memory for a BMessage. 2819 2820 \warning This method is deprecated, do not use. 2821 2822 \since BeOS R3 2823*/ 2824 2825 2826/*! 2827 \fn void* BMessage::operator new(size_t, void* pointer) 2828 \brief Allocates \a size bytes of memory for a BMessage. 2829 2830 \warning This method is deprecated, do not use. 2831 2832 \since BeOS R3 2833*/ 2834 2835 2836/*! 2837 \fn void BMessage::operator delete(void* pointer, size_t size) 2838 \brief Frees memory allocated by new. 2839 2840 \warning This method is deprecated, do not use. 2841 2842 \since BeOS R5 2843*/ 2844 2845 2846//! @} 2847 2848 2849/*! 2850 \name Deprecated Methods 2851 2852 These methods are likely to disappear as they have been replaced by safer 2853 and more powerful methods but are implemented for the purpose of binary 2854 compatibility. 2855*/ 2856 2857 2858//! @{ 2859 2860 2861/*! 2862 \fn bool BMessage::HasRect(const char*, int32) const 2863 \brief Deprecated. 2864 2865 \warning This method is deprecated, do not use. 2866 2867 \since BeOS R3 2868*/ 2869 2870 2871/*! 2872 \fn bool BMessage::HasPoint(const char*, int32) const 2873 \brief Deprecated. 2874 2875 \warning This method is deprecated, do not use. 2876 2877 \since BeOS R3 2878*/ 2879 2880 2881/*! 2882 \fn bool BMessage::HasString(const char*, int32) const 2883 \brief Deprecated. 2884 2885 \warning This method is deprecated, do not use. 2886 2887 \since BeOS R3 2888*/ 2889 2890 2891/*! 2892 \fn bool BMessage::HasInt8(const char*, int32) const 2893 \brief Deprecated. 2894 2895 \warning This method is deprecated, do not use. 2896 2897 \since BeOS R3 2898*/ 2899 2900 2901/*! 2902 \fn bool BMessage::HasInt16(const char*, int32) const 2903 \brief Deprecated. 2904 2905 \warning This method is deprecated, do not use. 2906 2907 \since BeOS R3 2908*/ 2909 2910 2911/*! 2912 \fn bool BMessage::HasInt32(const char*, int32) const 2913 \brief Deprecated. 2914 2915 \warning This method is deprecated, do not use. 2916 2917 \since BeOS R3 2918*/ 2919 2920 2921/*! 2922 \fn bool BMessage::HasInt64(const char*, int32) const 2923 \brief Deprecated. 2924 2925 \warning This method is deprecated, do not use. 2926 2927 \since BeOS R3 2928*/ 2929 2930 2931/*! 2932 \fn bool BMessage::HasBool(const char*, int32) const 2933 \brief Deprecated. 2934 2935 \warning This method is deprecated, do not use. 2936 2937 \since BeOS R3 2938*/ 2939 2940 2941/*! 2942 \fn bool BMessage::HasFloat(const char*, int32) const 2943 \brief Deprecated. 2944 2945 \warning This method is deprecated, do not use. 2946 2947 \since BeOS R3 2948*/ 2949 2950 2951/*! 2952 \fn bool BMessage::HasDouble(const char*, int32) const 2953 \brief Deprecated. 2954 2955 \warning This method is deprecated, do not use. 2956 2957 \since BeOS R3 2958*/ 2959 2960 2961/*! 2962 \fn bool BMessage::HasPointer(const char*, int32) const 2963 \brief Deprecated. 2964 2965 \warning This method is deprecated, do not use. 2966 2967 \since BeOS R3 2968*/ 2969 2970 2971/*! 2972 \fn bool BMessage::HasMessenger(const char*, int32) const 2973 \brief Deprecated. 2974 2975 \warning This method is deprecated, do not use. 2976 2977 \since BeOS R3 2978*/ 2979 2980 2981/*! 2982 \fn bool BMessage::HasRef(const char*, int32) const 2983 \brief Deprecated. 2984 2985 \warning This method is deprecated, do not use. 2986 2987 \since BeOS R3 2988*/ 2989 2990 2991/*! 2992 \fn bool BMessage::HasMessage(const char*, int32) const 2993 \brief Deprecated. 2994 2995 \warning This method is deprecated, do not use. 2996 2997 \since BeOS R3 2998*/ 2999 3000 3001/*! 3002 \fn bool BMessage::HasFlat(const char*, const BFlattenable*) const 3003 \brief Deprecated. 3004 3005 \warning This method is deprecated, do not use. 3006 3007 \since BeOS R3 3008*/ 3009 3010 3011/*! 3012 \fn bool BMessage::HasFlat(const char*, int32, const BFlattenable*) const 3013 \brief Deprecated. 3014 3015 \warning This method is deprecated, do not use. 3016 3017 \since BeOS R3 3018*/ 3019 3020 3021/*! 3022 \fn bool BMessage::HasData(const char*, type_code, int32) const 3023 \brief Deprecated. 3024 3025 \warning This method is deprecated, do not use. 3026 3027 \since BeOS R3 3028*/ 3029 3030 3031/*! 3032 \fn BRect BMessage::FindRect(const char*, int32) const 3033 \brief Deprecated. 3034 3035 \warning This method is deprecated, do not use. 3036 3037 \since BeOS R3 3038*/ 3039 3040 3041/*! 3042 \fn BPoint BMessage::FindPoint(const char*, int32) const 3043 \brief Deprecated. 3044 3045 \warning This method is deprecated, do not use. 3046 3047 \since BeOS R3 3048*/ 3049 3050 3051/*! 3052 \fn const char* BMessage::FindString(const char*, int32) const 3053 \brief Deprecated. 3054 3055 \warning This method is deprecated, do not use. 3056 3057 \since BeOS R3 3058*/ 3059 3060 3061/*! 3062 \fn int8 BMessage::FindInt8(const char*, int32) const 3063 \brief Deprecated. 3064 3065 \warning This method is deprecated, do not use. 3066 3067 \since BeOS R3 3068*/ 3069 3070 3071/*! 3072 \fn int16 BMessage::FindInt16(const char*, int32) const 3073 \brief Deprecated. 3074 3075 \warning This method is deprecated, do not use. 3076 3077 \since BeOS R3 3078*/ 3079 3080 3081/*! 3082 \fn int32 BMessage::FindInt32(const char*, int32) const 3083 \brief Deprecated. 3084 3085 \warning This method is deprecated, do not use. 3086 3087 \since BeOS R3 3088*/ 3089 3090 3091/*! 3092 \fn int64 BMessage::FindInt64(const char*, int32) const 3093 \brief Deprecated. 3094 3095 \warning This method is deprecated, do not use. 3096 3097 \since BeOS R3 3098*/ 3099 3100 3101/*! 3102 \fn bool BMessage::FindBool(const char*, int32) const 3103 \brief Deprecated. 3104 3105 \warning This method is deprecated, do not use. 3106 3107 \since BeOS R3 3108*/ 3109 3110 3111/*! 3112 \fn float BMessage::FindFloat(const char*, int32) const 3113 \brief Deprecated. 3114 3115 \warning This method is deprecated, do not use. 3116 3117 \since BeOS R3 3118*/ 3119 3120 3121/*! 3122 \fn double BMessage::FindDouble(const char*, int32) const 3123 \brief Deprecated. 3124 3125 \warning This method is deprecated, do not use. 3126 3127 \since BeOS R3 3128*/ 3129 3130 3131//! @} 3132 3133 3134/*! 3135 \name Finding Data Convenience Methods 3136 3137 These methods may be used as alternatives to the Find data methods above 3138 which allow you to specify a default value to use if the value you are 3139 looking for is not found and return the result instead of filling out an 3140 out parameter and status code. If you are not interested in the status code 3141 these methods allow for some code simplification. 3142 3143 For example, instead of writing: 3144 3145\code 3146bool enabled; 3147if (FindBool("enabled", &enabled) != B_OK) 3148 enabled = false; 3149\endcode 3150 3151 you can write the following: 3152 3153\code 3154bool enabled = GetBool("enabled", false); 3155\endcode 3156 3157 reducing the example to a single line. 3158*/ 3159 3160 3161//! @{ 3162 3163 3164/*! 3165 \fn bool BMessage::GetBool(const char* name, bool defaultValue) const 3166 \brief Return the boolean value from message with \a name, or 3167 \a defaultValue if not found. 3168 3169 \param name The name of the item to retrieve. 3170 \param defaultValue The value to use if the item specified by \a name 3171 is not found. 3172 3173 \return The item with \a name, or \a defaultValue if not found. 3174 3175 \since Haiku R1 3176*/ 3177 3178 3179/*! 3180 \fn bool BMessage::GetBool(const char* name, int32 index, 3181 bool defaultValue) const 3182 \brief Return the boolean value from message with \a name and \a index, or 3183 \a defaultValue if not found. 3184 3185 \param name The name of the item to retrieve. 3186 \param index The index of the item to retrieve if there is more than one. 3187 \param defaultValue The value to use if the item specified by \a name 3188 is not found. 3189 3190 \return The item with \a name, or \a defaultValue if not found. 3191 3192 \since Haiku R1 3193*/ 3194 3195 3196/*! 3197 \fn int8 BMessage::GetInt8(const char* name, int8 defaultValue) const 3198 \brief Return the int8 value from message with \a name, or \a defaultValue 3199 if not found. 3200 3201 \param name The name of the item to retrieve. 3202 \param defaultValue The value to use if the item specified by \a name 3203 is not found. 3204 3205 \return The item with \a name, or \a defaultValue if not found. 3206 3207 \since Haiku R1 3208*/ 3209 3210 3211/*! 3212 \fn int8 BMessage::GetInt8(const char* name, int32 index, 3213 int8 defaultValue) const 3214 \brief Return the int8 value from message with \a name and \a index, or 3215 \a defaultValue if not found. 3216 3217 \param name The name of the item to retrieve. 3218 \param index The index of the item to retrieve if there is more than one. 3219 \param defaultValue The value to use if the item specified by \a name 3220 is not found. 3221 3222 \return The item with \a name, or \a defaultValue if not found. 3223 3224 \since Haiku R1 3225*/ 3226 3227 3228/*! 3229 \fn uint8 BMessage::GetUInt8(const char* name, uint8 defaultValue) const 3230 \brief Return the uint8 value from message with \a name, or \a defaultValue 3231 if not found. 3232 3233 \param name The name of the item to retrieve. 3234 \param defaultValue The value to use if the item specified by \a name 3235 is not found. 3236 3237 \return The item with \a name, or \a defaultValue if not found. 3238 3239 \since Haiku R1 3240*/ 3241 3242 3243/*! 3244 \fn uint8 BMessage::GetUInt8(const char* name, int32 index, 3245 uint8 defaultValue) const 3246 \brief Return the uint8 message from message with \a name and \a index, or 3247 \a defaultValue if not found. 3248 3249 \param name The name of the item to retrieve. 3250 \param index The index of the item to retrieve if there is more than one. 3251 \param defaultValue The value to use if the item specified by \a name 3252 is not found. 3253 3254 \return The item with \a name, or \a defaultValue if not found. 3255 3256 \since Haiku R1 3257*/ 3258 3259 3260/*! 3261 \fn int16 BMessage::GetInt16(const char* name, int16 defaultValue) const 3262 \brief Return the int16 value from message with \a name, or \a defaultValue 3263 if not found. 3264 3265 \param name The name of the item to retrieve. 3266 \param defaultValue The value to use if the item specified by \a name 3267 is not found. 3268 3269 \return The item with \a name, or \a defaultValue if not found. 3270 3271 \since Haiku R1 3272*/ 3273 3274 3275/*! 3276 \fn int16 BMessage::GetInt16(const char* name, int32 index, 3277 int16 defaultValue) const 3278 \brief Return the int16 value from message with \a name and \a index, or 3279 \a defaultValue if not found. 3280 3281 \param name The name of the item to retrieve. 3282 \param index The index of the item to retrieve if there is more than one. 3283 \param defaultValue The value to use if the item specified by \a name 3284 is not found. 3285 3286 \return The item with \a name, or \a defaultValue if not found. 3287 3288 \since Haiku R1 3289*/ 3290 3291 3292/*! 3293 \fn uint16 BMessage::GetUInt16(const char* name, uint16 defaultValue) const 3294 \brief Return the uint16 value from message with \a name, or 3295 \a defaultValue if not found. 3296 3297 \param name The name of the item to retrieve. 3298 \param defaultValue The value to use if the item specified by \a name 3299 is not found. 3300 3301 \return The item with \a name, or \a defaultValue if not found. 3302 3303 \since Haiku R1 3304*/ 3305 3306 3307/*! 3308 \fn uint16 BMessage::GetUInt16(const char* name, int32 index, 3309 uint16 defaultValue) const 3310 \brief Return the uint16 value from message with \a name and \a index, or 3311 \a defaultValue if not found. 3312 3313 \param name The name of the item to retrieve. 3314 \param index The index of the item to retrieve if there is more than one. 3315 \param defaultValue The value to use if the item specified by \a name 3316 is not found. 3317 3318 \return The item with \a name, or \a defaultValue if not found. 3319 3320 \since Haiku R1 3321*/ 3322 3323 3324/*! 3325 \fn int32 BMessage::GetInt32(const char* name, int32 defaultValue) const 3326 \brief Return the int32 value from message with \a name, or \a defaultValue 3327 if not found. 3328 3329 \param name The name of the item to retrieve. 3330 \param defaultValue The value to use if the item specified by \a name 3331 is not found. 3332 3333 \return The item with \a name, or \a defaultValue if not found. 3334 3335 \since Haiku R1 3336*/ 3337 3338 3339/*! 3340 \fn int32 BMessage::GetInt32(const char* name, int32 index, 3341 int32 defaultValue) const 3342 \brief Return the int32 value from message with \a name and \a index, or 3343 \a defaultValue if not found. 3344 3345 \param name The name of the item to retrieve. 3346 \param index The index of the item to retrieve if there is more than one. 3347 \param defaultValue The value to use if the item specified by \a name 3348 is not found. 3349 3350 \return The item with \a name, or \a defaultValue if not found. 3351 3352 \since Haiku R1 3353*/ 3354 3355 3356/*! 3357 \fn uint32 BMessage::GetUInt32(const char* name, uint32 defaultValue) const 3358 \brief Return the uint32 value from message with \a name, or 3359 \a defaultValue if not found. 3360 3361 \param name The name of the item to retrieve. 3362 \param defaultValue The value to use if the item specified by \a name 3363 is not found. 3364 3365 \return The item with \a name, or \a defaultValue if not found. 3366 3367 \since Haiku R1 3368*/ 3369 3370 3371/*! 3372 \fn uint32 BMessage::GetUInt32(const char* name, int32 index, 3373 uint32 defaultValue) const 3374 \brief Return the uint32 value from message with \a name and \a index, or 3375 \a defaultValue if not found. 3376 3377 \param name The name of the item to retrieve. 3378 \param index The index of the item to retrieve if there is more than one. 3379 \param defaultValue The value to use if the item specified by \a name 3380 is not found. 3381 3382 \return The item with \a name, or \a defaultValue if not found. 3383 3384 \since Haiku R1 3385*/ 3386 3387 3388/*! 3389 \fn int64 BMessage::GetInt64(const char* name, int64 defaultValue) const 3390 \brief Return the int64 value from message with \a name, or \a defaultValue 3391 if not found. 3392 3393 \param name The name of the item to retrieve. 3394 \param defaultValue The value to use if the item specified by \a name 3395 is not found. 3396 3397 \return The item with \a name, or \a defaultValue if not found. 3398 3399 \since Haiku R1 3400*/ 3401 3402 3403/*! 3404 \fn int64 BMessage::GetInt64(const char* name, int32 index, 3405 int64 defaultValue) const 3406 \brief Return the int64 value from message with \a name and \a index, or 3407 \a defaultValue if not found. 3408 3409 \param name The name of the item to retrieve. 3410 \param index The index of the item to retrieve if there is more than one. 3411 \param defaultValue The value to use if the item specified by \a name 3412 is not found. 3413 3414 \return The item with \a name, or \a defaultValue if not found. 3415 3416 \since Haiku R1 3417*/ 3418 3419 3420/*! 3421 \fn uint64 BMessage::GetUInt64(const char* name, uint64 defaultValue) const 3422 \brief Return the uint64 value from message with \a name, or 3423 \a defaultValue if not found. 3424 3425 \param name The name of the item to retrieve. 3426 \param defaultValue The value to use if the item specified by \a name 3427 is not found. 3428 3429 \return The item with \a name, or \a defaultValue if not found. 3430 3431 \since Haiku R1 3432*/ 3433 3434 3435/*! 3436 \fn uint64 BMessage::GetUInt64(const char* name, int32 index, 3437 uint64 defaultValue) const 3438 \brief Return the uint64 value from message with \a name and \a index, or 3439 \a defaultValue if not found. 3440 3441 \param name The name of the item to retrieve. 3442 \param index The index of the item to retrieve if there is more than one. 3443 \param defaultValue The value to use if the item specified by \a name 3444 is not found. 3445 3446 \return The item with \a name, or \a defaultValue if not found. 3447 3448 \since Haiku R1 3449*/ 3450 3451 3452/*! 3453 \fn float BMessage::GetFloat(const char* name, float defaultValue) const 3454 \brief Return the float value from message with \a name, or \a defaultValue 3455 if not found. 3456 3457 \param name The name of the item to retrieve. 3458 \param defaultValue The value to use if the item specified by \a name 3459 is not found. 3460 3461 \return The item with \a name, or \a defaultValue if not found. 3462 3463 \since Haiku R1 3464*/ 3465 3466 3467/*! 3468 \fn float BMessage::GetFloat(const char* name, int32 index, 3469 float defaultValue) const 3470 \brief Return the float value from message with \a name and \a index, or 3471 \a defaultValue if not found. 3472 3473 \param name The name of the item to retrieve. 3474 \param index The index of the item to retrieve if there is more than one. 3475 \param defaultValue The value to use if the item specified by \a name 3476 is not found. 3477 3478 \return The item with \a name, or \a defaultValue if not found. 3479 3480 \since Haiku R1 3481*/ 3482 3483 3484/*! 3485 \fn double BMessage::GetDouble(const char* name, double defaultValue) const 3486 \brief Return the double value from message with \a name, or 3487 \a defaultValue if not found. 3488 3489 \param name The name of the item to retrieve. 3490 \param defaultValue The value to use if the item specified by \a name 3491 is not found. 3492 3493 \return The item with \a name, or \a defaultValue if not found. 3494 3495 \since Haiku R1 3496*/ 3497 3498 3499/*! 3500 \fn double BMessage::GetDouble(const char* name, int32 index, 3501 double defaultValue) const 3502 \brief Return the double value from message with \a name and \a index, or 3503 \a defaultValue if not found. 3504 3505 \param name The name of the item to retrieve. 3506 \param index The index of the item to retrieve if there is more than one. 3507 \param defaultValue The value to use if the item specified by \a name 3508 is not found. 3509 3510 \return The item with \a name, or \a defaultValue if not found. 3511 3512 \since Haiku R1 3513*/ 3514 3515 3516/*! 3517 \fn const char* BMessage::GetString(const char* name, 3518 const char* defaultValue) const 3519 \brief Return the string from message with \a name, or \a defaultValue if 3520 not found. 3521 3522 \param name The name of the item to retrieve. 3523 \param defaultValue The value to use if the item specified by \a name 3524 is not found. 3525 3526 \return The item with \a name, or \a defaultValue if not found. 3527 3528 \since Haiku R1 3529*/ 3530 3531 3532/*! 3533 \fn const char* BMessage::GetString(const char* name, int32 index, 3534 const char* defaultValue) const 3535 \brief Return the string from message with \a name and \a index, or 3536 \a defaultValue if not found. 3537 3538 \param name The name of the item to retrieve. 3539 \param index The index of the item to retrieve if there is more than one. 3540 \param defaultValue The value to use if the item specified by \a name 3541 is not found. 3542 3543 \return The item with \a name, or \a defaultValue if not found. 3544 3545 \since Haiku R1 3546*/ 3547 3548 3549/*! 3550 \fn BAlignment BMessage::GetAlignment(const char* name, 3551 const BAlignment& defaultValue) const 3552 \brief Return the BAlignment object from message with \a name, or 3553 \a defaultValue if not found. 3554 3555 \param name The name of the item to retrieve. 3556 \param defaultValue The value to use if the item specified by \a name 3557 is not found. 3558 3559 \return The item with \a name, or \a defaultValue if not found. 3560 3561 \since Haiku R1 3562*/ 3563 3564 3565/*! 3566 \fn BAlignment BMessage::GetAlignment(const char* name, int32 index, 3567 const BAlignment& defaultValue) const 3568 \brief Return the BAlignment object from message with \a name and \a index, 3569 or \a defaultValue if not found. 3570 3571 \param name The name of the item to retrieve. 3572 \param index The index of the item to retrieve if there is more than one. 3573 \param defaultValue The value to use if the item specified by \a name 3574 is not found. 3575 3576 \return The item with \a name, or \a defaultValue if not found. 3577 3578 \since Haiku R1 3579*/ 3580 3581 3582/*! 3583 \fn BRect BMessage::GetRect(const char* name, const BRect& defaultValue) const 3584 \brief Return the BRect object from message with \a name, or 3585 \a defaultValue if not found. 3586 3587 \param name The name of the item to retrieve. 3588 \param defaultValue The value to use if the item specified by \a name 3589 is not found. 3590 3591 \return The item with \a name, or \a defaultValue if not found. 3592 3593 \since Haiku R1 3594*/ 3595 3596 3597/*! 3598 \fn BRect BMessage::GetRect(const char* name, int32 index, 3599 const BRect& defaultValue) const 3600 \brief Return the BRect object from message with \a name and \a index, 3601 or \a defaultValue if not found. 3602 3603 \param name The name of the item to retrieve. 3604 \param index The index of the item to retrieve if there is more than one. 3605 \param defaultValue The value to use if the item specified by \a name 3606 is not found. 3607 3608 \return The item with \a name, or \a defaultValue if not found. 3609 3610 \since Haiku R1 3611*/ 3612 3613 3614/*! 3615 \fn BPoint BMessage::GetPoint(const char* name, 3616 const BPoint& defaultValue) const 3617 \brief Return the BPoint object from message with \a name, or 3618 \a defaultValue if not found. 3619 3620 \param name The name of the item to retrieve. 3621 \param defaultValue The value to use if the item specified by \a name 3622 is not found. 3623 3624 \return The item with \a name, or \a defaultValue if not found. 3625 3626 \since Haiku R1 3627*/ 3628 3629 3630/*! 3631 \fn BPoint BMessage::GetPoint(const char* name, int32 index, 3632 const BPoint& defaultValue) const 3633 \brief Return the BPoint object from message with \a name and \a index, 3634 or \a defaultValue if not found. 3635 3636 \param name The name of the item to retrieve. 3637 \param index The index of the item to retrieve if there is more than one. 3638 \param defaultValue The value to use if the item specified by \a name 3639 is not found. 3640 3641 \return The item with \a name, or \a defaultValue if not found. 3642 3643 \since Haiku R1 3644*/ 3645 3646 3647/*! 3648 \fn BSize BMessage::GetSize(const char* name, 3649 const BSize& defaultValue) const 3650 \brief Return the BSize object from message with \a name, or 3651 \a defaultValue if not found. 3652 3653 \param name The name of the item to retrieve. 3654 \param defaultValue The value to use if the item specified by \a name 3655 is not found. 3656 3657 \return The item with \a name, or \a defaultValue if not found. 3658 3659 \since Haiku R1 3660*/ 3661 3662 3663/*! 3664 \fn BSize BMessage::GetSize(const char* name, int32 index, 3665 const BSize& defaultValue) const 3666 \brief Return the BSize object from message with \a name and \a index, 3667 or \a defaultValue if not found. 3668 3669 \param name The name of the item to retrieve. 3670 \param index The index of the item to retrieve if there is more than one. 3671 \param defaultValue The value to use if the item specified by \a name 3672 is not found. 3673 3674 \return The item with \a name, or \a defaultValue if not found. 3675 3676 \since Haiku R1 3677*/ 3678 3679 3680//! @} 3681