10b57cec5SDimitry Andric //===-- OptionValueFormat.h -------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 95ffd83dbSDimitry Andric #ifndef LLDB_INTERPRETER_OPTIONVALUEFORMAT_H 105ffd83dbSDimitry Andric #define LLDB_INTERPRETER_OPTIONVALUEFORMAT_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "lldb/Interpreter/OptionValue.h" 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric namespace lldb_private { 150b57cec5SDimitry Andric 16fe6060f1SDimitry Andric class OptionValueFormat 17fe6060f1SDimitry Andric : public Cloneable<OptionValueFormat, OptionValue> { 180b57cec5SDimitry Andric public: OptionValueFormat(lldb::Format value)190b57cec5SDimitry Andric OptionValueFormat(lldb::Format value) 20fe6060f1SDimitry Andric : m_current_value(value), m_default_value(value) {} 210b57cec5SDimitry Andric OptionValueFormat(lldb::Format current_value,lldb::Format default_value)220b57cec5SDimitry Andric OptionValueFormat(lldb::Format current_value, lldb::Format default_value) 23fe6060f1SDimitry Andric : m_current_value(current_value), m_default_value(default_value) {} 240b57cec5SDimitry Andric 25fe6060f1SDimitry Andric ~OptionValueFormat() override = default; 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric // Virtual subclass pure virtual overrides 280b57cec5SDimitry Andric GetType()290b57cec5SDimitry Andric OptionValue::Type GetType() const override { return eTypeFormat; } 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, 320b57cec5SDimitry Andric uint32_t dump_mask) override; 330b57cec5SDimitry Andric 34*bdd1243dSDimitry Andric llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; 35*bdd1243dSDimitry Andric 360b57cec5SDimitry Andric Status 370b57cec5SDimitry Andric SetValueFromString(llvm::StringRef value, 380b57cec5SDimitry Andric VarSetOperationType op = eVarSetOperationAssign) override; 390b57cec5SDimitry Andric Clear()40e8d8bef9SDimitry Andric void Clear() override { 410b57cec5SDimitry Andric m_current_value = m_default_value; 420b57cec5SDimitry Andric m_value_was_set = false; 430b57cec5SDimitry Andric } 440b57cec5SDimitry Andric 450b57cec5SDimitry Andric // Subclass specific functions 460b57cec5SDimitry Andric GetCurrentValue()470b57cec5SDimitry Andric lldb::Format GetCurrentValue() const { return m_current_value; } 480b57cec5SDimitry Andric GetDefaultValue()490b57cec5SDimitry Andric lldb::Format GetDefaultValue() const { return m_default_value; } 500b57cec5SDimitry Andric SetCurrentValue(lldb::Format value)510b57cec5SDimitry Andric void SetCurrentValue(lldb::Format value) { m_current_value = value; } 520b57cec5SDimitry Andric SetDefaultValue(lldb::Format value)530b57cec5SDimitry Andric void SetDefaultValue(lldb::Format value) { m_default_value = value; } 540b57cec5SDimitry Andric 550b57cec5SDimitry Andric protected: 560b57cec5SDimitry Andric lldb::Format m_current_value; 570b57cec5SDimitry Andric lldb::Format m_default_value; 580b57cec5SDimitry Andric }; 590b57cec5SDimitry Andric 600b57cec5SDimitry Andric } // namespace lldb_private 610b57cec5SDimitry Andric 625ffd83dbSDimitry Andric #endif // LLDB_INTERPRETER_OPTIONVALUEFORMAT_H 63