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 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 // Project includes 17 #include "lldb/Interpreter/Options.h" 18 #include "lldb/Interpreter/OptionValueBoolean.h" 19 20 namespace lldb_private { 21 //------------------------------------------------------------------------- 22 // OptionGroupBoolean 23 //------------------------------------------------------------------------- 24 25 class OptionGroupBoolean : public OptionGroup 26 { 27 public: 28 // When 'no_argument_toggle_default' is true, then setting the option 29 // value does NOT require an argument, it sets the boolean value to the 30 // inverse of the default value 31 OptionGroupBoolean (uint32_t usage_mask, 32 bool required, 33 const char *long_option, 34 int short_option, 35 const char *usage_text, 36 bool default_value, 37 bool no_argument_toggle_default); 38 39 virtual 40 ~OptionGroupBoolean (); 41 42 43 virtual uint32_t GetNumDefinitions()44 GetNumDefinitions () 45 { 46 return 1; 47 } 48 49 virtual const OptionDefinition* GetDefinitions()50 GetDefinitions () 51 { 52 return &m_option_definition; 53 } 54 55 virtual Error 56 SetOptionValue (CommandInterpreter &interpreter, 57 uint32_t option_idx, 58 const char *option_value); 59 60 virtual void 61 OptionParsingStarting (CommandInterpreter &interpreter); 62 63 OptionValueBoolean & GetOptionValue()64 GetOptionValue () 65 { 66 return m_value; 67 } 68 69 const OptionValueBoolean & GetOptionValue()70 GetOptionValue () const 71 { 72 return m_value; 73 } 74 75 protected: 76 OptionValueBoolean m_value; 77 OptionDefinition m_option_definition; 78 79 }; 80 81 } // namespace lldb_private 82 83 #endif // liblldb_OptionGroupBoolean_h_ 84