]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h
MFV r282150
[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 {
23 public:
24     OptionValueChar (char value) :
25         OptionValue(),
26         m_current_value (value),
27         m_default_value (value)
28     {
29     }
30     OptionValueChar (char current_value,
31                      char default_value) :
32         OptionValue(),
33         m_current_value (current_value),
34         m_default_value (default_value)
35     {
36     }
37     
38     virtual 
39     ~OptionValueChar()
40     {
41     }
42     
43     //---------------------------------------------------------------------
44     // Virtual subclass pure virtual overrides
45     //---------------------------------------------------------------------
46     
47     virtual OptionValue::Type
48     GetType () const
49     {
50         return eTypeChar;
51     }
52     
53     virtual void
54     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
55     
56     virtual Error
57     SetValueFromCString (const char *value,
58                          VarSetOperationType op = eVarSetOperationAssign);
59     
60     virtual bool
61     Clear ()
62     {
63         m_current_value = m_default_value;
64         m_value_was_set = false;
65         return true;
66     }
67
68     //---------------------------------------------------------------------
69     // Subclass specific functions
70     //---------------------------------------------------------------------
71     
72     const char &
73     operator = (char c)
74     {
75         m_current_value = c;
76         return m_current_value;
77     }
78
79     char
80     GetCurrentValue() const
81     {
82         return m_current_value;
83     }
84     
85     char
86     GetDefaultValue() const
87     {
88         return m_default_value;
89     }
90     
91     void
92     SetCurrentValue (char value)
93     {
94         m_current_value = value;
95     }
96     
97     void
98     SetDefaultValue (char value)
99     {
100         m_default_value = value;
101     }
102     
103     virtual lldb::OptionValueSP
104     DeepCopy () const;
105
106 protected:
107     char m_current_value;
108     char m_default_value;
109 };
110
111 } // namespace lldb_private
112
113 #endif  // liblldb_OptionValueChar_h_