Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 9 | #ifndef LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H |
| 10 | #define LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 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 | |
| 21 | ~OptionValueFormatEntity() override {} |
| 22 | |
| 23 | // Virtual subclass pure virtual overrides |
| 24 | |
| 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 37 | void Clear() override; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 38 | |
| 39 | lldb::OptionValueSP DeepCopy() const override; |
| 40 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 41 | void AutoComplete(CommandInterpreter &interpreter, |
| 42 | CompletionRequest &request) override; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 43 | |
| 44 | // Subclass specific functions |
| 45 | |
| 46 | FormatEntity::Entry &GetCurrentValue() { return m_current_entry; } |
| 47 | |
| 48 | const FormatEntity::Entry &GetCurrentValue() const { return m_current_entry; } |
| 49 | |
| 50 | void SetCurrentValue(const FormatEntity::Entry &value) { |
| 51 | m_current_entry = value; |
| 52 | } |
| 53 | |
| 54 | FormatEntity::Entry &GetDefaultValue() { return m_default_entry; } |
| 55 | |
| 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 67 | #endif // LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H |