btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / debugger / value / value_nodes / BMessageValueNode.h
blobdfe55e673c45b60506588590109dbf72f363c78a
1 /*
2 * Copyright 2011-2015, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef BMESSAGE_VALUE_NODE_H
6 #define BMESSAGE_VALUE_NODE_H
8 #include <Message.h>
9 #include <MessagePrivate.h>
10 #include <ObjectList.h>
11 #include <Variant.h>
13 #include "ValueLocation.h"
14 #include "ValueNode.h"
17 class CompoundType;
20 class BMessageValueNode : public ValueNode {
21 public:
22 BMessageValueNode(
23 ValueNodeChild* nodeChild, Type* type);
24 virtual ~BMessageValueNode();
26 virtual Type* GetType() const;
27 virtual status_t ResolvedLocationAndValue(
28 ValueLoader* valueLoader,
29 ValueLocation*& _location,
30 Value*& _value);
32 virtual bool ChildCreationNeedsValue() const
33 { return true; }
34 virtual status_t CreateChildren(TeamTypeInformation* info);
35 virtual int32 CountChildren() const;
36 virtual ValueNodeChild* ChildAt(int32 index) const;
38 private:
40 status_t _GetTypeForTypeCode(
41 TeamTypeInformation* info,
42 type_code type,
43 Type*& _type);
44 status_t _FindField(const char* name,
45 type_code type,
46 BMessage::field_header** result) const;
47 uint32 _HashName(const char* name) const;
48 status_t _FindDataLocation(const char* name,
49 type_code type, int32 index,
50 ValueLocation& location) const;
52 private:
53 class BMessageFieldNode;
54 class BMessageFieldNodeChild;
56 // for GCC2
57 friend class BMessageFieldNode;
58 friend class BMessageFieldNodeChild;
59 friend class BMessageWhatNodeChild;
61 typedef BObjectList<ValueNodeChild> ChildNodeList;
63 private:
64 Type* fType;
65 ChildNodeList fChildren;
66 BVariant fDataLocation;
67 BMessage::message_header*
68 fHeader;
69 BMessage::field_header* fFields;
70 uint8* fData;
71 BMessage fMessage;
72 bool fIsFlatMessage;
76 class BMessageValueNode::BMessageFieldNode : public ValueNode {
77 public:
78 BMessageFieldNode(
79 BMessageFieldNodeChild *child,
80 BMessageValueNode* parent,
81 const BString& name,
82 type_code type, int32 count);
84 virtual ~BMessageFieldNode();
86 virtual Type* GetType() const;
88 virtual status_t ResolvedLocationAndValue(
89 ValueLoader* loader,
90 ValueLocation *& _location,
91 Value*& _value);
93 virtual status_t CreateChildren(TeamTypeInformation* info);
94 virtual int32 CountChildren() const;
95 virtual ValueNodeChild* ChildAt(int32 index) const;
97 private:
98 BString fName;
99 Type* fType;
100 BMessageValueNode* fParent;
101 type_code fFieldType;
102 int32 fFieldCount;
103 ChildNodeList fChildren;
107 class BMessageValueNode::BMessageFieldNodeChild : public ValueNodeChild {
108 public:
109 BMessageFieldNodeChild(
110 BMessageValueNode* parent,
111 Type* nodeType,
112 const BString &name,
113 type_code type, int32 count,
114 int32 index = -1);
116 virtual ~BMessageFieldNodeChild();
118 virtual const BString& Name() const;
119 virtual Type* GetType() const;
120 virtual ValueNode* Parent() const;
122 virtual bool IsInternal() const;
123 virtual status_t CreateInternalNode(
124 ValueNode*& _node);
126 virtual status_t ResolveLocation(ValueLoader* valueLoader,
127 ValueLocation*& _location);
129 private:
130 BString fName;
131 BString fPresentationName;
132 Type* fType;
133 BMessageValueNode* fParent;
134 type_code fFieldType;
135 int32 fFieldCount;
136 int32 fFieldIndex;
139 #endif // BMESSAGE_VALUE_NODE_H