OptionValueChar.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //===-- OptionValueChar.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_OPTIONVALUECHAR_H
  9. #define LLDB_INTERPRETER_OPTIONVALUECHAR_H
  10. #include "lldb/Interpreter/OptionValue.h"
  11. namespace lldb_private {
  12. class OptionValueChar : public Cloneable<OptionValueChar, OptionValue> {
  13. public:
  14. OptionValueChar(char value)
  15. : m_current_value(value), m_default_value(value) {}
  16. OptionValueChar(char current_value, char default_value)
  17. : m_current_value(current_value), m_default_value(default_value) {}
  18. ~OptionValueChar() override = default;
  19. // Virtual subclass pure virtual overrides
  20. OptionValue::Type GetType() const override { return eTypeChar; }
  21. void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
  22. uint32_t dump_mask) override;
  23. Status
  24. SetValueFromString(llvm::StringRef value,
  25. VarSetOperationType op = eVarSetOperationAssign) override;
  26. void Clear() override {
  27. m_current_value = m_default_value;
  28. m_value_was_set = false;
  29. }
  30. // Subclass specific functions
  31. const char &operator=(char c) {
  32. m_current_value = c;
  33. return m_current_value;
  34. }
  35. char GetCurrentValue() const { return m_current_value; }
  36. char GetDefaultValue() const { return m_default_value; }
  37. void SetCurrentValue(char value) { m_current_value = value; }
  38. void SetDefaultValue(char value) { m_default_value = value; }
  39. protected:
  40. char m_current_value;
  41. char m_default_value;
  42. };
  43. } // namespace lldb_private
  44. #endif // LLDB_INTERPRETER_OPTIONVALUECHAR_H