xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionGroupBoolean.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
10b57cec5SDimitry Andric //===-- OptionGroupBoolean.h ------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
95ffd83dbSDimitry Andric #ifndef LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
105ffd83dbSDimitry Andric #define LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "lldb/Interpreter/OptionValueBoolean.h"
130b57cec5SDimitry Andric #include "lldb/Interpreter/Options.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric namespace lldb_private {
160b57cec5SDimitry Andric // OptionGroupBoolean
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric class OptionGroupBoolean : public OptionGroup {
190b57cec5SDimitry Andric public:
200b57cec5SDimitry Andric   // When 'no_argument_toggle_default' is true, then setting the option value
210b57cec5SDimitry Andric   // does NOT require an argument, it sets the boolean value to the inverse of
220b57cec5SDimitry Andric   // the default value
230b57cec5SDimitry Andric   OptionGroupBoolean(uint32_t usage_mask, bool required,
240b57cec5SDimitry Andric                      const char *long_option, int short_option,
250b57cec5SDimitry Andric                      const char *usage_text, bool default_value,
260b57cec5SDimitry Andric                      bool no_argument_toggle_default);
270b57cec5SDimitry Andric 
28*fe6060f1SDimitry Andric   ~OptionGroupBoolean() override = default;
290b57cec5SDimitry Andric 
GetDefinitions()300b57cec5SDimitry Andric   llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
310b57cec5SDimitry Andric     return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
320b57cec5SDimitry Andric   }
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
350b57cec5SDimitry Andric                         ExecutionContext *execution_context) override;
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric   void OptionParsingStarting(ExecutionContext *execution_context) override;
380b57cec5SDimitry Andric 
GetOptionValue()390b57cec5SDimitry Andric   OptionValueBoolean &GetOptionValue() { return m_value; }
400b57cec5SDimitry Andric 
GetOptionValue()410b57cec5SDimitry Andric   const OptionValueBoolean &GetOptionValue() const { return m_value; }
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric protected:
440b57cec5SDimitry Andric   OptionValueBoolean m_value;
450b57cec5SDimitry Andric   OptionDefinition m_option_definition;
460b57cec5SDimitry Andric };
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric } // namespace lldb_private
490b57cec5SDimitry Andric 
505ffd83dbSDimitry Andric #endif // LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
51