vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / model / ExpressionValues.h
blob1498b5267f3ebad7de1406c4eab5fefab6b4d2f6
1 /*
2 * Copyright 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 EXPRESSION_VALUES_H
7 #define EXPRESSION_VALUES_H
10 #include <String.h>
12 #include <Referenceable.h>
13 #include <util/OpenHashTable.h>
14 #include <Variant.h>
17 class FunctionID;
18 class Thread;
21 class ExpressionValues : public BReferenceable {
22 public:
23 ExpressionValues();
24 ExpressionValues(const ExpressionValues& other);
25 // throws std::bad_alloc
26 virtual ~ExpressionValues();
28 status_t Init();
30 bool GetValue(FunctionID* function,
31 Thread* thread,
32 const BString* expression,
33 BVariant& _value) const;
34 inline bool GetValue(FunctionID* function,
35 Thread* thread,
36 const BString& expression,
37 BVariant& _value) const;
38 bool HasValue(FunctionID* function,
39 Thread* thread,
40 const BString* expression) const;
41 inline bool HasValue(FunctionID* function,
42 Thread* thread,
43 const BString& expression) const;
44 status_t SetValue(FunctionID* function,
45 Thread* thread,
46 const BString& expression,
47 const BVariant& value);
49 private:
50 struct Key;
51 struct ValueEntry;
52 struct ValueEntryHashDefinition;
54 typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable;
56 private:
57 ExpressionValues& operator=(const ExpressionValues& other);
59 void _Cleanup();
61 private:
62 ValueTable* fValues;
66 bool
67 ExpressionValues::GetValue(FunctionID* function, Thread* thread,
68 const BString& expression, BVariant& _value) const
70 return GetValue(function, thread, &expression, _value);
74 bool
75 ExpressionValues::HasValue(FunctionID* function, Thread* thread,
76 const BString& expression) const
78 return HasValue(function, thread, &expression);
82 #endif // EXPRESSION_VALUES_H