1 //===-- OptionValueChar.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_OptionValueChar_h_
10 #define liblldb_OptionValueChar_h_
12 #include "lldb/Interpreter/OptionValue.h"
14 namespace lldb_private {
16 class OptionValueChar : public OptionValue {
18 OptionValueChar(char value)
19 : OptionValue(), m_current_value(value), m_default_value(value) {}
21 OptionValueChar(char current_value, char default_value)
22 : OptionValue(), m_current_value(current_value),
23 m_default_value(default_value) {}
25 ~OptionValueChar() override {}
27 // Virtual subclass pure virtual overrides
29 OptionValue::Type GetType() const override { return eTypeChar; }
31 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
32 uint32_t dump_mask) override;
35 SetValueFromString(llvm::StringRef value,
36 VarSetOperationType op = eVarSetOperationAssign) override;
38 SetValueFromString(const char *,
39 VarSetOperationType = eVarSetOperationAssign) = delete;
41 bool Clear() override {
42 m_current_value = m_default_value;
43 m_value_was_set = false;
47 // Subclass specific functions
49 const char &operator=(char c) {
51 return m_current_value;
54 char GetCurrentValue() const { return m_current_value; }
56 char GetDefaultValue() const { return m_default_value; }
58 void SetCurrentValue(char value) { m_current_value = value; }
60 void SetDefaultValue(char value) { m_default_value = value; }
62 lldb::OptionValueSP DeepCopy() const override;
69 } // namespace lldb_private
71 #endif // liblldb_OptionValueChar_h_