1 //===-- OptionValueBoolean.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_OptionValueBoolean_h_
11 #define liblldb_OptionValueBoolean_h_
15 // Other libraries and framework includes
17 #include "lldb/Interpreter/OptionValue.h"
19 namespace lldb_private {
21 class OptionValueBoolean : public OptionValue
24 OptionValueBoolean (bool value) :
26 m_current_value (value),
27 m_default_value (value)
30 OptionValueBoolean (bool current_value,
33 m_current_value (current_value),
34 m_default_value (default_value)
43 //---------------------------------------------------------------------
44 // Virtual subclass pure virtual overrides
45 //---------------------------------------------------------------------
47 virtual OptionValue::Type
54 DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
57 SetValueFromCString (const char *value,
58 VarSetOperationType op = eVarSetOperationAssign);
63 m_current_value = m_default_value;
64 m_value_was_set = false;
69 AutoComplete (CommandInterpreter &interpreter,
71 int match_start_point,
72 int max_return_elements,
76 //---------------------------------------------------------------------
77 // Subclass specific functions
78 //---------------------------------------------------------------------
80 //------------------------------------------------------------------
81 /// Convert to bool operator.
83 /// This allows code to check a OptionValueBoolean in conditions.
86 /// OptionValueBoolean bool_value(...);
92 /// /b True this object contains a valid namespace decl, \b
94 //------------------------------------------------------------------
95 explicit operator bool() const
97 return m_current_value;
104 return m_current_value;
108 GetCurrentValue() const
110 return m_current_value;
114 GetDefaultValue() const
116 return m_default_value;
120 SetCurrentValue (bool value)
122 m_current_value = value;
126 SetDefaultValue (bool value)
128 m_default_value = value;
131 virtual lldb::OptionValueSP
135 bool m_current_value;
136 bool m_default_value;
139 } // namespace lldb_private
141 #endif // liblldb_OptionValueBoolean_h_