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 {
27 class OptionValueEnumeration : public OptionValue
30 typedef int64_t enum_type;
34 const char *description;
36 typedef UniqueCStringMap<EnumeratorInfo> EnumerationMap;
37 typedef EnumerationMap::Entry EnumerationMapEntry;
39 OptionValueEnumeration (const OptionEnumValueElement *enumerators, enum_type value);
42 ~OptionValueEnumeration();
44 //---------------------------------------------------------------------
45 // Virtual subclass pure virtual overrides
46 //---------------------------------------------------------------------
48 virtual OptionValue::Type
55 DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
58 SetValueFromCString (const char *value,
59 VarSetOperationType op = eVarSetOperationAssign);
64 m_current_value = m_default_value;
65 m_value_was_set = false;
69 virtual lldb::OptionValueSP
73 AutoComplete (CommandInterpreter &interpreter,
75 int match_start_point,
76 int max_return_elements,
80 //---------------------------------------------------------------------
81 // Subclass specific functions
82 //---------------------------------------------------------------------
85 operator = (enum_type value)
87 m_current_value = value;
88 return m_current_value;
92 GetCurrentValue() const
94 return m_current_value;
98 GetDefaultValue() const
100 return m_default_value;
104 SetCurrentValue (enum_type value)
106 m_current_value = value;
110 SetDefaultValue (enum_type value)
112 m_default_value = value;
117 SetEnumerations (const OptionEnumValueElement *enumerators);
119 enum_type m_current_value;
120 enum_type m_default_value;
121 EnumerationMap m_enumerations;
124 } // namespace lldb_private
126 #endif // liblldb_OptionValueEnumeration_h_