Re-apply cf0a957 for the build-version of libbe.

* fixes build on non-Haiku platforms
This commit is contained in:
Oliver Tappe
2013-04-20 15:16:00 +02:00
parent e0d4161d42
commit 74233e2c88
2 changed files with 48 additions and 0 deletions
+3
View File
@@ -22,6 +22,7 @@ class BBlockCache;
class BMessenger;
class BHandler;
class BString;
class BStringList;
struct entry_ref;
@@ -105,6 +106,7 @@ class BMessage {
status_t AddPoint(const char *name, BPoint aPoint);
status_t AddString(const char *name, const char *aString);
status_t AddString(const char *name, const BString &aString);
status_t AddStrings(const char *name, const BStringList &list);
status_t AddInt8(const char *name, int8 value);
status_t AddUInt8(const char *name, uint8 value);
status_t AddInt16(const char *name, int16 value);
@@ -140,6 +142,7 @@ class BMessage {
status_t FindString(const char *name, int32 index, const char **string) const;
status_t FindString(const char *name, BString *string) const;
status_t FindString(const char *name, int32 index, BString *string) const;
status_t FindStrings(const char *name, BStringList *list) const;
status_t FindInt8(const char *name, int8 *value) const;
status_t FindInt8(const char *name, int32 index, int8 *value) const;
status_t FindUInt8(const char *name, uint8 *value) const;
+45
View File
@@ -25,6 +25,7 @@
#include <Point.h>
#include <Rect.h>
#include <String.h>
#include <StringList.h>
#include <assert.h>
#include <ctype.h>
@@ -1746,6 +1747,20 @@ BMessage::AddString(const char *name, const BString &string)
}
status_t
BMessage::AddStrings(const char *name, const BStringList &list)
{
int32 count = list.CountStrings();
for (int32 i = 0; i < count; i++) {
status_t error = AddString(name, list.StringAt(i));
if (error != B_OK)
return error;
}
return B_OK;
}
status_t
BMessage::AddPointer(const char *name, const void *pointer)
{
@@ -1875,6 +1890,36 @@ BMessage::FindString(const char *name, int32 index, BString *string) const
}
status_t
BMessage::FindStrings(const char *name, BStringList *list) const
{
if (list == NULL)
return B_BAD_VALUE;
list->MakeEmpty();
// get the number of items
type_code type;
int32 count;
if (GetInfo(name, &type, &count) != B_OK)
return B_NAME_NOT_FOUND;
if (type != B_STRING_TYPE)
return B_BAD_DATA;
for (int32 i = 0; i < count; i++) {
BString string;
status_t error = FindString(name, i, &string);
if (error != B_OK)
return error;
if (!list->Add(string))
return B_NO_MEMORY;
}
return B_OK;
}
status_t
BMessage::FindPointer(const char *name, void **pointer) const
{