Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:50

0001 //===-- OptionValueFormat.h -------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_INTERPRETER_OPTIONVALUEFORMAT_H
0010 #define LLDB_INTERPRETER_OPTIONVALUEFORMAT_H
0011 
0012 #include "lldb/Interpreter/OptionValue.h"
0013 
0014 namespace lldb_private {
0015 
0016 class OptionValueFormat
0017     : public Cloneable<OptionValueFormat, OptionValue> {
0018 public:
0019   OptionValueFormat(lldb::Format value)
0020       : m_current_value(value), m_default_value(value) {}
0021 
0022   OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
0023       : m_current_value(current_value), m_default_value(default_value) {}
0024 
0025   ~OptionValueFormat() override = default;
0026 
0027   // Virtual subclass pure virtual overrides
0028 
0029   OptionValue::Type GetType() const override { return eTypeFormat; }
0030 
0031   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
0032                  uint32_t dump_mask) override;
0033 
0034   llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
0035 
0036   Status
0037   SetValueFromString(llvm::StringRef value,
0038                      VarSetOperationType op = eVarSetOperationAssign) override;
0039 
0040   void Clear() override {
0041     m_current_value = m_default_value;
0042     m_value_was_set = false;
0043   }
0044 
0045   // Subclass specific functions
0046 
0047   lldb::Format GetCurrentValue() const { return m_current_value; }
0048 
0049   lldb::Format GetDefaultValue() const { return m_default_value; }
0050 
0051   void SetCurrentValue(lldb::Format value) { m_current_value = value; }
0052 
0053   void SetDefaultValue(lldb::Format value) { m_default_value = value; }
0054 
0055 protected:
0056   lldb::Format m_current_value;
0057   lldb::Format m_default_value;
0058 };
0059 
0060 } // namespace lldb_private
0061 
0062 #endif // LLDB_INTERPRETER_OPTIONVALUEFORMAT_H