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_
13 #include "lldb/Interpreter/OptionValue.h"
15 namespace lldb_private {
17 class OptionValueFormat : public OptionValue {
19 OptionValueFormat(lldb::Format value)
20 : OptionValue(), m_current_value(value), m_default_value(value) {}
22 OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
23 : OptionValue(), m_current_value(current_value),
24 m_default_value(default_value) {}
26 ~OptionValueFormat() override {}
28 //---------------------------------------------------------------------
29 // Virtual subclass pure virtual overrides
30 //---------------------------------------------------------------------
32 OptionValue::Type GetType() const override { return eTypeFormat; }
34 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
35 uint32_t dump_mask) override;
38 SetValueFromString(llvm::StringRef value,
39 VarSetOperationType op = eVarSetOperationAssign) override;
41 SetValueFromString(const char *,
42 VarSetOperationType = eVarSetOperationAssign) = delete;
44 bool Clear() override {
45 m_current_value = m_default_value;
46 m_value_was_set = false;
50 lldb::OptionValueSP DeepCopy() const override;
52 //---------------------------------------------------------------------
53 // Subclass specific functions
54 //---------------------------------------------------------------------
56 lldb::Format GetCurrentValue() const { return m_current_value; }
58 lldb::Format GetDefaultValue() const { return m_default_value; }
60 void SetCurrentValue(lldb::Format value) { m_current_value = value; }
62 void SetDefaultValue(lldb::Format value) { m_default_value = value; }
65 lldb::Format m_current_value;
66 lldb::Format m_default_value;
69 } // namespace lldb_private
71 #endif // liblldb_OptionValueFormat_h_