btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / debugger / value / value_nodes / ArrayValueNode.h
blob8bcbf6afbd5d24370cad3535a397fd783fd339bc
1 /*
2 * Copyright 2013-2015, Rene Gollent, rene@gollent.com.
3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef ARRAY_VALUE_NODE_H
7 #define ARRAY_VALUE_NODE_H
10 #include <ObjectList.h>
12 #include "ValueNode.h"
15 class AbstractArrayValueNodeChild;
16 class ArrayType;
19 class AbstractArrayValueNode : public ValueNode {
20 public:
21 AbstractArrayValueNode(
22 ValueNodeChild* nodeChild, ArrayType* type,
23 int32 dimension);
24 virtual ~AbstractArrayValueNode();
26 ArrayType* GetArrayType() const
27 { return fType; }
28 int32 Dimension() const
29 { return fDimension; }
31 virtual Type* GetType() const;
33 virtual status_t ResolvedLocationAndValue(
34 ValueLoader* valueLoader,
35 ValueLocation*& _location,
36 Value*& _value);
38 // locking required
40 virtual status_t CreateChildren(TeamTypeInformation* info);
41 virtual int32 CountChildren() const;
42 virtual ValueNodeChild* ChildAt(int32 index) const;
44 virtual bool IsRangedContainer() const;
45 virtual void ClearChildren();
46 virtual status_t CreateChildrenInRange(
47 TeamTypeInformation* info,
48 int32 lowIndex, int32 highIndex);
49 virtual status_t SupportedChildRange(int32& lowIndex,
50 int32& highIndex) const;
51 protected:
52 typedef BObjectList<AbstractArrayValueNodeChild> ChildList;
54 protected:
55 ArrayType* fType;
56 ChildList fChildren;
57 int32 fDimension;
58 int32 fLowerBound;
59 int32 fUpperBound;
60 bool fBoundsInitialized;
64 // TODO: Are ArrayValueNode and InternalArrayValueNode still needed?
66 class ArrayValueNode : public AbstractArrayValueNode {
67 public:
68 ArrayValueNode(ValueNodeChild* nodeChild,
69 ArrayType* type);
70 virtual ~ArrayValueNode();
74 class InternalArrayValueNode : public AbstractArrayValueNode {
75 public:
76 InternalArrayValueNode(
77 ValueNodeChild* nodeChild,
78 ArrayType* type, int32 dimension);
79 virtual ~InternalArrayValueNode();
83 class AbstractArrayValueNodeChild : public ValueNodeChild {
84 public:
85 AbstractArrayValueNodeChild(
86 AbstractArrayValueNode* parent,
87 const BString& name, int64 elementIndex);
88 virtual ~AbstractArrayValueNodeChild();
90 AbstractArrayValueNode* ArrayParent() const { return fParent; }
91 int32 ElementIndex() const { return fElementIndex; }
93 virtual const BString& Name() const;
94 virtual ValueNode* Parent() const;
96 protected:
97 AbstractArrayValueNode* fParent;
98 BString fName;
99 int64 fElementIndex;
103 class ArrayValueNodeChild : public AbstractArrayValueNodeChild {
104 public:
105 ArrayValueNodeChild(
106 AbstractArrayValueNode* parent,
107 const BString& name, int64 elementIndex,
108 Type* type);
109 virtual ~ArrayValueNodeChild();
111 virtual Type* GetType() const;
113 virtual status_t ResolveLocation(ValueLoader* valueLoader,
114 ValueLocation*& _location);
116 private:
117 Type* fType;
121 class InternalArrayValueNodeChild : public AbstractArrayValueNodeChild {
122 public:
123 InternalArrayValueNodeChild(
124 AbstractArrayValueNode* parent,
125 const BString& name, int64 elementIndex,
126 ArrayType* type);
127 virtual ~InternalArrayValueNodeChild();
129 virtual Type* GetType() const;
131 virtual bool IsInternal() const;
132 virtual status_t CreateInternalNode(ValueNode*& _node);
134 virtual status_t ResolveLocation(ValueLoader* valueLoader,
135 ValueLocation*& _location);
137 private:
138 ArrayType* fType;
142 #endif // ARRAY_VALUE_NODE_H