1 //===-- OptionValueFormat.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OptionValueFormat_h_
11 #define liblldb_OptionValueFormat_h_
15 // Other libraries and framework includes
17 #include "lldb/Interpreter/OptionValue.h"
19 namespace lldb_private {
21 class OptionValueFormat : public OptionValue {
23 OptionValueFormat(lldb::Format value)
24 : OptionValue(), m_current_value(value), m_default_value(value) {}
26 OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
27 : OptionValue(), m_current_value(current_value),
28 m_default_value(default_value) {}
30 ~OptionValueFormat() override {}
32 //---------------------------------------------------------------------
33 // Virtual subclass pure virtual overrides
34 //---------------------------------------------------------------------
36 OptionValue::Type GetType() const override { return eTypeFormat; }
38 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
39 uint32_t dump_mask) override;
42 SetValueFromString(llvm::StringRef value,
43 VarSetOperationType op = eVarSetOperationAssign) override;
45 SetValueFromString(const char *,
46 VarSetOperationType = eVarSetOperationAssign) = delete;
48 bool Clear() override {
49 m_current_value = m_default_value;
50 m_value_was_set = false;
54 lldb::OptionValueSP DeepCopy() const override;
56 //---------------------------------------------------------------------
57 // Subclass specific functions
58 //---------------------------------------------------------------------
60 lldb::Format GetCurrentValue() const { return m_current_value; }
62 lldb::Format GetDefaultValue() const { return m_default_value; }
64 void SetCurrentValue(lldb::Format value) { m_current_value = value; }
66 void SetDefaultValue(lldb::Format value) { m_default_value = value; }
69 lldb::Format m_current_value;
70 lldb::Format m_default_value;
73 } // namespace lldb_private
75 #endif // liblldb_OptionValueFormat_h_