-
class
PortableMessage
: public PortableFlattenable
(Return to index)
-
This class is similar to a BMessage, but portable.
Type:
Superclasses:
Include file:
../../message/PortableMessage.h
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)
Synopsis:
- Public:
- status_t
AddBool
(const char *name, bool a_boolean)
;
-
- status_t
AddDataAux
(const char * name, const uint8 * data, size_t size, type_code etc)
;
-
- status_t
AddDouble
(const char *name, double a_double)
;
-
- status_t
AddFlat
(const char *name, const PortableFlattenable &obj)
;
-
- status_t
AddFlatAux
(const char * name, const PortableFlattenable & flat, type_code etc)
;
-
- status_t
AddFloat
(const char *name, float a_float)
;
-
- status_t
AddInt16
(const char *name, int16 val)
;
-
- status_t
AddInt32
(const char *name, int32 val)
;
-
- status_t
AddInt64
(const char *name, int64 val)
;
-
- status_t
AddInt8
(const char *name, int8 val)
;
-
- status_t
AddMessage
(const char *name, PortableMessageRef msgRef)
;
-
- status_t
AddMessage
(const char *name, const PortableMessage & msg)
;
-
- status_t
AddPoint
(const char *name, const PortablePoint & point)
;
-
- status_t
AddPointer
(const char *name, const void * ptr)
;
-
- status_t
AddRect
(const char *name, const PortableRect & rect)
;
-
- status_t
AddString
(const char *name, const PortableString & a_string)
;
-
- status_t
AddString
(const char *name, const PortableString & a_string)
;
-
- status_t
CopyName
(const char * name, PortableMessage ©To) const
;
-
- int32
CountNames
(type_code type = B_ANY_TYPE) const
;
-
- status_t
FindBool
(const char *name, bool *value) const
;
-
- status_t
FindBool
(const char *name, int32 index, bool *value) const
;
-
- status_t
FindData
(const char *name, type_code type, int32 index, const void **data, size_t *numBytes) const
;
-
Note: If you are retrieving B_MESSAGE_TYPE, then (data) will be set to point to a PortableMessageRef
- status_t
FindDataAux
(const char * name, int32 index, const uint8 ** setData, size_t * setSize, type_code etc) const
;
-
- status_t
FindDataItemAux
(const char * name, int32 index, type_code tc, void * setValue, size_t valueSize) const
;
-
- status_t
FindDouble
(const char *name, double *d) const
;
-
- status_t
FindDouble
(const char *name, int32 index, double *d) const
;
-
- status_t
FindFlat
(const char *name, PortableFlattenable &obj) const
;
-
- status_t
FindFlat
(const char *name, int32 index, PortableFlattenable &obj) const
;
-
- status_t
FindFlatAux
(const char * name, int32 index, PortableFlattenable & flat, type_code etc) const
;
-
- status_t
FindFloat
(const char *name, float *f) const
;
-
- status_t
FindFloat
(const char *name, int32 index, float *f) const
;
-
- status_t
FindInt16
(const char *name, int16 *value) const
;
-
- status_t
FindInt16
(const char *name, int32 index, int16 *val) const
;
-
- status_t
FindInt32
(const char *name, int32 *value) const
;
-
- status_t
FindInt32
(const char *name, int32 index, int32 *val) const
;
-
- status_t
FindInt64
(const char *name, int32 index, int64 *val) const
;
-
- status_t
FindInt64
(const char *name, int64 *value) const
;
-
- status_t
FindInt8
(const char *name, int32 index, int8 *val) const
;
-
- status_t
FindInt8
(const char *name, int8 *value) const
;
-
- status_t
FindMessage
(const char *name, PortableMessage &msg) const
;
-
- status_t
FindMessage
(const char *name, PortableMessageRef &msgRef) const
;
-
- status_t
FindMessage
(const char *name, int32 index, PortableMessage &msg) const
;
-
- status_t
FindMessage
(const char *name, int32 index, PortableMessageRef &msgRef) const
;
-
- status_t
FindPoint
(const char *name, PortablePoint & point) const
;
-
- status_t
FindPoint
(const char *name, int32 index, PortablePoint & point) const
;
-
- status_t
FindPointer
(const char *name, int32 index, void ** ptr) const
;
-
- status_t
FindPointer
(const char *name, void ** ptr) const
;
-
- status_t
FindRect
(const char *name, PortableRect & rect) const
;
-
- status_t
FindRect
(const char *name, int32 index, PortableRect & point) const
;
-
- status_t
FindString
(const char *name, PortableString & setMe) const
;
-
Note: If you are adding B_MESSAGE_TYPE, then (data) must point to a PortableMessageRef
- status_t
FindString
(const char *name, int32 index, PortableString & setMe) const
;
-
- virtual void
Flatten
(uint8 *buffer) const
;
-
- virtual size_t
FlattenedSize
() const
;
-
- AbstractDataArray *
GetArray
(const PortableString & arrayName, type_code etc) const
;
-
- PortableMessageFieldNameIterator
GetFieldNameIterator
(type_code type = B_ANY_TYPE) const
;
-
- status_t
GetInfo
(const char *name, type_code *type, bool *fixed_size) const
;
-
- status_t
GetInfo
(const char *name, type_code *type, int32 *c) const
;
-
- status_t
GetInfo
(const char *name, type_code *type, int32 *c, bool *fixed_size) const
;
-
- status_t
GetInfo
(type_code typeRequested, int32 which, PortableString & setName, type_code *typeReturned, int32 *count = NULL, bool * fixed_size = NULL) const
;
-
- bool
GetNextFieldName
(_eitr * iter, PortableString & setName, type_code tc) const
;
-
- AbstractDataArray *
GetOrCreateArray
(const PortableString & arrayName, type_code tc)
;
-
- AbstractDataArray *
GetOrCreateArray
(const PortableString & arrayName, type_code tc)
;
-
- bool
HasMoreFieldNames
(_eitr * iter, type_code tc) const
;
-
- bool
HasName
(const char * fieldName, type_code type = B_ANY_TYPE) const
;
-
- bool
IsEmpty
() const
;
-
- virtual bool
IsFixedSize
() const
;
-
- status_t
MoveName
(const char * name, PortableMessage &moveTo)
;
-
-
PortableMessage
()
;
-
-
PortableMessage
(const PortableMessage &a_message)
;
-
-
PortableMessage
(uint32 what)
;
-
- void
PrintToStream
() const
;
-
- status_t
Rename
(const char *old_entry, const char *new_entry)
;
-
- status_t
ReplaceBool
(const char *name, bool a_bool)
;
-
- status_t
ReplaceBool
(const char *name, int32 index, bool a_bool)
;
-
- status_t
ReplaceData
(const char *name, type_code type, int32 index, const void *data, size_t data_size)
;
-
Note: If you are replacing B_MESSAGE_TYPE, then (data) must point to a PortableMessageRef
- status_t
ReplaceDataAux
(const char * name, int32 index, uint8 * dataBuf, size_t bufSize, type_code tc)
;
-
- status_t
ReplaceDouble
(const char *name, double a_double)
;
-
- status_t
ReplaceDouble
(const char *name, int32 index, double a_double)
;
-
- status_t
ReplaceFlat
(const char *name, const PortableFlattenable &obj)
;
-
- status_t
ReplaceFlat
(const char *name, int32 index, const PortableFlattenable &obj)
;
-
- status_t
ReplaceFlatItemAux
(const char * name, int32 index, const PortableFlattenable & flat, type_code tc)
;
-
- status_t
ReplaceFloat
(const char *name, float a_float)
;
-
- status_t
ReplaceFloat
(const char *name, int32 index, float a_float)
;
-
- status_t
ReplaceInt16
(const char *name, int16 val)
;
-
- status_t
ReplaceInt16
(const char *name, int32 index, int16 val)
;
-
- status_t
ReplaceInt32
(const char *name, int32 val)
;
-
- status_t
ReplaceInt32
(const char *name, int32 index, int32 val)
;
-
- status_t
ReplaceInt64
(const char *name, int32 index, int64 val)
;
-
- status_t
ReplaceInt64
(const char *name, int64 val)
;
-
- status_t
ReplaceInt8
(const char *name, int32 index, int8 val)
;
-
- status_t
ReplaceInt8
(const char *name, int8 val)
;
-
- status_t
ReplaceMessage
(const char *name, PortableMessageRef msgRef)
;
-
- status_t
ReplaceMessage
(const char *name, const PortableMessage &msg)
;
-
- status_t
ReplaceMessage
(const char *name, int32 index, PortableMessageRef msgRef)
;
-
- status_t
ReplaceMessage
(const char *name, int32 index, const PortableMessage &msg)
;
-
- status_t
ReplacePoint
(const char *name, const PortablePoint & point)
;
-
- status_t
ReplacePoint
(const char *name, int32 index, const PortablePoint & point)
;
-
- status_t
ReplacePointer
(const char *name, const void * ptr)
;
-
- status_t
ReplacePointer
(const char *name, int32 index, const void * ptr)
;
-
- status_t
ReplaceRect
(const char *name, const PortableRect & rect)
;
-
- status_t
ReplaceRect
(const char *name, int32 index, const PortableRect & rect)
;
-
- status_t
ReplaceString
(const char *name, const char * newString)
;
-
- status_t
ReplaceString
(const char *name, const char * newString)
;
-
- status_t
ReplaceString
(const char *name, int32 index, const char * newString)
;
-
- status_t
ReplaceString
(const char *name, int32 index, const char * newString)
;
-
- virtual type_code
TypeCode
() const
;
-
- virtual status_t
Unflatten
(const uint8 *buf, size_t size)
;
-
- PortableHashtable<PortableString, AbstractDataArray *>
_entries
;
-
- PortableMessage &
operator=
(const PortableMessage &msg)
;
-
- uint32
what
;
-
- virtual
~PortableMessage
()
;
-
- Friends:
- friend class
PortableMessageFieldNameIterator
;
-
Public methods:
- public status_t
AddBool (const char *name, bool a_boolean)
- public status_t
AddDataAux (const char * name, const uint8 * data, size_t size, type_code etc)
- public status_t
AddDouble (const char *name, double a_double)
- public status_t
AddFlat (const char *name, const PortableFlattenable &obj)
- public status_t
AddFlatAux (const char * name, const PortableFlattenable & flat, type_code etc)
- public status_t
AddFloat (const char *name, float a_float)
- public status_t
AddInt16 (const char *name, int16 val)
- public status_t
AddInt32 (const char *name, int32 val)
- public status_t
AddInt64 (const char *name, int64 val)
- public status_t
AddInt8 (const char *name, int8 val)
- public status_t
AddMessage (const char *name, PortableMessageRef msgRef)
- public status_t
AddMessage (const char *name, const PortableMessage & msg)
- public status_t
AddPoint (const char *name, const PortablePoint & point)
- public status_t
AddPointer (const char *name, const void * ptr)
- public status_t
AddRect (const char *name, const PortableRect & rect)
- public status_t
AddString (const char *name, const PortableString & a_string)
- public status_t
AddString (const char *name, const PortableString & a_string)
- public status_t
CopyName (const char * name, PortableMessage ©To) const
Take the data under (name) in this message, and copies it into (moveTo).
Any data that was under (name) in (moveTo) will be replaced.
- public int32
CountNames (type_code type = B_ANY_TYPE) const
- public status_t
FindBool (const char *name, bool *value) const
- public status_t
FindBool (const char *name, int32 index, bool *value) const
- public status_t
FindData (const char *name, type_code type, int32 index, const void **data, size_t *numBytes) const
Note: If you are retrieving B_MESSAGE_TYPE, then (data) will be set to point to a PortableMessageRef
object, and NOT a PortableMessage object, or flattened-PortableMessage-buffer!
(This is inconsistent with BMessage
- public status_t
FindDataAux (const char * name, int32 index, const uint8 ** setData, size_t * setSize, type_code etc) const
- public status_t
FindDataItemAux (const char * name, int32 index, type_code tc, void * setValue, size_t valueSize) const
- public status_t
FindDouble (const char *name, double *d) const
- public status_t
FindDouble (const char *name, int32 index, double *d) const
- public status_t
FindFlat (const char *name, PortableFlattenable &obj) const
- public status_t
FindFlat (const char *name, int32 index, PortableFlattenable &obj) const
- public status_t
FindFlatAux (const char * name, int32 index, PortableFlattenable & flat, type_code etc) const
- public status_t
FindFloat (const char *name, float *f) const
- public status_t
FindFloat (const char *name, int32 index, float *f) const
- public status_t
FindInt16 (const char *name, int16 *value) const
- public status_t
FindInt16 (const char *name, int32 index, int16 *val) const
- public status_t
FindInt32 (const char *name, int32 *value) const
- public status_t
FindInt32 (const char *name, int32 index, int32 *val) const
- public status_t
FindInt64 (const char *name, int32 index, int64 *val) const
- public status_t
FindInt64 (const char *name, int64 *value) const
- public status_t
FindInt8 (const char *name, int32 index, int8 *val) const
- public status_t
FindInt8 (const char *name, int8 *value) const
- public status_t
FindMessage (const char *name, PortableMessage &msg) const
- public status_t
FindMessage (const char *name, PortableMessageRef &msgRef) const
- public status_t
FindMessage (const char *name, int32 index, PortableMessage &msg) const
- public status_t
FindMessage (const char *name, int32 index, PortableMessageRef &msgRef) const
- public status_t
FindPoint (const char *name, PortablePoint & point) const
- public status_t
FindPoint (const char *name, int32 index, PortablePoint & point) const
- public status_t
FindPointer (const char *name, int32 index, void ** ptr) const
- public status_t
FindPointer (const char *name, void ** ptr) const
- public status_t
FindRect (const char *name, PortableRect & rect) const
- public status_t
FindRect (const char *name, int32 index, PortableRect & point) const
- public status_t
FindString (const char *name, PortableString & setMe) const
Note: If you are adding B_MESSAGE_TYPE, then (data) must point to a PortableMessageRef
object, and NOT a PortableMessage object, or flattened-PortableMessage-buffer!
(This is inconsistent with BMessage
- public status_t
FindString (const char *name, int32 index, PortableString & setMe) const
- public virtual void
Flatten (uint8 *buffer) const
- public virtual size_t
FlattenedSize () const
- public AbstractDataArray *
GetArray (const PortableString & arrayName, type_code etc) const
This method sets the pools that the PortableMessage class uses by default in situations where
now pools are available (e.g. from a passed-in PortableMessageRef or somesuch). By default,
no pooling is done in these situations. For a minor CPU-efficiency boost in single-threaded
programs, you can call SetInternalDefaultPools(GetMessagePool(), GetMessageRefPool()). Don't
to this for multi-threaded programs, though, as it will cause race conditions!
(For multi-threaded Be programs, you can use MessageTransceiverThread
- public PortableMessageFieldNameIterator
GetFieldNameIterator (type_code type = B_ANY_TYPE) const
Returns an iterator that iterates over the names of the fields in this
message. If (type) is B_ANY_TYPE, then all field names will be included
in the traversal. Otherwise, only names of the given type will be included.
- public status_t
GetInfo (const char *name, type_code *type, bool *fixed_size) const
- public status_t
GetInfo (const char *name, type_code *type, int32 *c) const
- public status_t
GetInfo (const char *name, type_code *type, int32 *c, bool *fixed_size) const
- public status_t
GetInfo (type_code typeRequested, int32 which, PortableString & setName, type_code *typeReturned, int32 *count = NULL, bool * fixed_size = NULL) const
- public bool
GetNextFieldName (_eitr * iter, PortableString & setName, type_code tc) const
- public AbstractDataArray *
GetOrCreateArray (const PortableString & arrayName, type_code tc)
- public AbstractDataArray *
GetOrCreateArray (const PortableString & arrayName, type_code tc)
- public bool
HasMoreFieldNames (_eitr * iter, type_code tc) const
- public bool
HasName (const char * fieldName, type_code type = B_ANY_TYPE) const
- public bool
IsEmpty () const
- public virtual bool
IsFixedSize () const
- public status_t
MoveName (const char * name, PortableMessage &moveTo)
Take the data under (name) in this message, and moves it into (moveTo).
Any data that was under (name) in (moveTo) will be replaced.
- public
PortableMessage ()
- public
PortableMessage (const PortableMessage &a_message)
- public
PortableMessage (uint32 what)
- public void
PrintToStream () const
- public status_t
Rename (const char *old_entry, const char *new_entry)
- public status_t
ReplaceBool (const char *name, bool a_bool)
- public status_t
ReplaceBool (const char *name, int32 index, bool a_bool)
- public status_t
ReplaceData (const char *name, type_code type, int32 index, const void *data, size_t data_size)
Note: If you are replacing B_MESSAGE_TYPE, then (data) must point to a PortableMessageRef
object, and NOT a PortableMessage object, or flattened-PortableMessage-buffer!
(This is inconsistent with BMessage
- public status_t
ReplaceDataAux (const char * name, int32 index, uint8 * dataBuf, size_t bufSize, type_code tc)
- public status_t
ReplaceDouble (const char *name, double a_double)
- public status_t
ReplaceDouble (const char *name, int32 index, double a_double)
- public status_t
ReplaceFlat (const char *name, const PortableFlattenable &obj)
- public status_t
ReplaceFlat (const char *name, int32 index, const PortableFlattenable &obj)
- public status_t
ReplaceFlatItemAux (const char * name, int32 index, const PortableFlattenable & flat, type_code tc)
- public status_t
ReplaceFloat (const char *name, float a_float)
- public status_t
ReplaceFloat (const char *name, int32 index, float a_float)
- public status_t
ReplaceInt16 (const char *name, int16 val)
- public status_t
ReplaceInt16 (const char *name, int32 index, int16 val)
- public status_t
ReplaceInt32 (const char *name, int32 val)
- public status_t
ReplaceInt32 (const char *name, int32 index, int32 val)
- public status_t
ReplaceInt64 (const char *name, int32 index, int64 val)
- public status_t
ReplaceInt64 (const char *name, int64 val)
- public status_t
ReplaceInt8 (const char *name, int32 index, int8 val)
- public status_t
ReplaceInt8 (const char *name, int8 val)
- public status_t
ReplaceMessage (const char *name, PortableMessageRef msgRef)
- public status_t
ReplaceMessage (const char *name, const PortableMessage &msg)
- public status_t
ReplaceMessage (const char *name, int32 index, PortableMessageRef msgRef)
- public status_t
ReplaceMessage (const char *name, int32 index, const PortableMessage &msg)
- public status_t
ReplacePoint (const char *name, const PortablePoint & point)
- public status_t
ReplacePoint (const char *name, int32 index, const PortablePoint & point)
- public status_t
ReplacePointer (const char *name, const void * ptr)
- public status_t
ReplacePointer (const char *name, int32 index, const void * ptr)
- public status_t
ReplaceRect (const char *name, const PortableRect & rect)
- public status_t
ReplaceRect (const char *name, int32 index, const PortableRect & rect)
- public status_t
ReplaceString (const char *name, const char * newString)
- public status_t
ReplaceString (const char *name, const char * newString)
- public status_t
ReplaceString (const char *name, int32 index, const char * newString)
- public status_t
ReplaceString (const char *name, int32 index, const char * newString)
- public virtual type_code
TypeCode () const
- public virtual status_t
Unflatten (const uint8 *buf, size_t size)
- public PortableHashtable<PortableString, AbstractDataArray *>
_entries
- public PortableMessage &
operator= (const PortableMessage &msg)
- public uint32
what
- public virtual
~PortableMessage ()
Friend methods: