]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUInt64.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueUInt64.h
1 //===-- OptionValueUInt64.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_OptionValueUInt64_h_
11 #define liblldb_OptionValueUInt64_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 OptionValueUInt64 : public OptionValue
22 {
23 public:
24     OptionValueUInt64 () :
25         OptionValue(),
26         m_current_value (0),
27         m_default_value (0)
28     {
29     }
30
31     OptionValueUInt64 (uint64_t value) :
32         OptionValue(),
33         m_current_value (value),
34         m_default_value (value)
35     {
36     }
37
38     OptionValueUInt64 (uint64_t current_value,
39                        uint64_t default_value) :
40         OptionValue(),
41         m_current_value (current_value),
42         m_default_value (default_value)
43     {
44     }
45     
46     virtual 
47     ~OptionValueUInt64()
48     {
49     }
50     
51     //---------------------------------------------------------------------
52     // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
53     // inside of a lldb::OptionValueSP object if all goes well. If the 
54     // string isn't a uint64_t value or any other error occurs, return an 
55     // empty lldb::OptionValueSP and fill error in with the correct stuff.
56     //---------------------------------------------------------------------
57     static lldb::OptionValueSP
58     Create (const char *value_cstr, Error &error);
59     //---------------------------------------------------------------------
60     // Virtual subclass pure virtual overrides
61     //---------------------------------------------------------------------
62     
63     virtual OptionValue::Type
64     GetType () const
65     {
66         return eTypeUInt64;
67     }
68     
69     virtual void
70     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
71     
72     virtual Error
73     SetValueFromCString (const char *value,
74                          VarSetOperationType op = eVarSetOperationAssign);
75     
76     virtual bool
77     Clear ()
78     {
79         m_current_value = m_default_value;
80         m_value_was_set = false;
81         return true;
82     }
83     
84     virtual lldb::OptionValueSP
85     DeepCopy () const;
86     
87     //---------------------------------------------------------------------
88     // Subclass specific functions
89     //---------------------------------------------------------------------
90     
91     const uint64_t &
92     operator = (uint64_t value)
93     {
94         m_current_value = value;
95         return m_current_value;
96     }
97
98     operator uint64_t () const
99     {
100         return m_current_value;
101     }
102
103     uint64_t
104     GetCurrentValue() const
105     {
106         return m_current_value;
107     }
108     
109     uint64_t
110     GetDefaultValue() const
111     {
112         return m_default_value;
113     }
114     
115     void
116     SetCurrentValue (uint64_t value)
117     {
118         m_current_value = value;
119     }
120     
121     void
122     SetDefaultValue (uint64_t value)
123     {
124         m_default_value = value;
125     }
126     
127 protected:
128     uint64_t m_current_value;
129     uint64_t m_default_value;
130 };
131
132 } // namespace lldb_private
133
134 #endif  // liblldb_OptionValueUInt64_h_