From 2b526613151fb42f35f8a5b9da7e8cf66127a00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 7 Feb 2011 20:10:14 +0000 Subject: [PATCH] Added another GetInfo() variant with which one can retrieve the count and fixed size flag at once. Not sure if this can be merged into one of the existing GetInfo() variants without breaking binary compatibility. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40374 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/app/Message.h | 2 ++ src/kits/app/Message.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/headers/os/app/Message.h b/headers/os/app/Message.h index 781c99ff5f..038d5166f3 100644 --- a/headers/os/app/Message.h +++ b/headers/os/app/Message.h @@ -63,6 +63,8 @@ class BMessage { int32 *countFound = NULL) const; status_t GetInfo(const char *name, type_code *typeFound, bool *fixedSize) const; + status_t GetInfo(const char *name, type_code *typeFound, + int32 *countFound, bool *fixedSize) const; int32 CountNames(type_code type) const; bool IsEmpty() const; diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp index bf1b9df250..e99d3ee74e 100644 --- a/src/kits/app/Message.cpp +++ b/src/kits/app/Message.cpp @@ -494,6 +494,27 @@ BMessage::GetInfo(const char *name, type_code *typeFound, bool *fixedSize) } +status_t +BMessage::GetInfo(const char *name, type_code *typeFound, int32 *countFound, + bool *fixedSize) const +{ + DEBUG_FUNCTION_ENTER; + field_header *field = NULL; + status_t result = _FindField(name, B_ANY_TYPE, &field); + if (result < B_OK || field == NULL) + return result; + + if (typeFound) + *typeFound = field->type; + if (countFound) + *countFound = field->count; + if (fixedSize) + *fixedSize = (field->flags & FIELD_FLAG_FIXED_SIZE) != 0; + + return B_OK; +} + + int32 BMessage::CountNames(type_code type) const {