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
This commit is contained in:
Stephan Aßmus 2011-02-07 20:10:14 +00:00
parent 36ef875aad
commit 2b52661315
2 changed files with 23 additions and 0 deletions

View File

@ -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;

View File

@ -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
{