]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Interpreter/OptionValueFormat.h
Vendor import of lldb trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / include / lldb / Interpreter / OptionValueFormat.h
1 //===-- OptionValueFormat.h -------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OptionValueFormat_h_
11 #define liblldb_OptionValueFormat_h_
12
13 #include "lldb/Interpreter/OptionValue.h"
14
15 namespace lldb_private {
16
17 class OptionValueFormat : public OptionValue {
18 public:
19   OptionValueFormat(lldb::Format value)
20       : OptionValue(), m_current_value(value), m_default_value(value) {}
21
22   OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
23       : OptionValue(), m_current_value(current_value),
24         m_default_value(default_value) {}
25
26   ~OptionValueFormat() override {}
27
28   //---------------------------------------------------------------------
29   // Virtual subclass pure virtual overrides
30   //---------------------------------------------------------------------
31
32   OptionValue::Type GetType() const override { return eTypeFormat; }
33
34   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
35                  uint32_t dump_mask) override;
36
37   Status
38   SetValueFromString(llvm::StringRef value,
39                      VarSetOperationType op = eVarSetOperationAssign) override;
40   Status
41   SetValueFromString(const char *,
42                      VarSetOperationType = eVarSetOperationAssign) = delete;
43
44   bool Clear() override {
45     m_current_value = m_default_value;
46     m_value_was_set = false;
47     return true;
48   }
49
50   lldb::OptionValueSP DeepCopy() const override;
51
52   //---------------------------------------------------------------------
53   // Subclass specific functions
54   //---------------------------------------------------------------------
55
56   lldb::Format GetCurrentValue() const { return m_current_value; }
57
58   lldb::Format GetDefaultValue() const { return m_default_value; }
59
60   void SetCurrentValue(lldb::Format value) { m_current_value = value; }
61
62   void SetDefaultValue(lldb::Format value) { m_default_value = value; }
63
64 protected:
65   lldb::Format m_current_value;
66   lldb::Format m_default_value;
67 };
68
69 } // namespace lldb_private
70
71 #endif // liblldb_OptionValueFormat_h_