]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormat.h
MFV r337161: 9512 zfs remap poolname@snapname coredumps
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / 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 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Interpreter/OptionValue.h"
18
19 namespace lldb_private {
20
21 class OptionValueFormat : public OptionValue {
22 public:
23   OptionValueFormat(lldb::Format value)
24       : OptionValue(), m_current_value(value), m_default_value(value) {}
25
26   OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
27       : OptionValue(), m_current_value(current_value),
28         m_default_value(default_value) {}
29
30   ~OptionValueFormat() override {}
31
32   //---------------------------------------------------------------------
33   // Virtual subclass pure virtual overrides
34   //---------------------------------------------------------------------
35
36   OptionValue::Type GetType() const override { return eTypeFormat; }
37
38   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
39                  uint32_t dump_mask) override;
40
41   Status
42   SetValueFromString(llvm::StringRef value,
43                      VarSetOperationType op = eVarSetOperationAssign) override;
44   Status
45   SetValueFromString(const char *,
46                      VarSetOperationType = eVarSetOperationAssign) = delete;
47
48   bool Clear() override {
49     m_current_value = m_default_value;
50     m_value_was_set = false;
51     return true;
52   }
53
54   lldb::OptionValueSP DeepCopy() const override;
55
56   //---------------------------------------------------------------------
57   // Subclass specific functions
58   //---------------------------------------------------------------------
59
60   lldb::Format GetCurrentValue() const { return m_current_value; }
61
62   lldb::Format GetDefaultValue() const { return m_default_value; }
63
64   void SetCurrentValue(lldb::Format value) { m_current_value = value; }
65
66   void SetDefaultValue(lldb::Format value) { m_default_value = value; }
67
68 protected:
69   lldb::Format m_current_value;
70   lldb::Format m_default_value;
71 };
72
73 } // namespace lldb_private
74
75 #endif // liblldb_OptionValueFormat_h_