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