vfs: check userland buffers before reading them.
[haiku.git] / src / apps / debugger / user_interface / gui / model / VariablesViewState.h
bloba36dd8bebc94fa3f5d6b9c5de7a9091822d6d596
1 /*
2 * Copyright 2013-2014, 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 VARIABLES_VIEW_STATE_H
7 #define VARIABLES_VIEW_STATE_H
10 #include <Message.h>
11 #include <Referenceable.h>
12 #include <util/OpenHashTable.h>
15 class ExpressionValues;
16 class ObjectID;
17 class StackFrameValues;
18 class Type;
19 class TypeComponentPath;
22 class VariablesViewNodeInfo {
23 public:
24 VariablesViewNodeInfo();
25 VariablesViewNodeInfo(
26 const VariablesViewNodeInfo& other);
27 virtual ~VariablesViewNodeInfo();
29 VariablesViewNodeInfo& operator=(
30 const VariablesViewNodeInfo& other);
32 bool IsNodeExpanded() const
33 { return fNodeExpanded; }
34 void SetNodeExpanded(bool expanded);
36 Type* GetCastedType() const
37 { return fCastedType; }
38 void SetCastedType(Type* type);
40 const BMessage& GetRendererSettings() const
41 { return fRendererSettings; }
43 void SetRendererSettings(const BMessage& settings);
45 private:
46 bool fNodeExpanded;
47 Type* fCastedType;
48 BMessage fRendererSettings;
52 class VariablesViewState : public BReferenceable {
53 public:
54 VariablesViewState();
55 virtual ~VariablesViewState();
57 status_t Init();
59 StackFrameValues* Values() const
60 { return fValues; }
61 void SetValues(StackFrameValues* values);
63 ExpressionValues* GetExpressionValues() const
64 { return fExpressionValues; }
65 void SetExpressionValues(ExpressionValues* values);
67 const VariablesViewNodeInfo* GetNodeInfo(ObjectID* variable,
68 const TypeComponentPath* path) const;
69 inline const VariablesViewNodeInfo* GetNodeInfo(ObjectID* variable,
70 const TypeComponentPath& path) const;
72 status_t SetNodeInfo(ObjectID* variable,
73 TypeComponentPath* path,
74 const VariablesViewNodeInfo& info);
75 // requires an on-heap path
77 private:
78 struct Key;
79 struct InfoEntry;
80 struct InfoEntryHashDefinition;
82 typedef BOpenHashTable<InfoEntryHashDefinition> NodeInfoTable;
84 private:
85 void _Cleanup();
87 private:
88 NodeInfoTable* fNodeInfos;
89 StackFrameValues* fValues;
90 ExpressionValues* fExpressionValues;
94 const VariablesViewNodeInfo*
95 VariablesViewState::GetNodeInfo(ObjectID* variable,
96 const TypeComponentPath& path) const
98 return GetNodeInfo(variable, &path);
102 #endif // VARIABLES_VIEW_STATE_H