BMessage: Added missing [Get|Set]Pointer()
* SetPointer() was declared, but not defined.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2015 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2005-2017 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -461,6 +461,10 @@ public:
|
||||
rgb_color defaultValue) const;
|
||||
rgb_color GetColor(const char* name, int32 index,
|
||||
rgb_color defaultValue) const;
|
||||
const void* GetPointer(const char* name, int32 index,
|
||||
const void* defaultValue = NULL) const;
|
||||
const void* GetPointer(const char* name,
|
||||
const void* defaultValue = NULL) const;
|
||||
const char* GetString(const char* name,
|
||||
const char* defaultValue = NULL) const;
|
||||
const char* GetString(const char* name, int32 index,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2015 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2005-2017 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -741,7 +741,7 @@ BMessage::_PrintToStream(const char* indent) const
|
||||
rgb_color* color = (rgb_color*)pointer;
|
||||
printf("rgb_color(%u, %u, %u, %u)\n", color->red,
|
||||
color->green, color->blue, color->alpha);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
@@ -2592,6 +2592,32 @@ DEFINE_SET_GET_FUNCTIONS(rgb_color, Color, B_RGB_32_BIT_TYPE);
|
||||
#undef DEFINE_SET_GET_FUNCTION
|
||||
|
||||
|
||||
const void*
|
||||
BMessage::GetPointer(const char* name, const void* defaultValue) const
|
||||
{
|
||||
return GetPointer(name, 0, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
const void*
|
||||
BMessage::GetPointer(const char* name, int32 index,
|
||||
const void* defaultValue) const
|
||||
{
|
||||
void* value;
|
||||
if (FindPointer(name, index, &value) == B_OK)
|
||||
return value;
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMessage::SetPointer(const char* name, const void* value)
|
||||
{
|
||||
return SetData(name, B_POINTER_TYPE, &value, sizeof(void*));
|
||||
}
|
||||
|
||||
|
||||
#define DEFINE_SET_GET_BY_REFERENCE_FUNCTIONS(type, typeName, typeCode) \
|
||||
type \
|
||||
BMessage::Get##typeName(const char* name, const type& defaultValue) const \
|
||||
|
||||
Reference in New Issue
Block a user