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
18     : public Cloneable<OptionValueFormatEntity, OptionValue> {
19 public:
20   OptionValueFormatEntity(const char *default_format);
21 
22   ~OptionValueFormatEntity() override = default;
23 
24   // Virtual subclass pure virtual overrides
25 
26   OptionValue::Type GetType() const override { return eTypeFormatEntity; }
27 
28   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
29                  uint32_t dump_mask) override;
30 
31   Status
32   SetValueFromString(llvm::StringRef value,
33                      VarSetOperationType op = eVarSetOperationAssign) override;
34 
35   void Clear() override;
36 
37   void AutoComplete(CommandInterpreter &interpreter,
38                     CompletionRequest &request) override;
39 
40   // Subclass specific functions
41 
42   FormatEntity::Entry &GetCurrentValue() { return m_current_entry; }
43 
44   const FormatEntity::Entry &GetCurrentValue() const { return m_current_entry; }
45 
46   void SetCurrentValue(const FormatEntity::Entry &value) {
47     m_current_entry = value;
48   }
49 
50   FormatEntity::Entry &GetDefaultValue() { return m_default_entry; }
51 
52   const FormatEntity::Entry &GetDefaultValue() const { return m_default_entry; }
53 
54 protected:
55   std::string m_current_format;
56   std::string m_default_format;
57   FormatEntity::Entry m_current_entry;
58   FormatEntity::Entry m_default_entry;
59 };
60 
61 } // namespace lldb_private
62 
63 #endif // LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H
64