vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / model / StackFrameValues.h
blob1dea4a43c4aeb905dafc5a7d7510b9ba232a2973
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef STACK_FRAME_VALUES_H
6 #define STACK_FRAME_VALUES_H
9 #include <Referenceable.h>
10 #include <util/OpenHashTable.h>
11 #include <Variant.h>
14 class ObjectID;
15 class TypeComponentPath;
18 class StackFrameValues : public BReferenceable {
19 public:
20 StackFrameValues();
21 StackFrameValues(const StackFrameValues& other);
22 // throws std::bad_alloc
23 virtual ~StackFrameValues();
25 status_t Init();
27 bool GetValue(ObjectID* variable,
28 const TypeComponentPath* path,
29 BVariant& _value) const;
30 inline bool GetValue(ObjectID* variable,
31 const TypeComponentPath& path,
32 BVariant& _value) const;
33 bool HasValue(ObjectID* variable,
34 const TypeComponentPath* path) const;
35 inline bool HasValue(ObjectID* variable,
36 const TypeComponentPath& path) const;
37 status_t SetValue(ObjectID* variable,
38 TypeComponentPath* path,
39 const BVariant& value);
41 private:
42 struct Key;
43 struct ValueEntry;
44 struct ValueEntryHashDefinition;
46 typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable;
48 private:
49 StackFrameValues& operator=(const StackFrameValues& other);
51 void _Cleanup();
53 private:
54 ValueTable* fValues;
58 bool
59 StackFrameValues::GetValue(ObjectID* variable, const TypeComponentPath& path,
60 BVariant& _value) const
62 return GetValue(variable, &path, _value);
66 bool
67 StackFrameValues::HasValue(ObjectID* variable, const TypeComponentPath& path)
68 const
70 return HasValue(variable, &path);
74 #endif // STACK_FRAME_VALUES_H