diff --git a/headers/build/os/app/Message.h b/headers/build/os/app/Message.h index 9ec0a35582..5fd4f4c907 100644 --- a/headers/build/os/app/Message.h +++ b/headers/build/os/app/Message.h @@ -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; diff --git a/src/build/libbe/app/Message.cpp b/src/build/libbe/app/Message.cpp index 380cb7d3d9..70243596d6 100644 --- a/src/build/libbe/app/Message.cpp +++ b/src/build/libbe/app/Message.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -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 {