]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Interpreter/OptionValueUInt64.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / include / lldb / Interpreter / OptionValueUInt64.h
1 //===-- OptionValueUInt64.h --------------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef liblldb_OptionValueUInt64_h_
12 #define liblldb_OptionValueUInt64_h_
13
14 // C Includes
15 // C++ Includes
16 // Other libraries and framework includes
17 // Project includes
18 #include "lldb/Interpreter/OptionValue.h"
19
20 namespace lldb_private {
21
22 class OptionValueUInt64 : public OptionValue {
23 public:
24   OptionValueUInt64() : OptionValue(), m_current_value(0), m_default_value(0) {}
25
26   OptionValueUInt64(uint64_t value)
27       : OptionValue(), m_current_value(value), m_default_value(value) {}
28
29   OptionValueUInt64(uint64_t current_value, uint64_t default_value)
30       : OptionValue(), m_current_value(current_value),
31         m_default_value(default_value) {}
32
33   ~OptionValueUInt64() override {}
34
35   //---------------------------------------------------------------------
36   // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
37   // inside of a lldb::OptionValueSP object if all goes well. If the
38   // string isn't a uint64_t value or any other error occurs, return an
39   // empty lldb::OptionValueSP and fill error in with the correct stuff.
40   //---------------------------------------------------------------------
41   static lldb::OptionValueSP Create(const char *, Error &) = delete;
42   static lldb::OptionValueSP Create(llvm::StringRef value_str, Error &error);
43   //---------------------------------------------------------------------
44   // Virtual subclass pure virtual overrides
45   //---------------------------------------------------------------------
46
47   OptionValue::Type GetType() const override { return eTypeUInt64; }
48
49   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
50                  uint32_t dump_mask) override;
51
52   Error
53   SetValueFromString(llvm::StringRef value,
54                      VarSetOperationType op = eVarSetOperationAssign) override;
55   Error
56   SetValueFromString(const char *,
57                      VarSetOperationType = eVarSetOperationAssign) = delete;
58
59   bool Clear() override {
60     m_current_value = m_default_value;
61     m_value_was_set = false;
62     return true;
63   }
64
65   lldb::OptionValueSP DeepCopy() const override;
66
67   //---------------------------------------------------------------------
68   // Subclass specific functions
69   //---------------------------------------------------------------------
70
71   const uint64_t &operator=(uint64_t value) {
72     m_current_value = value;
73     return m_current_value;
74   }
75
76   operator uint64_t() const { return m_current_value; }
77
78   uint64_t GetCurrentValue() const { return m_current_value; }
79
80   uint64_t GetDefaultValue() const { return m_default_value; }
81
82   void SetCurrentValue(uint64_t value) { m_current_value = value; }
83
84   void SetDefaultValue(uint64_t value) { m_default_value = value; }
85
86 protected:
87   uint64_t m_current_value;
88   uint64_t m_default_value;
89 };
90
91 } // namespace lldb_private
92
93 #endif // liblldb_OptionValueUInt64_h_