]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueChar.h
1 //===-- OptionValueBoolean.h ------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OptionValueChar_h_
11 #define liblldb_OptionValueChar_h_
12
13 #include "lldb/Interpreter/OptionValue.h"
14
15 namespace lldb_private {
16
17 class OptionValueChar : public OptionValue {
18 public:
19   OptionValueChar(char value)
20       : OptionValue(), m_current_value(value), m_default_value(value) {}
21
22   OptionValueChar(char current_value, char default_value)
23       : OptionValue(), m_current_value(current_value),
24         m_default_value(default_value) {}
25
26   ~OptionValueChar() override {}
27
28   //---------------------------------------------------------------------
29   // Virtual subclass pure virtual overrides
30   //---------------------------------------------------------------------
31
32   OptionValue::Type GetType() const override { return eTypeChar; }
33
34   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
35                  uint32_t dump_mask) override;
36
37   Status
38   SetValueFromString(llvm::StringRef value,
39                      VarSetOperationType op = eVarSetOperationAssign) override;
40   Status
41   SetValueFromString(const char *,
42                      VarSetOperationType = eVarSetOperationAssign) = delete;
43
44   bool Clear() override {
45     m_current_value = m_default_value;
46     m_value_was_set = false;
47     return true;
48   }
49
50   //---------------------------------------------------------------------
51   // Subclass specific functions
52   //---------------------------------------------------------------------
53
54   const char &operator=(char c) {
55     m_current_value = c;
56     return m_current_value;
57   }
58
59   char GetCurrentValue() const { return m_current_value; }
60
61   char GetDefaultValue() const { return m_default_value; }
62
63   void SetCurrentValue(char value) { m_current_value = value; }
64
65   void SetDefaultValue(char value) { m_default_value = value; }
66
67   lldb::OptionValueSP DeepCopy() const override;
68
69 protected:
70   char m_current_value;
71   char m_default_value;
72 };
73
74 } // namespace lldb_private
75
76 #endif // liblldb_OptionValueChar_h_