OptionGroupBoolean.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //===-- OptionGroupBoolean.h ------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
  9. #define LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
  10. #include "lldb/Interpreter/OptionValueBoolean.h"
  11. #include "lldb/Interpreter/Options.h"
  12. namespace lldb_private {
  13. // OptionGroupBoolean
  14. class OptionGroupBoolean : public OptionGroup {
  15. public:
  16. // When 'no_argument_toggle_default' is true, then setting the option value
  17. // does NOT require an argument, it sets the boolean value to the inverse of
  18. // the default value
  19. OptionGroupBoolean(uint32_t usage_mask, bool required,
  20. const char *long_option, int short_option,
  21. const char *usage_text, bool default_value,
  22. bool no_argument_toggle_default);
  23. ~OptionGroupBoolean() override = default;
  24. llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
  25. return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
  26. }
  27. Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
  28. ExecutionContext *execution_context) override;
  29. void OptionParsingStarting(ExecutionContext *execution_context) override;
  30. OptionValueBoolean &GetOptionValue() { return m_value; }
  31. const OptionValueBoolean &GetOptionValue() const { return m_value; }
  32. protected:
  33. OptionValueBoolean m_value;
  34. OptionDefinition m_option_definition;
  35. };
  36. } // namespace lldb_private
  37. #endif // LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H