LLDB mainline
OptionValueChar.h
Go to the documentation of this file.
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
9#ifndef LLDB_INTERPRETER_OPTIONVALUECHAR_H
10#define LLDB_INTERPRETER_OPTIONVALUECHAR_H
11
13
14namespace lldb_private {
15
16class OptionValueChar : public Cloneable<OptionValueChar, OptionValue> {
17public:
18 OptionValueChar(char value)
19 : m_current_value(value), m_default_value(value) {}
20
21 OptionValueChar(char current_value, char default_value)
22 : m_current_value(current_value), m_default_value(default_value) {}
23
24 ~OptionValueChar() override = default;
25
26 // Virtual subclass pure virtual overrides
27
28 OptionValue::Type GetType() const override { return eTypeChar; }
29
30 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
31 uint32_t dump_mask) override;
32
33 llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
34 return m_current_value;
35 }
36
37 Status
38 SetValueFromString(llvm::StringRef value,
40
41 void Clear() override {
43 m_value_was_set = false;
44 }
45
46 // Subclass specific functions
47
48 const char &operator=(char c) {
50 return m_current_value;
51 }
52
53 char GetCurrentValue() const { return m_current_value; }
54
55 char GetDefaultValue() const { return m_default_value; }
56
57 void SetCurrentValue(char value) { m_current_value = value; }
58
59 void SetDefaultValue(char value) { m_default_value = value; }
60
61protected:
64};
65
66} // namespace lldb_private
67
68#endif // LLDB_INTERPRETER_OPTIONVALUECHAR_H
A class that implements CRTP-based "virtual constructor" idiom.
Definition: Cloneable.h:40
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const char & operator=(char c)
void SetDefaultValue(char value)
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
void SetCurrentValue(char value)
~OptionValueChar() override=default
OptionValueChar(char current_value, char default_value)
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override
OptionValue::Type GetType() const override
An error handling class.
Definition: Status.h:44
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.