1 //===-- OptionValueFormatEntity.h --------------------------------*- C++-*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H 10 #define LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H 11 12 #include "lldb/Core/FormatEntity.h" 13 #include "lldb/Interpreter/OptionValue.h" 14 15 namespace lldb_private { 16 17 class OptionValueFormatEntity : public OptionValue { 18 public: 19 OptionValueFormatEntity(const char *default_format); 20 ~OptionValueFormatEntity()21 ~OptionValueFormatEntity() override {} 22 23 // Virtual subclass pure virtual overrides 24 GetType()25 OptionValue::Type GetType() const override { return eTypeFormatEntity; } 26 27 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, 28 uint32_t dump_mask) override; 29 30 Status 31 SetValueFromString(llvm::StringRef value, 32 VarSetOperationType op = eVarSetOperationAssign) override; 33 Status 34 SetValueFromString(const char *, 35 VarSetOperationType = eVarSetOperationAssign) = delete; 36 37 void Clear() override; 38 39 lldb::OptionValueSP DeepCopy() const override; 40 41 void AutoComplete(CommandInterpreter &interpreter, 42 CompletionRequest &request) override; 43 44 // Subclass specific functions 45 GetCurrentValue()46 FormatEntity::Entry &GetCurrentValue() { return m_current_entry; } 47 GetCurrentValue()48 const FormatEntity::Entry &GetCurrentValue() const { return m_current_entry; } 49 SetCurrentValue(const FormatEntity::Entry & value)50 void SetCurrentValue(const FormatEntity::Entry &value) { 51 m_current_entry = value; 52 } 53 GetDefaultValue()54 FormatEntity::Entry &GetDefaultValue() { return m_default_entry; } 55 GetDefaultValue()56 const FormatEntity::Entry &GetDefaultValue() const { return m_default_entry; } 57 58 protected: 59 std::string m_current_format; 60 std::string m_default_format; 61 FormatEntity::Entry m_current_entry; 62 FormatEntity::Entry m_default_entry; 63 }; 64 65 } // namespace lldb_private 66 67 #endif // LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H 68