xref: /NextBSD/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h (revision 84d351007654069f9643c8e4b4802a7f5f08ee42)
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 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Core/FormatEntity.h"
18 #include "lldb/Interpreter/OptionValue.h"
19 
20 namespace lldb_private {
21 
22 class OptionValueFormatEntity : public OptionValue
23 {
24 public:
25     OptionValueFormatEntity (const char *default_format);
26 
27     virtual
~OptionValueFormatEntity()28     ~OptionValueFormatEntity()
29     {
30     }
31 
32     //---------------------------------------------------------------------
33     // Virtual subclass pure virtual overrides
34     //---------------------------------------------------------------------
35 
36     OptionValue::Type
GetType()37     GetType () const override
38     {
39         return eTypeFormatEntity;
40     }
41 
42     void
43     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
44 
45     Error
46     SetValueFromString (llvm::StringRef value,
47                          VarSetOperationType op = eVarSetOperationAssign) override;
48 
49     bool
50     Clear () override;
51 
52     lldb::OptionValueSP
53     DeepCopy () const override;
54 
55     size_t
56     AutoComplete (CommandInterpreter &interpreter,
57                   const char *s,
58                   int match_start_point,
59                   int max_return_elements,
60                   bool &word_complete,
61                   StringList &matches) override;
62 
63     //---------------------------------------------------------------------
64     // Subclass specific functions
65     //---------------------------------------------------------------------
66 
67     FormatEntity::Entry &
GetCurrentValue()68     GetCurrentValue()
69     {
70         return m_current_entry;
71     }
72 
73     const FormatEntity::Entry &
GetCurrentValue()74     GetCurrentValue() const
75     {
76         return m_current_entry;
77     }
78 
79     void
SetCurrentValue(const FormatEntity::Entry & value)80     SetCurrentValue (const FormatEntity::Entry &value)
81     {
82         m_current_entry = value;
83     }
84 
85     FormatEntity::Entry &
GetDefaultValue()86     GetDefaultValue()
87     {
88         return m_default_entry;
89     }
90 
91     const FormatEntity::Entry &
GetDefaultValue()92     GetDefaultValue() const
93     {
94         return m_default_entry;
95     }
96 
97 
98 protected:
99     std::string m_current_format;
100     std::string m_default_format;
101     FormatEntity::Entry m_current_entry;
102     FormatEntity::Entry m_default_entry;
103 };
104 
105 } // namespace lldb_private
106 
107 #endif  // liblldb_OptionValueFormatEntity_h_
108