AppKit: BMessage Add/Find/Get/Has/ReplaceNodeRef

This allows you to pass node_ref's around like you can entry_ref's.

Added node_ref_flatten(), node_ref_unflatten() and node_ref_swap() to
MessageUtils. These are close cousins to entry_ref_flatten(),
entry_ref_unflatten(), and entry_ref_swap() but for node_ref's.

Added B_NODE_REF_TYPE to TypeConstants.h in the Support Kit.

Added B_NODE_REF_TYPE to Debugger and ByteOrder in Support Kit,
B_NODE_REF_TYPE is treated the same as a B_REF_TYPE (entry_ref).

Add documentation for new NodeRef methods and B_NODE_REF_TYPE.

Change-Id: I32c6ed276bf1a7894a835b9fc9de5a882c35883c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3182
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
John Scipione
2020-09-10 17:18:09 +00:00
committed by Adrien Destugues
parent 19a1dd49cf
commit fe88ae51ec
11 changed files with 288 additions and 7 deletions
+13
View File
@@ -13,8 +13,10 @@
#include <BeBuild.h>
#include <DataIO.h>
#include <Entry.h>
#include <Flattenable.h>
#include <OS.h>
#include <Node.h>
#include <Rect.h>
#include <Size.h>
@@ -161,6 +163,8 @@ public:
status_t AddMessenger(const char* name,
BMessenger messenger);
status_t AddRef(const char* name, const entry_ref* ref);
status_t AddNodeRef(const char* name,
const node_ref* ref);
status_t AddMessage(const char* name,
const BMessage* message);
status_t AddFlat(const char* name, BFlattenable* object,
@@ -258,6 +262,10 @@ public:
status_t FindRef(const char* name, entry_ref* ref) const;
status_t FindRef(const char* name, int32 index,
entry_ref* ref) const;
status_t FindNodeRef(const char* name,
node_ref* ref) const;
status_t FindNodeRef(const char* name, int32 index,
node_ref* ref) const;
status_t FindMessage(const char* name,
BMessage* message) const;
status_t FindMessage(const char* name, int32 index,
@@ -346,6 +354,10 @@ public:
const entry_ref* ref);
status_t ReplaceRef(const char* name, int32 index,
const entry_ref* ref);
status_t ReplaceNodeRef(const char* name,
const node_ref* ref);
status_t ReplaceNodeRef(const char* name, int32 index,
const node_ref* ref);
status_t ReplaceMessage(const char* name,
const BMessage* message);
status_t ReplaceMessage(const char* name, int32 index,
@@ -394,6 +406,7 @@ public:
bool HasMessenger(const char* name,
int32 n = 0) const;
bool HasRef(const char* name, int32 n = 0) const;
bool HasNodeRef(const char* name, int32 n = 0) const;
bool HasMessage(const char* name, int32 n = 0) const;
bool HasFlat(const char* name,
const BFlattenable* object) const;
+1
View File
@@ -46,6 +46,7 @@ enum {
B_RAW_TYPE = 'RAWT',
B_RECT_TYPE = 'RECT',
B_REF_TYPE = 'RREF',
B_NODE_REF_TYPE = 'NREF',
B_RGB_32_BIT_TYPE = 'RGBB',
B_RGB_COLOR_TYPE = 'RGBC',
B_SIZE_TYPE = 'SIZE',
+7
View File
@@ -5,15 +5,22 @@
#include <DataIO.h>
#include <Entry.h>
#include <Message.h>
#include <Node.h>
#include <SupportDefs.h>
namespace BPrivate { // Only putting these here because Be did
// entry_ref
status_t entry_ref_flatten(char* buffer, size_t* size, const entry_ref* ref);
status_t entry_ref_unflatten(entry_ref* ref, const char* buffer, size_t size);
status_t entry_ref_swap(char* buffer, size_t size);
// node_ref
status_t node_ref_flatten(char* buffer, size_t* size, const node_ref* ref);
status_t node_ref_unflatten(node_ref* ref, const char* buffer, size_t size);
status_t node_ref_swap(char* buffer, size_t size);
uint32 CalculateChecksum(const uint8 *buffer, int32 size);
} // namespace BPrivate