A container that can be send and received using the Haiku messaging subsystem. More...
Inherited by BMailAddOnSettings.
Public Member Functions | |
BMessage () | |
Construct an empty message, without any data members and with a what constant set to 0 . | |
BMessage (const BMessage &other) | |
Construct a new message that is a copy of another message. | |
BMessage (uint32 what) | |
Construct an empty message with the what member set to the specified value. | |
virtual | ~BMessage () |
Free the data members associated with the message. | |
Allocation Operators | |
BMessage & | operator= (const BMessage &other) |
Copy one message into another. | |
void * | operator new (size_t size) |
Allocates size bytes of memory for a BMessage. | |
void * | operator new (size_t, void *pointer) |
Allocates size bytes of memory for a BMessage. | |
void * | operator new (size_t, const std::nothrow_t &noThrow) |
Allocates size bytes of memory for a BMessage. | |
void | operator delete (void *pointer, size_t size) |
Frees memory allocated by new. | |
Statistics and Miscellaneous Information | |
status_t | GetInfo (type_code typeRequested, int32 index, char **nameFound, type_code *typeFound, int32 *countFound=NULL) const |
Retrieve the name, the type and the number of items in a message by an index. | |
status_t | GetInfo (const char *name, type_code *typeFound, int32 *countFound=NULL) const |
Retrieve the type and the number of data items in this message that are associated with a name. | |
status_t | GetInfo (const char *name, type_code *typeFound, bool *fixedSize) const |
Retrieve the type and whether or not the size of the data is fixed associated with a name. | |
status_t | GetInfo (const char *name, type_code *typeFound, int32 *countFound, bool *fixedSize) const |
Retrieve the type and whether or not the size of the data is fixed associated with a name. | |
int32 | CountNames (type_code type) const |
Count the number of names of a certain type. | |
bool | IsEmpty () const |
Check if the message has data members. | |
bool | IsSystem () const |
Check if the message is a system message. | |
bool | IsReply () const |
Check if the message is a reply to a (previous) message. | |
void | PrintToStream () const |
Print the message to the standard output. | |
status_t | Rename (const char *oldEntry, const char *newEntry) |
Rename a data label. | |
Delivery Info | |
bool | WasDelivered () const |
Check if this message was delivered through the delivery methods. | |
bool | IsSourceWaiting () const |
Check if the sender expects a reply. | |
bool | IsSourceRemote () const |
Check if the message is sent by another application. | |
BMessenger | ReturnAddress () const |
Get a messenger that points to the sender of the message. | |
const BMessage * | Previous () const |
Get the message to which this message is a reply. | |
bool | WasDropped () const |
Check if the message was delivered through 'drag and drop'. | |
BPoint | DropPoint (BPoint *offset=NULL) const |
Get the coordinates of the drop point of the message. | |
Replying | |
status_t | SendReply (uint32 command, BHandler *replyTo=NULL) |
Asynchronously send a reply to this message. | |
status_t | SendReply (BMessage *reply, BHandler *replyTo=NULL, bigtime_t timeout=B_INFINITE_TIMEOUT) |
Asynchronously send a reply to this message. | |
status_t | SendReply (BMessage *reply, BMessenger replyTo, bigtime_t timeout=B_INFINITE_TIMEOUT) |
Asynchronously send a reply to this message. | |
status_t | SendReply (uint32 command, BMessage *replyToReply) |
Synchronously send a reply to this message, and wait for a reply back. | |
status_t | SendReply (BMessage *reply, BMessage *replyToReply, bigtime_t sendTimeout=B_INFINITE_TIMEOUT, bigtime_t replyTimeout=B_INFINITE_TIMEOUT) |
Synchronously send a reply to this message, and wait for a reply back. | |
Flattening | |
Because of historical reasons and for binary compatibility, this class provides a flattening API without inheriting the BFlattenable class. The API is more or less the same, but you are inconvenienced when you want to use messages in methods that handle BFlattenable objects. | |
ssize_t | FlattenedSize () const |
Return the size in bytes required when you want to flatten this message to a stream of bytes. | |
status_t | Flatten (char *buffer, ssize_t size) const |
Flatten the message to a buffer. | |
status_t | Flatten (BDataIO *stream, ssize_t *size=NULL) const |
Flatten the message to a stream. | |
status_t | Unflatten (const char *flatBuffer) |
Unflatten a message from a buffer and put it into the current object. | |
status_t | Unflatten (BDataIO *stream) |
Unflatten a message from a stream and put it into the current object. | |
Specifiers (Scripting) | |
status_t | AddSpecifier (const char *property) |
Undocumented. | |
status_t | AddSpecifier (const char *property, int32 index) |
Undocumented. | |
status_t | AddSpecifier (const char *property, int32 index, int32 range) |
Undocumented. | |
status_t | AddSpecifier (const char *property, const char *name) |
Undocumented. | |
status_t | AddSpecifier (const BMessage *specifier) |
Undocumented. | |
status_t | SetCurrentSpecifier (int32 index) |
Undocumented. | |
status_t | GetCurrentSpecifier (int32 *index, BMessage *specifier=NULL, int32 *what=NULL, const char **property=NULL) const |
Undocumented. | |
bool | HasSpecifiers () const |
Undocumented. | |
status_t | PopSpecifier () |
Undocumented. | |
Adding Data | |
status_t | AddAlignment (const char *name, const BAlignment &alignment) |
Convenience method to add a BAlignment to the label name. | |
status_t | AddRect (const char *name, BRect rect) |
Convenience method to add a BRect to the label name. | |
status_t | AddPoint (const char *name, BPoint point) |
Convenience method to add a BPoint to the label name. | |
status_t | AddSize (const char *name, BSize size) |
Convenience method to add a BSize to the label name. | |
status_t | AddString (const char *name, const char *string) |
Convenience method to add a C-string to the label name. | |
status_t | AddString (const char *name, const BString &string) |
Convenience method to add a BString to the label name. | |
status_t | AddStrings (const char *name, const BStringList &list) |
Convenience method to add list of strings to the label name. | |
status_t | AddInt8 (const char *name, int8 value) |
Convenience method to add an int8 to the label name. | |
status_t | AddUInt8 (const char *name, uint8 value) |
Convenience method to add an uint8 to the label name. | |
status_t | AddInt16 (const char *name, int16 value) |
Convenience method to add an int16 to the label name. | |
status_t | AddUInt16 (const char *name, uint16 value) |
Convenience method to add an uint16 to the label name. | |
status_t | AddInt32 (const char *name, int32 value) |
Convenience method to add an int32 to the label name. | |
status_t | AddUInt32 (const char *name, uint32 value) |
Convenience method to add an uint32 to the label name. | |
status_t | AddInt64 (const char *name, int64 value) |
Convenience method to add an int64 to the label name. | |
status_t | AddUInt64 (const char *name, uint64 value) |
Convenience method to add an uint64 to the label name. | |
status_t | AddBool (const char *name, bool value) |
Convenience method to add a bool to the label name. | |
status_t | AddFloat (const char *name, float value) |
Convenience method to add a float to the label name. | |
status_t | AddDouble (const char *name, double value) |
Convenience method to add a double to the label name. | |
status_t | AddColor (const char *name, rgb_color value) |
Convenience method to add a rgb_color to the label name. | |
status_t | AddPointer (const char *name, const void *pointer) |
Convenience method to add a pointer to the label name. | |
status_t | AddMessenger (const char *name, BMessenger messenger) |
Convenience method to add a messenger to the label name. | |
status_t | AddRef (const char *name, const entry_ref *ref) |
Convenience method to add an entry_ref to the label name. | |
status_t | AddNodeRef (const char *name, const node_ref *ref) |
Convenience method to add a node_ref with the label name. | |
status_t | AddMessage (const char *name, const BMessage *message) |
Convenience method to add a message to the label name. | |
status_t | AddFlat (const char *name, BFlattenable *object, int32 count=1) |
Convenience method to add a flattenable to the label name. | |
status_t | AddFlat (const char *name, const BFlattenable *object, int32 count=1) |
Convenience method to add a flattenable to the label name. | |
status_t | AddData (const char *name, type_code type, const void *data, ssize_t numBytes, bool isFixedSize=true, int32 count=1) |
Add data of a certain type to the message. | |
status_t | Append (const BMessage &message) |
Append the data of another message to this message. | |
Removing Data | |
status_t | RemoveData (const char *name, int32 index=0) |
Remove data associated with name at a specified index. | |
status_t | RemoveName (const char *name) |
Remove all data associated with a name. | |
status_t | MakeEmpty () |
Clear all data and metadata in this message. | |
Finding Data | |
Look at FindData() for a general introduction to finding data. | |
status_t | FindAlignment (const char *name, BAlignment *alignment) const |
Find an alignment at the label name. | |
status_t | FindAlignment (const char *name, int32 index, BAlignment *alignment) const |
Find an alignment at the label name at an index. | |
status_t | FindRect (const char *name, BRect *rect) const |
Find a rectangle at the label name. | |
status_t | FindRect (const char *name, int32 index, BRect *rect) const |
Find a rectangle at the label name at an index. | |
status_t | FindPoint (const char *name, BPoint *point) const |
Find a point at the label name. | |
status_t | FindPoint (const char *name, int32 index, BPoint *point) const |
Find a point at the label name at an index. | |
status_t | FindSize (const char *name, BSize *size) const |
Find a size at the label name. | |
status_t | FindSize (const char *name, int32 index, BSize *size) const |
Find a size at the label name at an index. | |
status_t | FindString (const char *name, const char **string) const |
Find a string at the label name. | |
status_t | FindString (const char *name, int32 index, const char **string) const |
Find a string at the label name at an index. | |
status_t | FindString (const char *name, BString *string) const |
Find a string at the label name. | |
status_t | FindString (const char *name, int32 index, BString *string) const |
Find a string at the label name at an index. | |
status_t | FindStrings (const char *name, BStringList *list) const |
Find all the strings at the label name. | |
status_t | FindInt8 (const char *name, int8 *value) const |
Find an integer at the label name. | |
status_t | FindInt8 (const char *name, int32 index, int8 *value) const |
Find an integer at the label name at an index. | |
status_t | FindUInt8 (const char *name, uint8 *value) const |
Find an integer at the label name. | |
status_t | FindUInt8 (const char *name, int32 index, uint8 *value) const |
Find an integer at the label name at an index. | |
status_t | FindInt16 (const char *name, int16 *value) const |
Find an integer at the label name. | |
status_t | FindInt16 (const char *name, int32 index, int16 *value) const |
Find an integer at the label name at an index. | |
status_t | FindUInt16 (const char *name, uint16 *value) const |
Find an integer at the label name. | |
status_t | FindUInt16 (const char *name, int32 index, uint16 *value) const |
Find an integer at the label name at an index. | |
status_t | FindInt32 (const char *name, int32 *value) const |
Find an integer at the label name. | |
status_t | FindInt32 (const char *name, int32 index, int32 *value) const |
Find an integer at the label name at an index. | |
status_t | FindUInt32 (const char *name, uint32 *value) const |
Find an integer at the label name. | |
status_t | FindUInt32 (const char *name, int32 index, uint32 *value) const |
Find an integer at the label name at an index. | |
status_t | FindInt64 (const char *name, int64 *value) const |
Find an integer at the label name. | |
status_t | FindInt64 (const char *name, int32 index, int64 *value) const |
Find an integer at the label name at an index. | |
status_t | FindUInt64 (const char *name, uint64 *value) const |
Find an integer at the label name. | |
status_t | FindUInt64 (const char *name, int32 index, uint64 *value) const |
Find an integer at the label name at an index. | |
status_t | FindBool (const char *name, bool *value) const |
Find a boolean at the label name. | |
status_t | FindBool (const char *name, int32 index, bool *value) const |
Find a boolean at the label name at an index. | |
status_t | FindFloat (const char *name, float *value) const |
Find a float at the label name. | |
status_t | FindFloat (const char *name, int32 index, float *value) const |
Find a float at the label name at an index. | |
status_t | FindDouble (const char *name, double *value) const |
Find a double at the label name. | |
status_t | FindDouble (const char *name, int32 index, double *value) const |
Find a double at the label name at an index. | |
status_t | FindColor (const char *name, rgb_color *value) const |
Find a color with the label name. | |
status_t | FindColor (const char *name, int32 index, rgb_color *value) const |
Find a color at the label name at an index. | |
status_t | FindPointer (const char *name, void **pointer) const |
Find a pointer at the label name. | |
status_t | FindPointer (const char *name, int32 index, void **pointer) const |
Find a pointer at the label name at an index. | |
status_t | FindMessenger (const char *name, BMessenger *messenger) const |
Find a messenger at the label name. | |
status_t | FindMessenger (const char *name, int32 index, BMessenger *messenger) const |
Find a messenger at the label name at an index. | |
status_t | FindRef (const char *name, entry_ref *ref) const |
Find a reference to a file at the label name. | |
status_t | FindRef (const char *name, int32 index, entry_ref *ref) const |
Find a reference to a file at the label name at an index. | |
status_t | FindNodeRef (const char *name, node_ref *ref) const |
Find a reference to a node at the label name. | |
status_t | FindNodeRef (const char *name, int32 index, node_ref *ref) const |
Find a reference to a node at the label name at an index. | |
status_t | FindMessage (const char *name, BMessage *message) const |
Find a message at the label name. | |
status_t | FindMessage (const char *name, int32 index, BMessage *message) const |
Find a message at the label name at an index. | |
status_t | FindFlat (const char *name, BFlattenable *object) const |
Find a flattened object at the label name. | |
status_t | FindFlat (const char *name, int32 index, BFlattenable *object) const |
Find a flattened object at the label name at an index. | |
status_t | FindData (const char *name, type_code type, const void **data, ssize_t *numBytes) const |
Find data that is stored in this message. | |
status_t | FindData (const char *name, type_code type, int32 index, const void **data, ssize_t *numBytes) const |
Find data that is stored in this message at an index. | |
Replacing Data | |
Look at ReplaceData() for a general introduction to replacing data. | |
status_t | ReplaceAlignment (const char *name, const BAlignment &alignment) |
Replace an alignment at the label name. | |
status_t | ReplaceAlignment (const char *name, int32 index, const BAlignment &alignment) |
Replace an alignment at the label name at a specified index. | |
status_t | ReplaceRect (const char *name, BRect rect) |
Replace a rectangle at the label name. | |
status_t | ReplaceRect (const char *name, int32 index, BRect rect) |
Replace a rectangle at the label name at a specified index. | |
status_t | ReplacePoint (const char *name, BPoint aPoint) |
Replace a point at the label name. | |
status_t | ReplacePoint (const char *name, int32 index, BPoint aPoint) |
Replace a point at the label name at a specified index. | |
status_t | ReplaceSize (const char *name, BSize aSize) |
Replace a size at the label name. | |
status_t | ReplaceSize (const char *name, int32 index, BSize aSize) |
Replace a size at the label name at a specified index. | |
status_t | ReplaceString (const char *name, const char *string) |
Replace a string at the label name. | |
status_t | ReplaceString (const char *name, int32 index, const char *string) |
Replace a string at the label name at a specified index. | |
status_t | ReplaceString (const char *name, const BString &string) |
Replace a string at the label name. | |
status_t | ReplaceString (const char *name, int32 index, const BString &string) |
Replace a string at the label name at a specified index. | |
status_t | ReplaceInt8 (const char *name, int8 value) |
Replace an integer at the label name. | |
status_t | ReplaceInt8 (const char *name, int32 index, int8 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceUInt8 (const char *name, uint8 value) |
Replace an integer at the label name. | |
status_t | ReplaceUInt8 (const char *name, int32 index, uint8 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceInt16 (const char *name, int16 value) |
Replace an integer at the label name. | |
status_t | ReplaceInt16 (const char *name, int32 index, int16 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceUInt16 (const char *name, uint16 value) |
Replace an integer at the label name. | |
status_t | ReplaceUInt16 (const char *name, int32 index, uint16 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceInt32 (const char *name, int32 value) |
Replace an integer at the label name. | |
status_t | ReplaceInt32 (const char *name, int32 index, int32 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceUInt32 (const char *name, uint32 value) |
Replace an integer at the label name. | |
status_t | ReplaceUInt32 (const char *name, int32 index, uint32 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceInt64 (const char *name, int64 value) |
Replace an integer at the label name. | |
status_t | ReplaceInt64 (const char *name, int32 index, int64 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceUInt64 (const char *name, uint64 value) |
Replace an integer at the label name. | |
status_t | ReplaceUInt64 (const char *name, int32 index, uint64 value) |
Replace an integer at the label name at a specified index. | |
status_t | ReplaceBool (const char *name, bool aBoolean) |
Replace a boolean at the label name. | |
status_t | ReplaceBool (const char *name, int32 index, bool value) |
Replace a boolean at the label name at a specified index. | |
status_t | ReplaceFloat (const char *name, float value) |
Replace a float at the label name. | |
status_t | ReplaceFloat (const char *name, int32 index, float value) |
Replace a float at the label name at a specified index. | |
status_t | ReplaceDouble (const char *name, double value) |
Replace a double at the label name. | |
status_t | ReplaceDouble (const char *name, int32 index, double value) |
Replace a double at the label name at a specified index. | |
status_t | ReplaceColor (const char *name, rgb_color value) |
Replace a color at the label name. | |
status_t | ReplaceColor (const char *name, int32 index, rgb_color value) |
Replace a rgb_color at the label name at a specified index. | |
status_t | ReplacePointer (const char *name, const void *pointer) |
Replace a pointer at the label name. | |
status_t | ReplacePointer (const char *name, int32 index, const void *pointer) |
Replace a pointer at the label name at a specified index. | |
status_t | ReplaceMessenger (const char *name, BMessenger messenger) |
Replace a messenger at the label name. | |
status_t | ReplaceMessenger (const char *name, int32 index, BMessenger messenger) |
Replace a messenger at the label name at a specified index. | |
status_t | ReplaceRef (const char *name, const entry_ref *ref) |
Replace a reference to a file at the label name. | |
status_t | ReplaceRef (const char *name, int32 index, const entry_ref *ref) |
Replace a reference to a file at the label name at a specified index. | |
status_t | ReplaceNodeRef (const char *name, const node_ref *ref) |
Replace a reference to a node at the label name. | |
status_t | ReplaceNodeRef (const char *name, int32 index, const node_ref *ref) |
Replace a reference to a node at the label name at a specified index. | |
status_t | ReplaceMessage (const char *name, const BMessage *message) |
Replace a message at the label name. | |
status_t | ReplaceMessage (const char *name, int32 index, const BMessage *message) |
Replace a message at the label name at a specified index. | |
status_t | ReplaceFlat (const char *name, BFlattenable *object) |
Replace a flattened object at the label name. | |
status_t | ReplaceFlat (const char *name, int32 index, BFlattenable *object) |
Replace a flattened object at the label name at a specified index. | |
status_t | ReplaceData (const char *name, type_code type, const void *data, ssize_t numBytes) |
Replace the data at label name. | |
status_t | ReplaceData (const char *name, type_code type, int32 index, const void *data, ssize_t numBytes) |
Replace the data at label name at a specified index. | |
Message comparison | |
bool | HasSameData (const BMessage &other, bool ignoreFieldOrder=true, bool deep=false) const |
Experimental method to compare two messages. | |
Deprecated Methods | |
These methods are likely to disappear as they have been replaced by safer and more powerful methods but are implemented for the purpose of binary compatibility. | |
bool | HasAlignment (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasRect (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasPoint (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasSize (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasString (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasInt8 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasUInt8 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasInt16 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasUInt16 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasInt32 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasUInt32 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasInt64 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasUInt64 (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasBool (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasFloat (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasDouble (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasColor (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasPointer (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasMessenger (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasRef (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasNodeRef (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasMessage (const char *name, int32 n=0) const |
Deprecated. | |
bool | HasFlat (const char *name, const BFlattenable *object) const |
Deprecated. | |
bool | HasFlat (const char *name, int32 n, const BFlattenable *object) const |
Deprecated. | |
bool | HasData (const char *name, type_code, int32 n=0) const |
Deprecated. | |
BRect | FindRect (const char *name, int32 n=0) const |
Deprecated. | |
BPoint | FindPoint (const char *name, int32 n=0) const |
Deprecated. | |
const char * | FindString (const char *name, int32 n=0) const |
Deprecated. | |
int8 | FindInt8 (const char *name, int32 n=0) const |
Deprecated. | |
int16 | FindInt16 (const char *name, int32 n=0) const |
Deprecated. | |
int32 | FindInt32 (const char *name, int32 n=0) const |
Deprecated. | |
int64 | FindInt64 (const char *name, int32 n=0) const |
Deprecated. | |
bool | FindBool (const char *name, int32 n=0) const |
Deprecated. | |
float | FindFloat (const char *name, int32 n=0) const |
Deprecated. | |
double | FindDouble (const char *name, int32 n=0) const |
Deprecated. | |
Finding Data Convenience Methods | |
These methods may be used as alternatives to the Find data methods above which allow you to specify a default value to use if the value you are looking for is not found and return the result instead of filling out an out parameter and status code. If you are not interested in the status code these methods allow for some code simplification. For example, instead of writing: bool enabled;
enabled = false;
status_t FindBool(const char *name, bool *value) const Find a boolean at the label name. you can write the following: bool GetBool(const char *name, bool defaultValue=false) const Return the boolean value from message with name, or defaultValue if not found. reducing the example to a single line. | |
bool | GetBool (const char *name, bool defaultValue=false) const |
Return the boolean value from message with name, or defaultValue if not found. | |
bool | GetBool (const char *name, int32 index, bool defaultValue) const |
Return the boolean value from message with name and index, or defaultValue if not found. | |
int8 | GetInt8 (const char *name, int8 defaultValue) const |
Return the int8 value from message with name, or defaultValue if not found. | |
int8 | GetInt8 (const char *name, int32 index, int8 defaultValue) const |
Return the int8 value from message with name and index, or defaultValue if not found. | |
uint8 | GetUInt8 (const char *name, uint8 defaultValue) const |
Return the uint8 value from message with name, or defaultValue if not found. | |
uint8 | GetUInt8 (const char *name, int32 index, uint8 defaultValue) const |
Return the uint8 message from message with name and index, or defaultValue if not found. | |
int16 | GetInt16 (const char *name, int16 defaultValue) const |
Return the int16 value from message with name, or defaultValue if not found. | |
int16 | GetInt16 (const char *name, int32 index, int16 defaultValue) const |
Return the int16 value from message with name and index, or defaultValue if not found. | |
uint16 | GetUInt16 (const char *name, uint16 defaultValue) const |
Return the uint16 value from message with name, or defaultValue if not found. | |
uint16 | GetUInt16 (const char *name, int32 index, uint16 defaultValue) const |
Return the uint16 value from message with name and index, or defaultValue if not found. | |
int32 | GetInt32 (const char *name, int32 defaultValue) const |
Return the int32 value from message with name, or defaultValue if not found. | |
int32 | GetInt32 (const char *name, int32 index, int32 defaultValue) const |
Return the int32 value from message with name and index, or defaultValue if not found. | |
uint32 | GetUInt32 (const char *name, uint32 defaultValue) const |
Return the uint32 value from message with name, or defaultValue if not found. | |
uint32 | GetUInt32 (const char *name, int32 index, uint32 defaultValue) const |
Return the uint32 value from message with name and index, or defaultValue if not found. | |
int64 | GetInt64 (const char *name, int64 defaultValue) const |
Return the int64 value from message with name, or defaultValue if not found. | |
int64 | GetInt64 (const char *name, int32 index, int64 defaultValue) const |
Return the int64 value from message with name and index, or defaultValue if not found. | |
uint64 | GetUInt64 (const char *name, uint64 defaultValue) const |
Return the uint64 value from message with name, or defaultValue if not found. | |
uint64 | GetUInt64 (const char *name, int32 index, uint64 defaultValue) const |
Return the uint64 value from message with name and index, or defaultValue if not found. | |
float | GetFloat (const char *name, float defaultValue) const |
Return the float value from message with name, or defaultValue if not found. | |
float | GetFloat (const char *name, int32 index, float defaultValue) const |
Return the float value from message with name and index, or defaultValue if not found. | |
double | GetDouble (const char *name, double defaultValue) const |
Return the double value from message with name, or defaultValue if not found. | |
double | GetDouble (const char *name, int32 index, double defaultValue) const |
Return the double value from message with name and index, or defaultValue if not found. | |
rgb_color | GetColor (const char *name, rgb_color defaultValue) const |
Return the rgb_color value from message with name, or defaultValue if not found. | |
rgb_color | GetColor (const char *name, int32 index, rgb_color defaultValue) const |
Return the rgb_color value from message with name and index, or defaultValue if not found. | |
const void * | GetPointer (const char *name, int32 index, const void *defaultValue=NULL) const |
Return the pointer type from message with name and index, or defaultValue if not found. | |
const void * | GetPointer (const char *name, const void *defaultValue=NULL) const |
Return the pointer type from message with name, or defaultValue if not found. | |
const char * | GetString (const char *name, const char *defaultValue=NULL) const |
Return the string from message with name, or defaultValue if not found. | |
const char * | GetString (const char *name, int32 index, const char *defaultValue) const |
Return the string from message with name and index, or defaultValue if not found. | |
BAlignment | GetAlignment (const char *name, int32 index, const BAlignment &defaultValue) const |
Return the BAlignment object from message with name and index, or defaultValue if not found. | |
BAlignment | GetAlignment (const char *name, const BAlignment &defaultValue) const |
Return the BAlignment object from message with name, or defaultValue if not found. | |
BRect | GetRect (const char *name, int32 index, const BRect &defaultValue) const |
Return the BRect object from message with name and index, or defaultValue if not found. | |
BRect | GetRect (const char *name, const BRect &defaultValue) const |
Return the BRect object from message with name, or defaultValue if not found. | |
BPoint | GetPoint (const char *name, int32 index, const BPoint &defaultValue) const |
Return the BPoint object from message with name and index, or defaultValue if not found. | |
BPoint | GetPoint (const char *name, const BPoint &defaultValue) const |
Return the BPoint object from message with name, or defaultValue if not found. | |
BSize | GetSize (const char *name, int32 index, const BSize &defaultValue) const |
Return the BSize object from message with name and index, or defaultValue if not found. | |
BSize | GetSize (const char *name, const BSize &defaultValue) const |
Return the BSize object from message with name, or defaultValue if not found. | |
Setting Data Convenience Methods | |
These methods may be used as alternatives to the Add data methods above. Using them, will set the data stored at index 0 to the value that you pass to the method. If the data already exists, then it is overwritten. For example, calling the SetBool(const char *, bool) method is like calling AddBool(const char*, bool) in case the item does not exist yet, and ReplaceBool(const char*, bool) in case it does. Note that this call will fail if there already is data for that label, with a different type. If that might be the case, you will be better of using a combination of RemoveName(const char*) and the Add methods. Also note that this method will always work on the first element of the data (at index 0). In case there are more values stored, the other ones will not be altered. | |
status_t | SetBool (const char *name, bool value) |
Set the data with at the label name to value. | |
status_t | SetInt8 (const char *name, int8 value) |
Set the data with at the label name to value. | |
status_t | SetUInt8 (const char *name, uint8 value) |
Set the data with at the label name to value. | |
status_t | SetInt16 (const char *name, int16 value) |
Set the data with at the label name to value. | |
status_t | SetUInt16 (const char *name, uint16 value) |
Set the data with at the label name to value. | |
status_t | SetInt32 (const char *name, int32 value) |
Set the data with at the label name to value. | |
status_t | SetUInt32 (const char *name, uint32 value) |
Set the data with at the label name to value. | |
status_t | SetInt64 (const char *name, int64 value) |
Set the data with at the label name to value. | |
status_t | SetUInt64 (const char *name, uint64 value) |
Set the data with at the label name to value. | |
status_t | SetColor (const char *name, rgb_color value) |
Set the data with at the label name to value. | |
status_t | SetPointer (const char *name, const void *value) |
Set the data with at the label name to value. | |
status_t | SetString (const char *name, const char *string) |
Set the string with at the label name to string. | |
status_t | SetString (const char *name, const BString &string) |
Set the string with at the label name to string. | |
status_t | SetFloat (const char *name, float value) |
Set the data with at the label name to value. | |
status_t | SetDouble (const char *name, double value) |
Set the data with at the label name to value. | |
status_t | SetAlignment (const char *name, const BAlignment &value) |
Set the data with at the label name to value. | |
status_t | SetPoint (const char *name, const BPoint &value) |
Set the data with at the label name to value. | |
status_t | SetRect (const char *name, const BRect &value) |
Set the data with at the label name to value. | |
status_t | SetSize (const char *name, const BSize &value) |
Set the data with at the label name to value. | |
status_t | SetData (const char *name, type_code type, const void *data, ssize_t numBytes, bool fixedSize=true, int count=1) |
Low level function to set data to a certain value. | |
Public Attributes | |
uint32 | what |
A 4-byte constant that determines the type of message. | |
A container that can be send and received using the Haiku messaging subsystem.
This class is at the center of the web of messaging classes, in the sense that it defines the actual structure of the messages. Messages have two important elements: the what identifier, and the data members. The first can be directly manipulated, the latter can be manipulated through AddData(), FindData() and ReplaceData() and their derivatives. Neither of these elements are mandatory.
The second important role of BMessage is that it stores meta data: who sent the message and with what intention? The methods of BMessage will disclose if the message was a reply (IsReply()), where it came from (IsSourceRemote()), whether a reply is expected (IsSourceWaiting()), and in case the message is a reply, what it's a reply to (Previous()).
Mostly, messages are used to pass information between the the objects in your application, but because messages are such flexible data containers, they are also often used for other data storage purposes. Many applications store their settings as messages. Because messages can be flattened to data streams (such as files), they provide an easy but powerful tool for data storage.
All methods can be classified in these areas:
To see how messages fit in with the greater picture, have a look at the Messaging Introduction.
BMessage::BMessage | ( | ) |
Construct an empty message, without any data members and with a what constant set to 0
.
BMessage::BMessage | ( | uint32 | what | ) |
Construct an empty message with the what member set to the specified value.
BMessage::BMessage | ( | const BMessage & | other | ) |
Construct a new message that is a copy of another message.
The what member and the data values are copied. The metadata, such as whether or not the message is a drop message or reply information is not copied. If the original message is a reply to a previous message this will make IsReply() return true
, while calling the same method on a copy of the message will return false
.
|
virtual |
Free the data members associated with the message.
If there still is a sender waiting for a reply, the B_NO_REPLY
message will be sent to inform them that there won't be a reply.
status_t BMessage::AddAlignment | ( | const char * | name, |
const BAlignment & | alignment | ||
) |
Convenience method to add a BAlignment to the label name.
This method calls AddData() with the B_ALIGNMENT_TYPE
type.
name | The label to associate the data with. |
alignment | The alignment to store in the message. |
B_OK
on success or an error code.status_t BMessage::AddBool | ( | const char * | name, |
bool | aBoolean | ||
) |
Convenience method to add a bool
to the label name.
This method calls AddData() with the B_BOOL_TYPE
type.
name | The label to associate the data with. |
aBoolean | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add a rgb_color
to the label name.
This method calls AddData() with the B_RGB_32_BIT_TYPE
type.
name | The label to associate the data with. |
aColor | The value to store in the message. |
B_OK
on success or an error code.status_t BMessage::AddData | ( | const char * | name, |
type_code | type, | ||
const void * | data, | ||
ssize_t | numBytes, | ||
bool | isFixedSize = true , |
||
int32 | count = 1 |
||
) |
Add data of a certain type to the message.
The amount of numBytes is copied into the message. The data is stored at the label specified in name. You are responsible for specifying the correct type. The Haiku API already specifies many constants, such as B_FLOAT_TYPE
or B_RECT_TYPE
. See TypeConstants.h for more information on the system-wide defined types.
If the field with the name already exists, the data is added in an array-like form. If you are adding a certain name for the first time, you are able to specify some properties of this array. You can fix the size of each data entry, and you can also instruct BMessage to allocate a count of items. The latter does not mean that the number of items is fixed; the array will grow nonetheless. Also, note that every name can only be associated with one type of data.
If consecutive method calls specify a different type than the initial, these calls will fail.
There is no limit to the number of labels, or the amount of data, but note that searching of data members is linear, as well as that some messages will be copied whilst being passed around, so if the amount of data you need to pass is too big, find another way to pass it.
name | The label to which this data needs to be associated. If the name already exists, the new data will be added in an array-like style. |
type | The type of data. If you are adding data to the same name, make sure it is the same type. |
data | The data buffer to copy the bytes from. |
numBytes | The number of bytes to be copied. If this is the first call to this method for this type of data, and you set isFixedSize to true , this will specify the size of all consecutive calls to this method. |
isFixedSize | If this is the first call to this method with this name, you can specify the whether or not all items in this array should have the same fixed size. |
count | If this is the first call to this method with this name, you can instruct this message to allocate a number of items in advance. This does not limit the amount of items though. The array will grow if needed. |
B_OK
on success or an error code. B_OK | The data is succesfully added. |
B_BAD_VALUE | The numBytes is less than, or equal to 0 , or the size of this item is larger than the name allows, since it has been specified to have a fixed size. |
B_ERROR | There was an error whilst creating the label with your name. |
B_BAD_TYPE | The type you specified is different than the one already associated with name. |
status_t BMessage::AddDouble | ( | const char * | name, |
double | aDouble | ||
) |
Convenience method to add a double
to the label name.
This method calls AddData() with the B_DOUBLE_TYPE
type.
name | The label to associate the data with. |
aDouble | The value to store in the message. |
B_OK
on success or an error code.status_t BMessage::AddFlat | ( | const char * | name, |
BFlattenable * | object, | ||
int32 | count = 1 |
||
) |
Convenience method to add a flattenable to the label name.
status_t BMessage::AddFlat | ( | const char * | name, |
const BFlattenable * | object, | ||
int32 | count = 1 |
||
) |
Convenience method to add a flattenable to the label name.
This method uses BFlattenable::TypeCode() to determine the type. It also uses BFlattenable::IsFixedSize() to determine whether or not the size of the object is supposedly always the same. You can specify a count, to pre-allocate more entries if you are going to add more than one of this type.
name | The label to associate the data with. |
object | The object to flatten into the message. |
count | The number of items to pre-allocate associated with this name. |
B_OK
on success or an error code.status_t BMessage::AddFloat | ( | const char * | name, |
float | aFloat | ||
) |
Convenience method to add a float
to the label name.
This method calls AddData() with the B_FLOAT_TYPE
type.
name | The label to associate the data with. |
aFloat | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an int16
to the label name.
This method calls AddData() with the B_INT16_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an int32
to the label name.
This method calls AddData() with the B_INT32_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an int64
to the label name.
This method calls AddData() with the B_INT64_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an int8
to the label name.
This method calls AddData() with the B_INT8_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add a message to the label name.
This method calls AddData() with the B_MESSAGE_TYPE
type.
name | The label to associate the data with. |
message | The message to store in this message. |
B_OK
on success or an error code.status_t BMessage::AddMessenger | ( | const char * | name, |
BMessenger | messenger | ||
) |
Convenience method to add a messenger to the label name.
This method calls AddData() with the B_MESSENGER_TYPE
type.
name | The label to associate the data with. |
messenger | The messenger to store in the message. |
B_OK
on success or an error code.Convenience method to add a node_ref
with the label name.
This method calls AddData() with the B_NODE_REF_TYPE
type.
name | The label to associate the data with. |
ref | The node reference to store in the message. |
B_OK
on success or an error code.Convenience method to add a BPoint to the label name.
This method calls AddData() with the B_POINT_TYPE
type.
name | The label to associate the data with. |
aPoint | The point to store in the message. |
B_OK
on success or an error code.status_t BMessage::AddPointer | ( | const char * | name, |
const void * | aPointer | ||
) |
Convenience method to add a pointer
to the label name.
This method calls AddData() with the B_POINTER_TYPE
type.
name | The label to associate the data with. |
aPointer | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add a BRect to the label name.
This method calls AddData() with the B_RECT_TYPE
type.
name | The label to associate the data with. |
aRect | The rectangle to store in the message. |
B_OK
on success or an error code.Convenience method to add an entry_ref
to the label name.
This method calls AddData() with the B_REF_TYPE
type.
name | The label to associate the data with. |
ref | The reference to store in the message. |
B_OK
on success or an error code.Convenience method to add a BSize to the label name.
This method calls AddData() with the B_SIZE_TYPE
type.
name | The label to associate the data with. |
size | The BSize to store in the message. |
B_OK
on success or an error code.status_t BMessage::AddSpecifier | ( | const char * | property | ) |
Undocumented.
status_t BMessage::AddSpecifier | ( | const char * | property, |
const char * | name | ||
) |
Undocumented.
Undocumented.
Convenience method to add a BString to the label name.
This method calls AddData() with the B_STRING_TYPE
type.
name | The label to associate the data with. |
aString | The string to copy to the message. |
B_OK
on success or an error code.status_t BMessage::AddString | ( | const char * | name, |
const char * | aString | ||
) |
Convenience method to add a C-string to the label name.
This method calls AddData() with the B_STRING_TYPE
type.
name | The label to associate the data with. |
aString | The string to copy to the message. |
B_OK
on success or an error code.status_t BMessage::AddStrings | ( | const char * | name, |
const BStringList & | list | ||
) |
Convenience method to add list of strings to the label name.
This method calls AddData() with the B_STRING_TYPE
type for each string in the BStringList.
name | The label to associate the data with. |
list | The list of strings to store in the message. |
B_OK
on success or an error code.Convenience method to add an uint16
to the label name.
This method calls AddData() with the B_UINT16_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an uint32
to the label name.
This method calls AddData() with the B_UINT32_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an uint64
to the label name.
This method calls AddData() with the B_UINT64_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Convenience method to add an uint8
to the label name.
This method calls AddData() with the B_UINT8_TYPE
type.
name | The label to associate the data with. |
value | The value to store in the message. |
B_OK
on success or an error code.Append the data of another message to this message.
This copies all the data of the message to this message. If an item already exists with a given name, and the incoming data is of the same type, the new items will be added to that label. If the item exists but has a different type, then the call will fail. This might leave your message in an incomplete state, because data is processed field by field, so it could be that some data was copied succesfully. After encountering an incompatible data type, any data after that field will not be processed.
message | The message with the data you want to append. This message will not be modified. |
B_OK
on success or an error code. Count the number of names of a certain type.
This method can be used to count the number of items of a certain type. It's practical use is limited to debugging purposes.
type | The type you want to find. If you pass B_ANY_TYPE , this method will return the total number of data items. |
0
in case no items match the type.Get the coordinates of the drop point of the message.
If the message has been delivered because of drag and drop, which can be verified with the WasDropped() method, this method will return a BPoint to where exactly the drop off was made.
Because drop messages are delivered to the BWindow in which they were dropped, and BWindow is a subclass of BLooper, you can use BWindow to determine based on the location, how you should react to it.
If this message was not delivered through drag and drop, it will return a NULL
pointer.
status_t BMessage::FindAlignment | ( | const char * | name, |
BAlignment * | alignment | ||
) | const |
Find an alignment at the label name.
This is an overloaded version of FindAlignment(const char*, int32, BAlignment*) const where the data is sought at index 0
.
status_t BMessage::FindAlignment | ( | const char * | name, |
int32 | index, | ||
BAlignment * | alignment | ||
) | const |
Find an alignment at the label name at an index.
This method looks for the data with the B_ALIGNMENT_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
alignment | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindBool | ( | const char * | name, |
bool * | value | ||
) | const |
Find a boolean at the label name.
This is an overloaded version of FindBool(const char*, int32, bool*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a boolean at the label name at an index.
This method looks for the data with the B_BOOL_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
bool BMessage::FindBool | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
Find a color at the label name at an index.
This method looks for the data with the B_RGB_32_BIT_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a color with the label name.
This is an overloaded version of FindColor(const char*, int32, rgb_color*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindData | ( | const char * | name, |
type_code | type, | ||
const void ** | data, | ||
ssize_t * | numBytes | ||
) | const |
Find data that is stored in this message.
This is an overloaded version of FindData(const char*, type_code, int32, const void**, ssize_t*) const where data is sought at index 0
.
status_t BMessage::FindData | ( | const char * | name, |
type_code | type, | ||
int32 | index, | ||
const void ** | data, | ||
ssize_t * | numBytes | ||
) | const |
Find data that is stored in this message at an index.
This method matches the label name with the type you are asking for, and it looks for the data that is stored at a certain index number. If all these things match, you will get a pointer to the internal buffer, and the method will put the size of the item in numBytes.
Note that only this method, and FindString(const char*, const char**), pass a pointer to the internal buffer. The other more specific methods, such as FindBool() and FindRect() copy the data into a buffer you specify. This means that the data retrieved with this method is valid until the message is deleted.
name | The label the data should be associated with. | |
type | The type of data you want to retrieve. You can pass B_ANY_TYPE if you don't mind which type the data is. | |
index | The index in the array of the data that you want to retrieve. Note that the array is zero-based. | |
[out] | data | A pointer to a pointer where the data can point to. |
[out] | numBytes | The size of the data will be put in this parameter. |
B_OK
on success or an error code. B_OK | The name was found, matches the type, and the data at index has been put in data. |
B_BAD_VALUE | One of the output arguments were NULL . |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindDouble | ( | const char * | name, |
double * | value | ||
) | const |
Find a double at the label name.
This is an overloaded version of FindDouble(const char*, int32, double*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a double at the label name at an index.
This method looks for the data with the B_DOUBLE_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
double BMessage::FindDouble | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
status_t BMessage::FindFlat | ( | const char * | name, |
BFlattenable * | object | ||
) | const |
Find a flattened object at the label name.
This is an overloaded version of FindFlat(const char*, int32, BFlattenable*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
object | The object in which the data should be unflattened. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindFlat | ( | const char * | name, |
int32 | index, | ||
BFlattenable * | object | ||
) | const |
Find a flattened object at the label name at an index.
The type is determined by the type of the passed object. If that type is available at the specified label, then the Unflatten() method of that object will be called.
name | The label to which the data is associated. |
index | The index from which the data should be unflattened. |
object | The object in which the data should be unflattened. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindFloat | ( | const char * | name, |
float * | value | ||
) | const |
Find a float at the label name.
This is an overloaded version of FindFloat(const char*, int32, float*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a float at the label name at an index.
This method looks for the data with the B_FLOAT_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
float BMessage::FindFloat | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
Find an integer at the label name.
This is an overloaded version of FindInt16(const char*, int32, int16*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name at an index.
This method looks for the data with the B_INT16_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Deprecated.
Find an integer at the label name.
This is an overloaded version of FindInt32(const char*, int32, int32*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name at an index.
This method looks for the data with the B_INT32_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Deprecated.
Find an integer at the label name at an index.
This method looks for the data with the B_INT64_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Deprecated.
Find an integer at the label name.
This is an overloaded version of FindInt64(const char*, int32, int64*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name at an index.
This method looks for the data with the B_INT8_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Deprecated.
Find an integer at the label name.
This is an overloaded version of FindInt8(const char*, int32, int8*) const where the data is sought at index 0
.
Find a message at the label name.
This is an overloaded version of FindMessage(const char*, int32, BMessage*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
message | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a message at the label name at an index.
This method looks for the data with the B_MESSAGE_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
message | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindMessenger | ( | const char * | name, |
BMessenger * | messenger | ||
) | const |
Find a messenger at the label name.
This is an overloaded version of FindMessenger(const char*, int32, BMessenger*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
messenger | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindMessenger | ( | const char * | name, |
int32 | index, | ||
BMessenger * | messenger | ||
) | const |
Find a messenger at the label name at an index.
This method looks for the data with the B_MESSENGER_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
messenger | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a reference to a node at the label name at an index.
This method looks for the data with the B_NODE_REF_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
ref | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a reference to a node at the label name.
This is an overloaded version of FindNodeRef(const char*, int32, node_ref*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
ref | The object into which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a point at the label name.
This is an overloaded version of FindPoint(const char*, int32, BPoint*) const where the data is sought at index 0
.
Find a point at the label name at an index.
This method looks for the data with the B_POINT_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
point | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Deprecated.
Find a pointer at the label name at an index.
This method looks for the data with the B_POINTER_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
pointer | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::FindPointer | ( | const char * | name, |
void ** | pointer | ||
) | const |
Find a pointer at the label name.
This is an overloaded version of FindPointer(const char*, int32, void*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
pointer | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a rectangle at the label name.
This is an overloaded version of FindRect(const char*, int32, BRect*) const where the data is sought at index 0
.
Find a rectangle at the label name at an index.
This method looks for the data with the B_RECT_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
rect | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Deprecated.
Find a reference to a file at the label name.
This is an overloaded version of FindRef(const char*, int32, entry_ref*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
ref | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a reference to a file at the label name at an index.
This method looks for the data with the B_REF_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
ref | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a size at the label name.
This is an overloaded version of FindSize(const char*, int32, BSize*) const where the data is sought at index 0
.
Find a size at the label name at an index.
This method looks for the data with the B_SIZE_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
size | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a string at the label name.
This is an overloaded version of FindString(const char*, int32, BString*) const where the data is sought at index 0
.
status_t BMessage::FindString | ( | const char * | name, |
const char ** | string | ||
) | const |
Find a string at the label name.
This is an overloaded version of FindString(const char*, int32, const char**) const where the data is sought at index 0
.
Find a string at the label name at an index.
This method looks for the data with the B_STRING_TYPE
, and copies it into the string object.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
string | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find a string at the label name at an index.
This method looks for the data with the B_STRING_TYPE
, and returns a pointer to the internal buffer of the message. Note that this pointer is valid, until the message is deleted.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
string | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
const char * BMessage::FindString | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
status_t BMessage::FindStrings | ( | const char * | name, |
BStringList * | list | ||
) | const |
Find all the strings at the label name.
This method fetches all the strings that are stored at label name, and copies all the entries into the list.
Find an integer at the label name at an index.
This method looks for the data with the B_UINT16_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name.
This is an overloaded version of FindUInt16(const char*, int32, uint16*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name at an index.
This method looks for the data with the B_UINT32_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name.
This is an overloaded version of FindUInt32(const char*, int32, uint32*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name at an index.
This method looks for the data with the B_UINT64_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name.
This is an overloaded version of FindUInt64(const char*, int32, uint64*) const where the data is sought at index 0
.
name | The label to which the data is associated. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name at an index.
This method looks for the data with the B_UINT8_TYPE
, and copies it into a provided buffer.
name | The label to which the data is associated. |
index | The index from which the data should be copied. |
value | The object in which the data should be copied. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_BAD_INDEX | The index does not exist. |
B_NAME_NOT_FOUND | There is no field with this name. |
Find an integer at the label name.
This is an overloaded version of FindUInt8(const char*, int32, uint8*) const where the data is sought at index 0
.
Flatten the message to a stream.
[in] | stream | The stream to flatten the message to. |
[out] | size | The method writes the number of bytes actually written to this argument. |
B_OK
in case of success, or an error code in case something went awry.status_t BMessage::Flatten | ( | char * | buffer, |
ssize_t | size | ||
) | const |
Flatten the message to a buffer.
buffer | The buffer to write the data to. |
size | The size of the buffer. |
B_OK
in case of success, or an error code in case something went awry.ssize_t BMessage::FlattenedSize | ( | ) | const |
Return the size in bytes required when you want to flatten this message to a stream of bytes.
BAlignment BMessage::GetAlignment | ( | const char * | name, |
const BAlignment & | defaultValue | ||
) | const |
Return the BAlignment object from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
BAlignment BMessage::GetAlignment | ( | const char * | name, |
int32 | index, | ||
const BAlignment & | defaultValue | ||
) | const |
Return the BAlignment object from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
bool BMessage::GetBool | ( | const char * | name, |
bool | defaultValue = false |
||
) | const |
Return the boolean value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
bool BMessage::GetBool | ( | const char * | name, |
int32 | index, | ||
bool | defaultValue | ||
) | const |
Return the boolean value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the rgb_color value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the rgb_color value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
status_t BMessage::GetCurrentSpecifier | ( | int32 * | index, |
BMessage * | specifier = NULL , |
||
int32 * | what = NULL , |
||
const char ** | property = NULL |
||
) | const |
Undocumented.
double BMessage::GetDouble | ( | const char * | name, |
double | defaultValue | ||
) | const |
Return the double value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
double BMessage::GetDouble | ( | const char * | name, |
int32 | index, | ||
double | defaultValue | ||
) | const |
Return the double value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
float BMessage::GetFloat | ( | const char * | name, |
float | defaultValue | ||
) | const |
Return the float value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
float BMessage::GetFloat | ( | const char * | name, |
int32 | index, | ||
float | defaultValue | ||
) | const |
Return the float value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Retrieve the type and whether or not the size of the data is fixed associated with a name.
This method is the same as GetInfo(const char*, type_code*, int32*) const, with the difference that you can find out whether or not the size of the data associated with the name is fixed. You will get this value in the variable you passed as fixedSize parameter.
status_t BMessage::GetInfo | ( | const char * | name, |
type_code * | typeFound, | ||
int32 * | countFound, | ||
bool * | fixedSize | ||
) | const |
Retrieve the type and whether or not the size of the data is fixed associated with a name.
This method is the same as GetInfo(const char*, type_code*, int32*) const, with the difference that you can find out whether or not the size of the data associated with the name is fixed. You will get this value in the variable you passed as fixedSize parameter.
status_t BMessage::GetInfo | ( | const char * | name, |
type_code * | typeFound, | ||
int32 * | countFound = NULL |
||
) | const |
Retrieve the type and the number of data items in this message that are associated with a name.
[in] | name | The name of the data member that you are looking for. |
[out] | typeFound | In case of a match, the name of the data member will be put in this parameter. In case you are not interested, you can pass NULL . |
[out] | countFound | In case of a match, the number of items at this label will be in this parameter. In case you are not interested, you can safely pass NULL . |
B_OK | A match was found. The other parameters have been filled in. |
B_BAD_VALUE | You passed NULL as argument to name. |
B_NAME_NOT_FOUND | There is no data with the label name. |
status_t BMessage::GetInfo | ( | type_code | typeRequested, |
int32 | index, | ||
char ** | nameFound, | ||
type_code * | typeFound, | ||
int32 * | countFound = NULL |
||
) | const |
Retrieve the name, the type and the number of items in a message by an index.
[in] | typeRequested | If you want to limit the search to only one type, pass that type code here. If you don't care which type the data has, you can pass B_ANY_TYPE . |
[in] | index | The index of the data you want to investigate. |
[out] | nameFound | The name of the item if it is found. Haiku will fill in a pointer to the internal name buffer in the message. This means that you should not manipulate this name. If you are not interested in the name, you can safely pass NULL . |
[out] | typeFound | The type of the item at index. If you are not interested in the type (because you specifically asked for a type), you can safely pass NULL . |
[out] | countFound | The number of items at index. If data items have the same name, they will be placed under the same index. |
B_OK | An match was found. The values have been filled in. |
B_BAD_INDEX | The index was out of range. None of the passed variables have been altered. |
B_BAD_TYPE | The data field at index does not have the requested type. |
Return the int16 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int16 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int32 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int32 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int64 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int64 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int8 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the int8 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the BPoint object from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the BPoint object from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
const void * BMessage::GetPointer | ( | const char * | name, |
const void * | defaultValue = NULL |
||
) | const |
Return the pointer type from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
rgb_color BMessage::GetPointer | ( | const char * | name, |
int32 | index, | ||
const void * | defaultValue = NULL |
||
) | const |
Return the pointer type from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the BRect object from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the BRect object from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the BSize object from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the BSize object from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
const char * BMessage::GetString | ( | const char * | name, |
const char * | defaultValue = NULL |
||
) | const |
Return the string from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
const char * BMessage::GetString | ( | const char * | name, |
int32 | index, | ||
const char * | defaultValue | ||
) | const |
Return the string from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint16 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint16 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint32 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint32 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint64 value from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint64 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint8 message from message with name and index, or defaultValue if not found.
name | The name of the item to retrieve. |
index | The index of the item to retrieve if there is more than one. |
defaultValue | The value to use if the item specified by name is not found. |
Return the uint8 value from message with name, or defaultValue if not found.
name | The name of the item to retrieve. |
defaultValue | The value to use if the item specified by name is not found. |
bool BMessage::HasAlignment | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasBool | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasColor | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
Deprecated.
bool BMessage::HasDouble | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasFlat | ( | const char * | name, |
const BFlattenable * | object | ||
) | const |
Deprecated.
bool BMessage::HasFlat | ( | const char * | name, |
int32 | n, | ||
const BFlattenable * | object | ||
) | const |
Deprecated.
bool BMessage::HasFloat | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasInt16 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasInt32 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasInt64 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasInt8 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasMessage | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasMessenger | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasNodeRef | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasPoint | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasPointer | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasRect | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasRef | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasSameData | ( | const BMessage & | other, |
bool | ignoreFieldOrder = true , |
||
bool | deep = false |
||
) | const |
Experimental method to compare two messages.
This helper method will compare the data of this message to another message. The name if the fields, and the contents of the fields are compared. Metadata (like the delivery status) and the BMessage::what field are not compared.
The order of the fields is determined by the order that the fields are added. You may use the ignoreFieldOrder argument to tweak whether you care that not only the data is identical, but also the ordering of the data.
When there are BMessages attached to this message, you might want to use this algorithm to compare them as well (as to ignore non-data fields of the other message or the ordering of fields during the comparison). Setting the deep parameter will cause any data of the B_MESSAGE_TYPE
to be compared using this method, thus ignoring non-data differences. If you set deep to false
, the data will be compared on a byte by byte basis and these differences in the non-data fields will not be ignored.
other | The other message to compare to. |
ignoreFieldOrder | Whether you want to see if the field order is the same. |
deep | Whether you want to recursively inspect BMessages embedded in this message. |
true
if the data is the same, false
otherwisebool BMessage::HasSize | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasSpecifiers | ( | ) | const |
Undocumented.
bool BMessage::HasString | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasUInt16 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasUInt32 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasUInt64 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::HasUInt8 | ( | const char * | name, |
int32 | n = 0 |
||
) | const |
Deprecated.
bool BMessage::IsEmpty | ( | ) | const |
Check if the message has data members.
true
, else it will return false
.bool BMessage::IsReply | ( | ) | const |
Check if the message is a reply to a (previous) message.
true
.bool BMessage::IsSourceRemote | ( | ) | const |
Check if the message is sent by another application.
bool BMessage::IsSourceWaiting | ( | ) | const |
Check if the sender expects a reply.
This method will return true
, if the sender flagged that it is waiting for a reply, and such a reply has not yet been sent.
bool BMessage::IsSystem | ( | ) | const |
Check if the message is a system message.
true
.status_t BMessage::MakeEmpty | ( | ) |
Clear all data and metadata in this message.
Everything is cleared out, all labels and all associated data, as well as metadata such as reply info.
B_OK
.void BMessage::operator delete | ( | void * | pointer, |
size_t | size | ||
) |
Frees memory allocated by new.
void * BMessage::operator new | ( | size_t | size | ) |
Allocates size bytes of memory for a BMessage.
void * BMessage::operator new | ( | size_t | , |
const std::nothrow_t & | noThrow | ||
) |
Allocates size bytes of memory for a BMessage.
void * BMessage::operator new | ( | size_t | , |
void * | pointer | ||
) |
Allocates size bytes of memory for a BMessage.
Copy one message into another.
See the copy constructor, BMessage(const BMessage& other), for details on what is copied, and what isn't.
status_t BMessage::PopSpecifier | ( | ) |
Undocumented.
const BMessage * BMessage::Previous | ( | ) | const |
Get the message to which this message is a reply.
NULL
.void BMessage::PrintToStream | ( | ) | const |
Print the message to the standard output.
This method can be used to debug your application. It can be used to check if it creates the messages properly, by checking if all the required fields are present, and it can be used to debug your message handling routines, especially the handling of those that are sent by external applications, to see if you understand the semantics correctly.
Remove data associated with name at a specified index.
If this is the only instance of the data, then the entire label will be removed. This means you can recreate it with another type.
name | The name of which the associated data should be cleared. |
index | The index of the item that should be cleared. |
B_OK
on success or an error code. B_OK | The data has been removed. |
B_BAD_VALUE | The index is less than 0 . |
B_BAD_INDEX | The index is out of bounds. |
B_NAME_NOT_FOUND | The name does not have any data associated with it. |
status_t BMessage::RemoveName | ( | const char * | name | ) |
Remove all data associated with a name.
This also removes the label, so that you can recreate it with another type, if you want to.
name | The name that refers to the data you want to clear out. |
B_OK
on success or an error code. B_OK | All the data is removed. |
B_BAD_VALUE | The name pointer points to NULL . |
B_NAME_NOT_FOUND | The name does not exist in this message. |
status_t BMessage::Rename | ( | const char * | oldEntry, |
const char * | newEntry | ||
) |
Rename a data label.
oldEntry | The name of the label you want to rename. |
newEntry | The new name of the data entry. |
B_OK
on success or an error code. B_OK | Renaming succeeded. |
B_BAD_VALUE | Either the oldEntry or the newEntry pointers are NULL . |
B_NAME_NOT_FOUND | There is no data associated with the label oldEntry. |
status_t BMessage::ReplaceAlignment | ( | const char * | name, |
const BAlignment & | alignment | ||
) |
Replace an alignment at the label name.
This method is an overloaded method of ReplaceAlignment(const char*, int32, const BAlignment&). It replaces the data at index 0
.
name | The name associated with the data to replace. |
alignment | The object to store in the message. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceAlignment | ( | const char * | name, |
int32 | index, | ||
const BAlignment & | alignment | ||
) |
Replace an alignment at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_ALIGNMENT_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
alignment | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceBool | ( | const char * | name, |
bool | aBoolean | ||
) |
Replace a boolean at the label name.
This method is an overloaded method of ReplaceBool(const char*, int32, bool). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aBoolean | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a boolean at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_BOOL_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aBoolean | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a rgb_color at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_RGB_32_BIT_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aColor | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a color at the label name.
This method is an overloaded method of ReplaceColor(const char*, int32, rgb_color). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aColor | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceData | ( | const char * | name, |
type_code | type, | ||
const void * | data, | ||
ssize_t | numBytes | ||
) |
Replace the data at label name.
This method is an overloaded method that replaces the data at index 0
. See ReplaceData(const char*, type_code, int32, const void*, ssize_t).
name | The name associated with the data to replace. |
type | The type of the data. |
data | A pointer to the new data that needs to be copied into the message. |
numBytes | The size of the new data. |
B_OK
on success or an error code.status_t BMessage::ReplaceData | ( | const char * | name, |
type_code | type, | ||
int32 | index, | ||
const void * | data, | ||
ssize_t | numBytes | ||
) |
Replace the data at label name at a specified index.
The conditions for replacing data are that thename is correct, the type matches and the data entry at index exists.
There is also a collection of convenience methods, that allow you to efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()), and so on.
name | The name associated with the data to replace. |
type | The type of the data. |
index | The index in the array to replace. |
data | A pointer to the new data that needs to be copied into the message. |
numBytes | The size of the new data. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_VALUE | One of the input parameters are invalid. Check that you did not pass NULL , and in case the field has fixed sized data, check that numBytes is the same as the specified fixed size. |
B_BAD_INDEX | The index is out of range. |
status_t BMessage::ReplaceDouble | ( | const char * | name, |
double | aDouble | ||
) |
Replace a double at the label name.
This method is an overloaded method of ReplaceDouble(const char*, int32, double). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aDouble | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a double at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_DOUBLE_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aDouble | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceFlat | ( | const char * | name, |
BFlattenable * | object | ||
) |
Replace a flattened object at the label name.
This method is an overloaded method of ReplaceFlat(const char*, int32, BFlattenable*).
It replaces the data at index 0
.
name | The name associated with the data to replace. |
object | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceFlat | ( | const char * | name, |
int32 | index, | ||
BFlattenable * | object | ||
) |
Replace a flattened object at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the type returned by your object. This method uses BFlattenable::TypeCode() to determine the type of the object.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
object | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceFloat | ( | const char * | name, |
float | aFloat | ||
) |
Replace a float at the label name.
This method is an overloaded method of ReplaceFloat(const char*, int32, float). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aFloat | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a float at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_FLOAT_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aFloat | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceInt16(const char*, int32, int16). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_INT16_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_INT32_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceInt32(const char*, int32, int32). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_INT64_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceInt64(const char*, int32, int64). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_INT8_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceInt8(const char*, int32, int8). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a message at the label name.
This method is an overloaded method of ReplaceMessage(const char*, int32, BMessage*). It replaces the data at index 0
.
name | The name associated with the data to replace. |
message | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a message at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_MESSAGE_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
message | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceMessenger | ( | const char * | name, |
BMessenger | messenger | ||
) |
Replace a messenger at the label name.
This method is an overloaded method of ReplaceMessenger(const char*, int32, BMessenger). It replaces the data at index 0
.
name | The name associated with the data to replace. |
messenger | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceMessenger | ( | const char * | name, |
int32 | index, | ||
BMessenger | messenger | ||
) |
Replace a messenger at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_MESSENGER_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
messenger | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a reference to a node at the label name.
This method is an overloaded method of ReplaceNodeRef(const char*, int32, node_ref*). It replaces the data at index 0
.
name | The name associated with the data to replace. |
ref | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a reference to a node at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_NODE_REF_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
ref | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a point at the label name.
This method is an overloaded method of ReplacePoint(const char*, int32, BPoint). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aPoint | The object to store in the message. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a point at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_POINT_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aPoint | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplacePointer | ( | const char * | name, |
const void * | pointer | ||
) |
Replace a pointer at the label name.
This method is an overloaded method of ReplacePointer(const char*, int32, const void*). It replaces the data at index 0
.
name | The name associated with the data to replace. |
pointer | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a pointer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_POINTER_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
pointer | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a rectangle at the label name.
This method is an overloaded method of ReplaceRect(const char*, int32, BRect). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aRect | The object to store in the message. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a rectangle at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_RECT_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aRect | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a reference to a file at the label name.
This method is an overloaded method of ReplaceRef(const char*, int32, entry_ref*). It replaces the data at index 0
.
name | The name associated with the data to replace. |
ref | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a reference to a file at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_REF_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
ref | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a size at the label name.
This method is an overloaded method of ReplaceSize(const char*, int32, BSize). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aSize | The object to store in the message. |
B_OK
on success or an error code. B_OK | The object now contains the requested data. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a size at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_SIZE_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aSize | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a string at the label name.
This method is an overloaded method of ReplaceString(const char*, int32, BString&). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aString | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
status_t BMessage::ReplaceString | ( | const char * | name, |
const char * | aString | ||
) |
Replace a string at the label name.
This method is an overloaded method of ReplaceString(const char*, int32, const char*). It replaces the data at index 0
.
name | The name associated with the data to replace. |
aString | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a string at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_STRING_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aString | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace a string at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_STRING_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
aString | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_UINT16_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceUInt16(const char*, int32, uint16). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_UINT32_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceUInt32(const char*, int32, uint32). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_UINT64_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | The object to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceUInt64(const char*, int32, uint64). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name at a specified index.
The data at the specified name and index will be replaced, if it matches the B_UINT8_TYPE
.
name | The name associated with the data to replace. |
index | The index in the array to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_BAD_INDEX | The index was out of range. |
B_NAME_NOT_FOUND | There is no field with this name. |
Replace an integer at the label name.
This method is an overloaded method of ReplaceUInt8(const char*, int32, uint8). It replaces the data at index 0
.
name | The name associated with the data to replace. |
value | Where to store in the message. |
B_OK
on success or an error code. B_OK | The operation succeeded. |
B_NAME_NOT_FOUND | There is no field with this name. |
BMessenger BMessage::ReturnAddress | ( | ) | const |
Get a messenger that points to the sender of the message.
Using this method, you can fetch a BMessenger that can be used to deliver replies to this message. This method works both for local and remote deliveries.
For remote deliveries, this approach is preferred over sending the reply using a standard BMessenger that is created with the signature of the application. A standard BMessenger sends the messages to the main BLooper of the application, the BApplication object. With the delivery data stored in the messages, the reply using this messenger will be directed at a specific looper that is able to handle the replies.
If this method is called on a message that has not been delivered (yet), it will return an empty BMessenger object.
status_t BMessage::SendReply | ( | BMessage * | reply, |
BHandler * | replyTo = NULL , |
||
bigtime_t | timeout = B_INFINITE_TIMEOUT |
||
) |
Asynchronously send a reply to this message.
This is an overloaded member of SendReply(BMessage*, BMessenger, bigtime_t). Use this variant if you want to send the message to a specific handler (instead of a complete messenger).
status_t BMessage::SendReply | ( | BMessage * | reply, |
BMessage * | replyToReply, | ||
bigtime_t | sendTimeout = B_INFINITE_TIMEOUT , |
||
bigtime_t | replyTimeout = B_INFINITE_TIMEOUT |
||
) |
Synchronously send a reply to this message, and wait for a reply back.
This method sends a reply to this message to the sender. The reply is delivered, and then the method waits for a reply from the receiver. If a reply is received, that reply is copied into the replyToReply argument. If the message was delivered properly, but the receiver did not reply within the specified replyTimeout, the what member of replyToReply will be set to B_NO_REPLY
.
reply | The message that is in reply to this message. | |
[out] | replyToReply | The reply is copied into this argument. |
sendTimeout | The maximum time in microseconds this delivery may take. The timeout is a relative timeout. You can also use B_INFINITE_TIMEOUT if you want to wait infinitely for the message to be delivered. | |
replyTimeout | The maximum time in microseconds you want to wait for a reply. Note that the timer starts when the message has been delivered. |
B_OK
on success or an error code. B_OK | The message has been delivered. |
B_DUPLICATE_REPLY | There already has been a reply to this message. |
B_BAD_VALUE | Either reply or replyToReply is NULL . |
B_BAD_PORT_ID | The reply address is not valid (anymore). |
B_WOULD_BLOCK | The delivery timeout was B_INFINITE_TIMEOUT (0 ) and the target port was full when trying to deliver the message. |
B_TIMED_OUT | The timeout expired while trying to deliver the message. |
B_NO_MORE_PORTS | All reply ports are in use. |
status_t BMessage::SendReply | ( | BMessage * | reply, |
BMessenger | replyTo, | ||
bigtime_t | timeout = B_INFINITE_TIMEOUT |
||
) |
Asynchronously send a reply to this message.
This method sends a reply to this message to the sender. On your turn, you specify a messenger that handles a reply back to the message you specify as the reply argument. You can set a timeout for the message to be delivered. This method blocks until the message has been received, or the timeout has been reached.
reply | The message that is in reply to this message. |
replyTo | In case the receiver needs to reply to the message you are sending, you can specify the return address with this argument. |
timeout | The maximum time in microseconds this delivery may take. The timeout is a relative timeout. You can also use B_INFINITE_TIMEOUT if you want to wait infinitely for the message to be delivered. |
B_OK
on success or an error code. B_OK | The message has been delivered. |
B_DUPLICATE_REPLY | There already has been a reply to this message. |
B_BAD_PORT_ID | The reply address is not valid (anymore). |
B_WOULD_BLOCK | The delivery timeout was B_INFINITE_TIMEOUT (0 ) and the target port was full when trying to deliver the message. |
B_TIMED_OUT | The timeout expired while trying to deliver the message. |
Asynchronously send a reply to this message.
This is an overloaded member of SendReply(BMessage*, BMessenger, bigtime_t). Use this variant if you want to send a message without data members.
Synchronously send a reply to this message, and wait for a reply back.
This is an overloaded member of SendReply(BMessage*, BMessage*, bigtime_t, bigtime_t) Use this variant if you want to send a message without data members.
status_t BMessage::SetAlignment | ( | const char * | name, |
const BAlignment & | value | ||
) |
Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddAlignment(const char*, const BAlignment &) in case the item does not exist yet, and ReplaceAlignment(const char*, const BAlignment &) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.status_t BMessage::SetBool | ( | const char * | name, |
bool | value | ||
) |
Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddBool(const char*, bool) in case the item does not exist yet, and ReplaceBool(const char*, bool) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddColor(const char*, rgb_color) in case the item does not exist yet, and ReplaceColor(const char*, rgb_color) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.status_t BMessage::SetData | ( | const char * | name, |
type_code | type, | ||
const void * | data, | ||
ssize_t | numBytes, | ||
bool | fixedSize = true , |
||
int | count = 1 |
||
) |
Low level function to set data to a certain value.
This method is used internally. Use the Set* methods above.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.status_t BMessage::SetDouble | ( | const char * | name, |
double | value | ||
) |
Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddDouble(const char*, double) in case the item does not exist yet, and ReplaceDouble(const char*, double) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.status_t BMessage::SetFloat | ( | const char * | name, |
float | value | ||
) |
Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddFloat(const char*, float) in case the item does not exist yet, and ReplaceFloat(const char*, float) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddInt16(const char*, int16) in case the item does not exist yet, and ReplaceInt16(const char*, int16) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddInt32(const char*, int32) in case the item does not exist yet, and ReplaceInt32(const char*, int32) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddInt64(const char*, int64) in case the item does not exist yet, and ReplaceInt64(const char*, int64) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddInt8(const char*, int8) in case the item does not exist yet, and ReplaceInt8(const char*, int8) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddPoint(const char*, const BPoint &) in case the item does not exist yet, and ReplacePoint(const char*, const BPoint &) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.status_t BMessage::SetPointer | ( | const char * | name, |
const void * | value | ||
) |
Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddPointer(const char*, const void*) in case the item does not exist yet, and ReplacePointer(const char*, const void*) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddRect(const char*, const BRect &) in case the item does not exist yet, and ReplaceRect(const char*, const BRect &) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddSize(const char*, const BSize &) in case the item does not exist yet, and ReplaceSize(const char*, const BSize &) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the string with at the label name to string.
name | The name of the item. |
string | The value to set the item to. |
This function calls AddString(const char*, const BString&) in case the item does not exist yet, and ReplaceString(const char*, const BString&) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.status_t BMessage::SetString | ( | const char * | name, |
const char * | string | ||
) |
Set the string with at the label name to string.
name | The name of the item. |
string | The value to set the item to. |
This function calls AddString(const char*, const char*) in case the item does not exist yet, and ReplaceString(const char*, const char*) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddUInt16(const char*, uint16) in case the item does not exist yet, and ReplaceUInt16(const char*, uint16) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddUInt32(const char*, uint32) in case the item does not exist yet, and ReplaceUInt32(const char*, uint32) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddUInt64(const char*, uint64) in case the item does not exist yet, and ReplaceUInt64(const char*, uint64) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Set the data with at the label name to value.
name | The name of the item. |
value | The value to set the item to. |
This function calls AddUInt8(const char*, uint8) in case the item does not exist yet, and ReplaceUInt8(const char*, uint8) in case it does.
B_OK
in case of success and B_BAD_TYPE
in case the item already exists with a different data type.Unflatten a message from a stream and put it into the current object.
This action clears the current contents of the message.
stream | The stream that contains the message. |
B_OK
on success or an error code. B_OK | The message has been unflattened. |
B_BAD_VALUE | The stream does not contain a valid message. |
B_NO_MEMORY | An error occured whilst allocating memory for the data members. |
status_t BMessage::Unflatten | ( | const char * | flatBuffer | ) |
Unflatten a message from a buffer and put it into the current object.
This action clears the current contents of the message.
flatBuffer | The buffer that contains the message. |
B_OK
on success or an error code. B_OK | The buffer has been unflattened. |
B_BAD_VALUE | The buffer does not contain a valid message. |
B_NO_MEMORY | An error occured whilst allocating memory for the data members. |
bool BMessage::WasDelivered | ( | ) | const |
Check if this message was delivered through the delivery methods.
If this message is passed via a BMessenger or BLooper::PostMessage(), this method will return true
.
bool BMessage::WasDropped | ( | ) | const |
Check if the message was delivered through 'drag and drop'.
true
if the message has been delivered through drag and drop. It returns false
if it has been delivered through the regular messaging functions, or if the message has not been delivered at all.BMessage::what |
A 4-byte constant that determines the type of message.
You can directly manipulate this data member.