Added Dump() method. It prints some general info and a list of the
message fields, no data, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25001 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -134,6 +134,8 @@ public:
|
|||||||
team_id senderTeam = -1);
|
team_id senderTeam = -1);
|
||||||
status_t ReceiveFrom(port_id fromPort, bigtime_t timeout = -1);
|
status_t ReceiveFrom(port_id fromPort, bigtime_t timeout = -1);
|
||||||
|
|
||||||
|
void Dump(void (*printFunc)(const char*,...));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class KMessageField;
|
friend class KMessageField;
|
||||||
friend class MessageAdapter;
|
friend class MessageAdapter;
|
||||||
|
|||||||
@@ -585,6 +585,25 @@ KMessage::ReceiveFrom(port_id fromPort, bigtime_t timeout)
|
|||||||
#endif // !KMESSAGE_CONTAINER_ONLY
|
#endif // !KMESSAGE_CONTAINER_ONLY
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
KMessage::Dump(void (*printFunc)(const char*,...))
|
||||||
|
{
|
||||||
|
Header* header = _Header();
|
||||||
|
printFunc("KMessage: buffer: %p (size/capacity: %ld/%ld), flags: 0x0lx\n",
|
||||||
|
fBuffer, header->size, fBufferCapacity, fFlags);
|
||||||
|
|
||||||
|
KMessageField field;
|
||||||
|
while (GetNextField(&field) == B_OK) {
|
||||||
|
type_code type = field.TypeCode();
|
||||||
|
int32 count = field.CountElements();
|
||||||
|
printFunc(" field: %-20s: type: 0x%lx ('%c%c%c%c'), %ld element%s\n",
|
||||||
|
field.Name(), type, (char)(type >> 24), (char)(type >> 16),
|
||||||
|
(char)(type >> 8), (char)type, count, count == 1 ? "" : "s");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// _Header
|
// _Header
|
||||||
KMessage::Header *
|
KMessage::Header *
|
||||||
KMessage::_Header() const
|
KMessage::_Header() const
|
||||||
|
|||||||
Reference in New Issue
Block a user