1 //===-- OptionValueEnumeration.h --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OptionValueEnumeration_h_
11 #define liblldb_OptionValueEnumeration_h_
15 // Other libraries and framework includes
17 #include "lldb/Core/ConstString.h"
18 #include "lldb/Core/Error.h"
19 #include "lldb/Core/Stream.h"
20 #include "lldb/Core/StreamString.h"
21 #include "lldb/Core/UniqueCStringMap.h"
22 #include "lldb/Interpreter/OptionValue.h"
24 namespace lldb_private {
26 class OptionValueEnumeration : public OptionValue
29 typedef int64_t enum_type;
33 const char *description;
35 typedef UniqueCStringMap<EnumeratorInfo> EnumerationMap;
36 typedef EnumerationMap::Entry EnumerationMapEntry;
38 OptionValueEnumeration (const OptionEnumValueElement *enumerators, enum_type value);
40 ~OptionValueEnumeration() override;
42 //---------------------------------------------------------------------
43 // Virtual subclass pure virtual overrides
44 //---------------------------------------------------------------------
47 GetType() const override
53 DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
56 SetValueFromString(llvm::StringRef value,
57 VarSetOperationType op = eVarSetOperationAssign) override;
62 m_current_value = m_default_value;
63 m_value_was_set = false;
68 DeepCopy() const override;
71 AutoComplete(CommandInterpreter &interpreter,
73 int match_start_point,
74 int max_return_elements,
76 StringList &matches) override;
78 //---------------------------------------------------------------------
79 // Subclass specific functions
80 //---------------------------------------------------------------------
83 operator = (enum_type value)
85 m_current_value = value;
86 return m_current_value;
90 GetCurrentValue() const
92 return m_current_value;
96 GetDefaultValue() const
98 return m_default_value;
102 SetCurrentValue (enum_type value)
104 m_current_value = value;
108 SetDefaultValue (enum_type value)
110 m_default_value = value;
115 SetEnumerations (const OptionEnumValueElement *enumerators);
117 enum_type m_current_value;
118 enum_type m_default_value;
119 EnumerationMap m_enumerations;
122 } // namespace lldb_private
124 #endif // liblldb_OptionValueEnumeration_h_