]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h
Upgrade to OpenSSH 7.8p1.
[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 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Interpreter/OptionValue.h"
18
19 namespace lldb_private {
20
21 class OptionValueChar : public OptionValue {
22 public:
23   OptionValueChar(char value)
24       : OptionValue(), m_current_value(value), m_default_value(value) {}
25
26   OptionValueChar(char current_value, char default_value)
27       : OptionValue(), m_current_value(current_value),
28         m_default_value(default_value) {}
29
30   ~OptionValueChar() override {}
31
32   //---------------------------------------------------------------------
33   // Virtual subclass pure virtual overrides
34   //---------------------------------------------------------------------
35
36   OptionValue::Type GetType() const override { return eTypeChar; }
37
38   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
39                  uint32_t dump_mask) override;
40
41   Status
42   SetValueFromString(llvm::StringRef value,
43                      VarSetOperationType op = eVarSetOperationAssign) override;
44   Status
45   SetValueFromString(const char *,
46                      VarSetOperationType = eVarSetOperationAssign) = delete;
47
48   bool Clear() override {
49     m_current_value = m_default_value;
50     m_value_was_set = false;
51     return true;
52   }
53
54   //---------------------------------------------------------------------
55   // Subclass specific functions
56   //---------------------------------------------------------------------
57
58   const char &operator=(char c) {
59     m_current_value = c;
60     return m_current_value;
61   }
62
63   char GetCurrentValue() const { return m_current_value; }
64
65   char GetDefaultValue() const { return m_default_value; }
66
67   void SetCurrentValue(char value) { m_current_value = value; }
68
69   void SetDefaultValue(char value) { m_default_value = value; }
70
71   lldb::OptionValueSP DeepCopy() const override;
72
73 protected:
74   char m_current_value;
75   char m_default_value;
76 };
77
78 } // namespace lldb_private
79
80 #endif // liblldb_OptionValueChar_h_