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)
38 ~OptionValueBoolean() 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 AutoComplete(CommandInterpreter &interpreter,
70 int match_start_point,
71 int max_return_elements,
73 StringList &matches) override;
75 //---------------------------------------------------------------------
76 // Subclass specific functions
77 //---------------------------------------------------------------------
79 //------------------------------------------------------------------
80 /// Convert to bool operator.
82 /// This allows code to check a OptionValueBoolean in conditions.
85 /// OptionValueBoolean bool_value(...);
91 /// /b True this object contains a valid namespace decl, \b
93 //------------------------------------------------------------------
94 explicit operator bool() const
96 return m_current_value;
103 return m_current_value;
107 GetCurrentValue() const
109 return m_current_value;
113 GetDefaultValue() const
115 return m_default_value;
119 SetCurrentValue (bool value)
121 m_current_value = value;
125 SetDefaultValue (bool value)
127 m_default_value = value;
131 DeepCopy() const override;
134 bool m_current_value;
135 bool m_default_value;
138 } // namespace lldb_private
140 #endif // liblldb_OptionValueBoolean_h_