Message Class Reference

This class is similar to a BMessage, but portable. More...

#include <Message.h>

Inheritance diagram for Message:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Message ()
 Default Constructor.
 Message (uint32 what)
 Constructor.
 Message (const Message &copyMe)
 Copy Constructor.
virtual ~Message ()
 Destructor.
Messageoperator= (const Message &msg)
 Assignment operator.
bool operator== (const Message &rhs) const
 Comparison operator.
bool operator!= (const Message &rhs) const
 Returns the opposite of the == operator.
status_t GetInfo (const String &name, uint32 *type, uint32 *c=NULL, bool *fixed_size=NULL) const
 Retrieve information about the given field in this message.
uint32 CountNames (uint32 type=B_ANY_TYPE) const
 Returns the number of fields of the given type that are present in the Message.
bool HasNames (uint32 type=B_ANY_TYPE) const
 Returns true if there are any fields of the given type in the Message.
bool IsEmpty () const
 
Returns:
true iff there are no fields in this Message.

void PrintToStream (bool recursive=true, int indentLevel=0) const
 Prints debug info describing the contents of this Message to stdout.
String ToString (bool recursive=true, int indentLevel=0) const
 Same as PrintToStream(), only the state of the Message is returned as a String instead of being printed to stdout.
void AddToString (String &s, bool recursive=true, int indentLevel=0) const
 Same as ToString(), except the text is added to the given String instead of being returned as a new String.
status_t Rename (const String &old_entry, const String &new_entry)
 Renames a field.
virtual bool IsFixedSize () const
 Returns false (Messages can be of various sizes, depending on how many fields they have, etc.
virtual uint32 TypeCode () const
 Returns B_MESSAGE_TYPE.
virtual uint32 FlattenedSize () const
 Returns The number of bytes it would take to flatten this Message into a byte buffer.
virtual void Flatten (uint8 *buffer) const
 Converts this Message into a flattened buffer of bytes that can be saved to disk or sent over a network, and later converted back into an identical Message object.
virtual status_t Unflatten (const uint8 *buf, uint32 size)
 Convert the given byte buffer back into a Message.
status_t AddString (const String &name, const String &val)
 Adds a new string to the Message.
status_t AddInt8 (const String &name, int8 val)
 Adds a new int8 to the Message.
status_t AddInt16 (const String &name, int16 val)
 Adds a new int16 to the Message.
status_t AddInt32 (const String &name, int32 val)
 Adds a new int32 to the Message.
status_t AddInt64 (const String &name, int64 val)
 Adds a new int64 to the Message.
status_t AddBool (const String &name, bool val)
 Adds a new boolean to the Message.
status_t AddFloat (const String &name, float val)
 Adds a new float to the Message.
status_t AddDouble (const String &name, double val)
 Adds a new double to the Message.
status_t AddMessage (const String &name, const Message &msg)
 Adds a new Message to the Message.
status_t AddMessage (const String &name, const MessageRef &msgRef)
 Adds a new Message to the Message.
status_t AddPointer (const String &name, const void *ptr)
 Adds a new pointer value to the Message.
status_t AddPoint (const String &name, const Point &point)
 Adds a new point to the Message.
status_t AddRect (const String &name, const Rect &rect)
 Adds a new rect to the Message.
status_t AddFlat (const String &name, const Flattenable &obj)
 Flattens a Flattenable object into the Message.
status_t AddFlat (const String &name, const FlatCountableRef &ref)
 Adds a reference to a FlatCountable object to the Message.
status_t AddFlat (const String &name, const ByteBufferRef &ref)
 Adds a reference to a ByteBuffer object to the Message.
status_t AddTag (const String &name, const GenericRef &tagRef)
 Adds a new ephemeral-tag-item to this Message.
status_t AddData (const String &name, uint32 type, const void *data, uint32 numBytes)
 Generic method, capable of adding any type of data to the Message.
status_t PrependString (const String &name, const String &val)
 Prepends a new string to the beginning of a field array in the Message.
status_t PrependInt8 (const String &name, int8 val)
 Prepends a new int8 to the beginning of a field array in the Message.
status_t PrependInt16 (const String &name, int16 val)
 Prepends a new int16 to the beginning of a field array in the Message.
status_t PrependInt32 (const String &name, int32 val)
 Prepends a new int32 to the beginning of a field array in the Message.
status_t PrependInt64 (const String &name, int64 val)
 Prepends a new int64 to the beginning of a field array in the Message.
status_t PrependBool (const String &name, bool val)
 Prepends a new boolean to the beginning of a field array in the Message.
status_t PrependFloat (const String &name, float val)
 Prepends a new float to the beginning of a field array in the Message.
status_t PrependDouble (const String &name, double val)
 Prepends a new double to the beginning of a field array in the Message.
status_t PrependMessage (const String &name, const Message &msg)
 Prepends a new Message to the beginning of a field array in the Message.
status_t PrependMessage (const String &name, const MessageRef &msgRef)
 Prepends a new Message to the beginning of a field array in the Message.
status_t PrependPointer (const String &name, const void *ptr)
 Prepends a new pointer value to the beginning of a field array in the Message.
status_t PrependPoint (const String &name, const Point &point)
 Prepends a new point to the beginning of a field array in the Message.
status_t PrependRect (const String &name, const Rect &rect)
 Prepends a new rectangle to the beginning of a field array in the Message.
status_t PrependFlat (const String &name, const Flattenable &obj)
 Flattens the given object and prepends the resulting bytes into beginning of a field array in the Message.
status_t PrependFlat (const String &name, const FlatCountableRef &flatRef)
 Prepends a reference to a FlatCountable object to the Message.
status_t PrependFlat (const String &name, const ByteBufferRef &ref)
 Prepends a reference to a ByteBuffer object to the Message.
status_t PrependTag (const String &name, const GenericRef &tagRef)
 Prepends a new ephemeral-tag-item to this Message.
status_t PrependData (const String &name, uint32 type, const void *data, uint32 numBytes)
 Generic method, capable of prepending any type of data to the Message.
status_t RemoveData (const String &name, uint32 index=0)
 Removes the (index)'th item from the given field entry.
status_t RemoveName (const String &name)
 Removes the given field name and its contents from the Message.
void Clear (bool releaseCachedBuffers=false)
 Clears all fields from the Message.
status_t FindString (const String &name, uint32 index, const String **setMe) const
 Retrieve a string value from the Message.
status_t FindString (const String &name, const String **setMe) const
 As above, only (index) isn't specified.
status_t FindString (const String &name, uint32 index, const char **setMe) const
 Retrieve a string value from the Message.
status_t FindString (const String &name, const char **setMe) const
 As above, only (index) isn't specified.
status_t FindString (const String &name, uint32 index, String &setMe) const
 Retrieve a string value from the Message.
status_t FindString (const String &name, String &setMe) const
 As above, only (index) isn't specified.
status_t FindInt8 (const String &name, uint32 index, int8 *val) const
 Retrieve an int8 value from the Message.
status_t FindInt8 (const String &name, int8 *value) const
 As above, only (index) isn't specified.
status_t FindInt16 (const String &name, uint32 index, int16 *val) const
 Retrieve an int16 value from the Message.
status_t FindInt16 (const String &name, int16 *value) const
 As above, only (index) isn't specified.
status_t FindInt32 (const String &name, uint32 index, int32 *val) const
 Retrieve an int32 value from the Message.
status_t FindInt32 (const String &name, int32 *value) const
 As above, only (index) isn't specified.
status_t FindInt64 (const String &name, uint32 index, int64 *val) const
 Retrieve an int64 value from the Message.
status_t FindInt64 (const String &name, int64 *value) const
 As above, only (index) isn't specified.
status_t FindBool (const String &name, uint32 index, bool *val) const
 Retrieve a boolean value from the Message.
status_t FindBool (const String &name, bool *value) const
 As above, only (index) isn't specified.
status_t FindFloat (const String &name, uint32 index, float *val) const
 Retrieve a float value from the Message.
status_t FindFloat (const String &name, float *f) const
 As above, only (index) isn't specified.
status_t FindDouble (const String &name, uint32 index, double *val) const
 Retrieve a double value from the Message.
status_t FindDouble (const String &name, double *d) const
 As above, only (index) isn't specified.
status_t FindMessage (const String &name, uint32 index, Message &msg) const
 Retrieve a Message value from the Message.
status_t FindMessage (const String &name, Message &msg) const
 As above, only (index) isn't specified.
status_t FindMessage (const String &name, uint32 index, MessageRef &msgRef) const
 Retrieve a Message value from the Message.
status_t FindMessage (const String &name, MessageRef &msgRef) const
 As above, only (index) isn't specified.
status_t FindPointer (const String &name, uint32 index, void **val) const
 Retrieve a pointer value from the Message.
status_t FindPointer (const String &name, void **ptr) const
 As above, only (index) isn't specified.
status_t FindPoint (const String &name, uint32 index, Point &point) const
 Retrieve a point value from the Message.
status_t FindPoint (const String &name, Point &point) const
 As above, only (index) isn't specified.
status_t FindRect (const String &name, uint32 index, Rect &rect) const
 Retrieve a rectangle value from the Message.
status_t FindRect (const String &name, Rect &rect) const
 As above, only (index) isn't specified.
status_t FindFlat (const String &name, uint32 index, Flattenable &obj) const
 Retrieve a flattened object from the Message.
status_t FindFlat (const String &name, Flattenable &obj) const
 As above, only (index) isn't specified.
status_t FindFlat (const String &name, uint32 index, FlatCountableRef &ref) const
 Retrieve a FlatCountable reference from the Message.
status_t FindFlat (const String &name, FlatCountableRef &ref) const
 As above, only (index) isn't specified.
status_t FindFlat (const String &name, uint32 index, ByteBufferRef &ref) const
 Convenience method: As above, only the result is placed into the given ByteBufferRef object.
status_t FindFlat (const String &name, ByteBufferRef &ref) const
 As above, only (index) isn't specified.
status_t FindTag (const String &name, uint32 index, GenericRef &tagRef) const
 Retrieve an ephemeral-tag-item from the Message.
status_t FindTag (const String &name, GenericRef &tagRef) const
 As above, only (index) isn't specified.
status_t FindData (const String &name, uint32 type, uint32 index, const void **data, uint32 *numBytes) const
 Retrieve a pointer to the raw data bytes of a stored message field of any type.
status_t FindData (const String &name, uint32 type, const void **data, uint32 *numBytes) const
 As above, only (index) isn't specified.
status_t FindDataPointer (const String &name, uint32 type, uint32 index, void **data, uint32 *numBytes) const
 As above, only this returns a pointer to an array that you can write directly into, for efficiency.
status_t FindDataPointer (const String &name, uint32 type, void **data, uint32 *numBytes) const
 As above, only (index) isn't specified.
status_t ReplaceString (bool okayToAdd, const String &name, uint32 index, const String &newString)
 Replace a string value in an existing Message field with a new value.
status_t ReplaceString (bool okayToAdd, const String &name, const String &newString)
 As above, only (index) isn't specified.
status_t ReplaceInt8 (bool okayToAdd, const String &name, uint32 index, int8 val)
 Replace an int8 value in an existing Message field with a new value.
status_t ReplaceInt8 (bool okayToAdd, const String &name, int8 val)
 As above, only (index) isn't specified.
status_t ReplaceInt16 (bool okayToAdd, const String &name, uint32 index, int16 val)
 Replace an int16 value in an existing Message field with a new value.
status_t ReplaceInt16 (bool okayToAdd, const String &name, int16 val)
 As above, only (index) isn't specified.
status_t ReplaceInt32 (bool okayToAdd, const String &name, uint32 index, int32 val)
 Replace an int32 value in an existing Message field with a new value.
status_t ReplaceInt32 (bool okayToAdd, const String &name, int32 val)
 As above, only (index) isn't specified.
status_t ReplaceInt64 (bool okayToAdd, const String &name, uint32 index, int64 val)
 Replace an int64 value in an existing Message field with a new value.
status_t ReplaceInt64 (bool okayToAdd, const String &name, int64 val)
 As above, only (index) isn't specified.
status_t ReplaceBool (bool okayToAdd, const String &name, uint32 index, bool val)
 Replace a boolean value in an existing Message field with a new value.
status_t ReplaceBool (bool okayToAdd, const String &name, bool val)
 As above, only (index) isn't specified.
status_t ReplaceFloat (bool okayToAdd, const String &name, uint32 index, float val)
 Replace a float value in an existing Message field with a new value.
status_t ReplaceFloat (bool okayToAdd, const String &name, float val)
 As above, only (index) isn't specified.
status_t ReplaceDouble (bool okayToAdd, const String &name, uint32 index, double val)
 Replace a double value in an existing Message field with a new value.
status_t ReplaceDouble (bool okayToAdd, const String &name, double val)
 As above, only (index) isn't specified.
status_t ReplacePointer (bool okayToAdd, const String &name, uint32 index, const void *ptr)
 Replace a pointer value in an existing Message field with a new value.
status_t ReplacePointer (bool okayToAdd, const String &name, const void *ptr)
 As above, only (index) isn't specified.
status_t ReplacePoint (bool okayToAdd, const String &name, uint32 index, const Point &point)
 Replace a point value in an existing Message field with a new value.
status_t ReplacePoint (bool okayToAdd, const String &name, const Point &point)
 As above, only (index) isn't specified.
status_t ReplaceRect (bool okayToAdd, const String &name, uint32 index, const Rect &rect)
 Replace a rectangle value in an existing Message field with a new value.
status_t ReplaceRect (bool okayToAdd, const String &name, const Rect &rect)
 As above, only (index) isn't specified.
status_t ReplaceMessage (bool okayToAdd, const String &name, uint32 index, const Message &msg)
 Replace a Message value in an existing Message field with a new value.
status_t ReplaceMessage (bool okayToAdd, const String &name, const Message &msg)
 As above, only (index) isn't specified.
status_t ReplaceMessage (bool okayToAdd, const String &name, uint32 index, const MessageRef &msgRef)
 Replace a Message value in an existing Message field with a new value.
status_t ReplaceMessage (bool okayToAdd, const String &name, const MessageRef &msgRef)
 As above, only (index) isn't specified.
status_t ReplaceFlat (bool okayToAdd, const String &name, uint32 index, const Flattenable &obj)
 Replace a flattened object in an existing Message field with a new object.
status_t ReplaceFlat (bool okayToAdd, const String &name, const Flattenable &obj)
 As above, only (index) isn't specified.
status_t ReplaceFlat (bool okayToAdd, const String &name, uint32 index, const FlatCountableRef &ref)
 Replace a FlatCountable reference in an existing Message field with a new reference.
status_t ReplaceFlat (bool okayToAdd, const String &name, FlatCountableRef &ref)
 As above, only (index) isn't specified.
status_t ReplaceFlat (bool okayToAdd, const String &name, uint32 index, const ByteBufferRef &ref)
 As above, only (ref) is specified as a ByteBufferRef, to save you having to do the necessary casting to FlatCountableRef yourself.
status_t ReplaceFlat (bool okayToAdd, const String &name, ByteBufferRef &ref)
 As above, only (index) isn't specified.
status_t ReplaceTag (bool okayToAdd, const String &name, uint32 index, const GenericRef &tag)
 Replace a tag object in an existing Message field with a new tag object.
status_t ReplaceTag (bool okayToAdd, const String &name, const GenericRef &tag)
 As above, only (index) isn't specified.
status_t ReplaceData (bool okayToAdd, const String &name, uint32 type, uint32 index, const void *data, uint32 numBytes)
 Replace one entry in a field of any type.
status_t ReplaceData (bool okayToAdd, const String &name, uint32 type, const void *data, uint32 numBytes)
 As above, only (index) isn't specified.
const StringGetFirstFieldNameString (uint32 optTypeCode=B_ANY_TYPE) const
 Convenience method: Returns the first field name of the given type, or NULL if none is found.
const StringGetLastFieldNameString (uint32 optTypeCode=B_ANY_TYPE) const
 Convenience method: Returns the last field name of the given type, or NULL if none is found.
bool HasName (const String &fieldName, uint32 type=B_ANY_TYPE) const
 Returns true iff there is a field with the given name and type present in the Message.
uint32 GetNumValuesInName (const String &fieldName, uint32 type=B_ANY_TYPE) const
 Returns the number of values in the field with the given name and type in the Message.
status_t MoveName (const String &name, Message &moveTo)
 Take the data under (name) in this message, and moves it into (moveTo).
status_t CopyName (const String &name, Message &copyTo) const
 Take the data under (name) in this message, and copies it into (moveTo).
void SwapContents (Message &swapWith)
 Swaps the contents and 'what' code of this Message with the specified Message.
uint32 CalculateChecksum (bool countNonFlattenableFields=false) const
 Iterates over the contents of this Message to compute a checksum.
MessageFieldNameIterator GetFieldNameIterator (uint32 type=B_ANY_TYPE, uint32 flags=0) const
 Returns an iterator that iterates over the names of the fields in this message.
MessageFieldNameIterator GetFieldNameIteratorAt (const String &startFieldName, uint32 type=B_ANY_TYPE, uint32 flags=0) const
 As above, only starts the iteration at the given field name, instead of at the beginning or end of the list of field names.
void IncrementRefCount () const
 Increments the counter and returns true iff the new value is zero.
bool DecrementRefCount () const
 Decrements the counter and returns true iff the new value is zero.
void SetManager (AbstractObjectManager *manager)
 Sets the recycle-pointer for this object.
AbstractObjectManagerGetManager () const
 Returns this object's current recyler pointer.
uint32 GetRefCount () const
 Returns this object's current reference count.
virtual bool AllowsTypeCode (uint32 code) const
 Should return true iff a buffer with uint32 (code) can be used to reconstruct this object's state.
status_t CopyTo (Flattenable &copyTo) const
 Causes (copyTo)'s state to set from this Flattenable, if possible.
status_t CopyFrom (const Flattenable &copyFrom)
 Causes our state to be set from (copyFrom)'s state, if possible.
status_t FlattenToByteBuffer (ByteBuffer &outBuf) const
 Convenience method.
Ref< ByteBufferFlattenToByteBuffer () const
 Convenience method.
status_t UnflattenFromByteBuffer (const ByteBuffer &buf)
 Convenience method.
status_t FlattenToDataIO (DataIO &outputStream, bool addSizeHeader) const
 Convenience method.
status_t UnflattenFromDataIO (DataIO &inputStream, int32 optReadSize, uint32 optMaxReadSize=MUSCLE_NO_LIMIT)
 Convenience method.

Static Public Member Functions

static void WriteData (uint8 *outBuf, uint32 *writeOffset, const void *copyFrom, uint32 blockSize)
 Convenience method for writing data into a byte buffer.
static status_t ReadData (const uint8 *inBuf, uint32 inputBufferBytes, uint32 *readOffset, void *copyTo, uint32 blockSize)
 Convenience method for safely reading bytes from a byte buffer.

Public Attributes

uint32 what
 32 bit what code, for quick identification of message types.

Protected Member Functions

virtual status_t CopyFromImplementation (const Flattenable &copyFrom)
 Overridden to copy directly if (copyFrom) is a Message as well.

Friends

class MessageFieldNameIterator

Detailed Description

This class is similar to a BMessage, but portable.

It only acts as a serializable data container; it does not have include any threading capabilities. Unless otherwise noted, all methods behave similarly to their BMessage counterparts. (Exception: the only error codes returned are B_ERROR and B_NO_ERROR)

Definition at line 174 of file Message.h.


Constructor & Destructor Documentation

Message::Message ( uint32  what  )  [inline]

Constructor.

Parameters:
what The 'what' member variable will be set to the value you specify here.

Definition at line 186 of file Message.h.


Member Function Documentation

bool Message::operator== ( const Message rhs  )  const

Comparison operator.

Two Message are considered equal iff their what codes are equal, and their sets of fields are equal. Field ordering is not considered. Note that this operation can be expensive for large Messages!

status_t Message::GetInfo ( const String name,
uint32 *  type,
uint32 *  c = NULL,
bool *  fixed_size = NULL 
) const

Retrieve information about the given field in this message.

Parameters:
name Name of the field to look for.
type If non-NULL, On sucess the type code of the found field is copied into this value.
c If non-NULL, On success, the number of elements in the found field is copied into this value.
fixed_size If non-NULL, On success, (*fixed_size) is set to reflect whether the returned field's objects are all the same size, or not.
Returns:
B_NO_ERROR on success, or B_ERROR if the requested field couldn't be found.

uint32 Message::CountNames ( uint32  type = B_ANY_TYPE  )  const

Returns the number of fields of the given type that are present in the Message.

Parameters:
type The type of field to count, or B_ANY_TYPE to count all field types.
Returns:
The number of matching fields

Referenced by HasNames().

bool Message::HasNames ( uint32  type = B_ANY_TYPE  )  const [inline]

Returns true if there are any fields of the given type in the Message.

Parameters:
type The type of field to check for, or B_ANY_TYPE to check for any field type.
Returns:
True iff any fields of the given type exist.

Definition at line 225 of file Message.h.

References CountNames().

void Message::PrintToStream ( bool  recursive = true,
int  indentLevel = 0 
) const

Prints debug info describing the contents of this Message to stdout.

Parameters:
recursive if true, we will call PrintToStream() recursively on any held messages also. Defaults to true.
indentLevel Number of spaces to indent each printed line. Used while recursing to format nested messages text nicely

status_t Message::Rename ( const String old_entry,
const String new_entry 
)

Renames a field.

Parameters:
old_entry Field name to rename from.
new_entry Field name to rename to. If a field with this name already exists, it will be replaced.
Returns:
B_NO_ERROR on success, or B_ERROR if a field named (old_entry) couldn't be found.

virtual bool Message::IsFixedSize (  )  const [inline, virtual]

Returns false (Messages can be of various sizes, depending on how many fields they have, etc.

)

Implements Flattenable.

Definition at line 255 of file Message.h.

virtual void Message::Flatten ( uint8 *  buffer  )  const [virtual]

Converts this Message into a flattened buffer of bytes that can be saved to disk or sent over a network, and later converted back into an identical Message object.

Parameters:
buffer The byte buffer to store the Message into. It must be FlattenedSize() bytes long.

Implements Flattenable.

virtual status_t Message::Unflatten ( const uint8 *  buf,
uint32  size 
) [virtual]

Convert the given byte buffer back into a Message.

Any previous contents of this Message will be erased, and replaced with the data specified in the byte buffer.

Parameters:
buf Pointer to a byte buffer containing a flattened Message to restore.
size The number of bytes in the flattened byte buffer.
Returns:
B_NO_ERROR if the buffer was successfully Unflattened, or B_ERROR if there was an error (usually meaning the buffer was corrupt, or out-of-memory)

Implements Flattenable.

status_t Message::AddString ( const String name,
const String val 
)

Adds a new string to the Message.

Parameters:
name Name of the field to add (or add to)
val The string to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddInt8 ( const String name,
int8  val 
)

Adds a new int8 to the Message.

Parameters:
name Name of the field to add (or add to)
val The int8 to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddInt16 ( const String name,
int16  val 
)

Adds a new int16 to the Message.

Parameters:
name Name of the field to add (or add to)
val The int16 to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddInt32 ( const String name,
int32  val 
)

Adds a new int32 to the Message.

Parameters:
name Name of the field to add (or add to)
val The int32 to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddInt64 ( const String name,
int64  val 
)

Adds a new int64 to the Message.

Parameters:
name Name of the field to add (or add to)
val The int64 to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddBool ( const String name,
bool  val 
)

Adds a new boolean to the Message.

Parameters:
name Name of the field to add (or add to)
val The boolean to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddFloat ( const String name,
float  val 
)

Adds a new float to the Message.

Parameters:
name Name of the field to add (or add to)
val The float to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddDouble ( const String name,
double  val 
)

Adds a new double to the Message.

Parameters:
name Name of the field to add (or add to)
val The double to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddMessage ( const String name,
const Message msg 
) [inline]

Adds a new Message to the Message.

Note that this method is less efficient than the AddMessage(MessageRef) method, as this method necessitates copying all the data in (msg).

Parameters:
name Name of the field to add (or add to)
msg The Message to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

Definition at line 344 of file Message.h.

status_t Message::AddMessage ( const String name,
const MessageRef msgRef 
)

Adds a new Message to the Message.

Note that this method is more efficient than the AddMessage(const Message &) method, as this method need not make a copy of the referenced Message.

Parameters:
name Name of the field to add (or add to)
msgRef Reference to the Message to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddPointer ( const String name,
const void *  ptr 
)

Adds a new pointer value to the Message.

Parameters:
name Name of the field to add (or add to)
ptr The pointer value to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddPoint ( const String name,
const Point point 
)

Adds a new point to the Message.

Parameters:
name Name of the field to add (or add to)
point The point to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddRect ( const String name,
const Rect rect 
)

Adds a new rect to the Message.

Parameters:
name Name of the field to add (or add to)
rect The rect to add
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

status_t Message::AddFlat ( const String name,
const Flattenable obj 
)

Flattens a Flattenable object into the Message.

Parameters:
name Name of the field to add (or add to)
obj The Flattenable object. Flatten() is called on this object, and the resulting bytes are appended to the given field in this Message.
Returns:
B_NO_ERROR on success, B_ERROR if out of memory or a type conflict occurred

Referenced by AddFlat().

status_t Message::AddFlat ( const String name,
const