1 //===-- OptionGroupBoolean.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_OptionGroupBoolean_h_
11 #define liblldb_OptionGroupBoolean_h_
12 
13 #include "lldb/Interpreter/OptionValueBoolean.h"
14 #include "lldb/Interpreter/Options.h"
15 
16 namespace lldb_private {
17 //-------------------------------------------------------------------------
18 // OptionGroupBoolean
19 //-------------------------------------------------------------------------
20 
21 class OptionGroupBoolean : public OptionGroup {
22 public:
23   // When 'no_argument_toggle_default' is true, then setting the option value
24   // does NOT require an argument, it sets the boolean value to the inverse of
25   // the default value
26   OptionGroupBoolean(uint32_t usage_mask, bool required,
27                      const char *long_option, int short_option,
28                      const char *usage_text, bool default_value,
29                      bool no_argument_toggle_default);
30 
31   ~OptionGroupBoolean() override;
32 
GetDefinitions()33   llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
34     return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
35   }
36 
37   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
38                         ExecutionContext *execution_context) override;
39   Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
40 
41   void OptionParsingStarting(ExecutionContext *execution_context) override;
42 
GetOptionValue()43   OptionValueBoolean &GetOptionValue() { return m_value; }
44 
GetOptionValue()45   const OptionValueBoolean &GetOptionValue() const { return m_value; }
46 
47 protected:
48   OptionValueBoolean m_value;
49   OptionDefinition m_option_definition;
50 };
51 
52 } // namespace lldb_private
53 
54 #endif // liblldb_OptionGroupBoolean_h_
55