xref: /NextBSD/contrib/llvm/tools/lldb/source/API/SBVariablesOptions.cpp (revision 84d351007654069f9643c8e4b4802a7f5f08ee42)
1 //===-- SBVariablesOptions.cpp --------------------------------------*- 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 
11 #include "lldb/API/SBVariablesOptions.h"
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
16 class VariablesOptionsImpl
17 {
18 public:
VariablesOptionsImpl()19     VariablesOptionsImpl () :
20     m_include_arguments(false),
21     m_include_locals(false),
22     m_include_statics(false),
23     m_in_scope_only(false),
24     m_include_runtime_support_values(false),
25     m_use_dynamic(lldb::eNoDynamicValues)
26     {}
27 
28     VariablesOptionsImpl (const VariablesOptionsImpl&) = default;
29 
30     ~VariablesOptionsImpl () = default;
31 
32     VariablesOptionsImpl&
33     operator = (const VariablesOptionsImpl&) = default;
34 
35     bool
GetIncludeArguments() const36     GetIncludeArguments () const
37     {
38         return m_include_arguments;
39     }
40 
41     void
SetIncludeArguments(bool b)42     SetIncludeArguments (bool b)
43     {
44         m_include_arguments = b;
45     }
46 
47     bool
GetIncludeLocals() const48     GetIncludeLocals () const
49     {
50         return m_include_locals;
51     }
52 
53     void
SetIncludeLocals(bool b)54     SetIncludeLocals (bool b)
55     {
56         m_include_locals = b;
57     }
58 
59     bool
GetIncludeStatics() const60     GetIncludeStatics () const
61     {
62         return m_include_statics;
63     }
64 
65     void
SetIncludeStatics(bool b)66     SetIncludeStatics (bool b)
67     {
68         m_include_statics = b;
69     }
70 
71     bool
GetInScopeOnly() const72     GetInScopeOnly () const
73     {
74         return m_in_scope_only;
75     }
76 
77     void
SetInScopeOnly(bool b)78     SetInScopeOnly (bool b)
79     {
80         m_in_scope_only = b;
81     }
82 
83     bool
GetIncludeRuntimeSupportValues() const84     GetIncludeRuntimeSupportValues () const
85     {
86         return m_include_runtime_support_values;
87     }
88 
89     void
SetIncludeRuntimeSupportValues(bool b)90     SetIncludeRuntimeSupportValues (bool b)
91     {
92         m_include_runtime_support_values = b;
93     }
94 
95     lldb::DynamicValueType
GetUseDynamic() const96     GetUseDynamic () const
97     {
98         return m_use_dynamic;
99     }
100 
101     void
SetUseDynamic(lldb::DynamicValueType d)102     SetUseDynamic (lldb::DynamicValueType d)
103     {
104         m_use_dynamic = d;
105     }
106 
107 
108 private:
109     bool m_include_arguments : 1;
110     bool m_include_locals : 1;
111     bool m_include_statics : 1;
112     bool m_in_scope_only : 1;
113     bool m_include_runtime_support_values : 1;
114     lldb::DynamicValueType m_use_dynamic;
115 };
116 
SBVariablesOptions()117 SBVariablesOptions::SBVariablesOptions () :
118 m_opaque_ap(new VariablesOptionsImpl())
119 {
120 }
121 
SBVariablesOptions(const SBVariablesOptions & options)122 SBVariablesOptions::SBVariablesOptions (const SBVariablesOptions& options) :
123 m_opaque_ap(new VariablesOptionsImpl(options.ref()))
124 {
125 }
126 
127 SBVariablesOptions&
operator =(const SBVariablesOptions & options)128 SBVariablesOptions::operator = (const SBVariablesOptions& options)
129 {
130     m_opaque_ap.reset(new VariablesOptionsImpl(options.ref()));
131     return *this;
132 }
133 
134 SBVariablesOptions::~SBVariablesOptions () = default;
135 
136 bool
IsValid() const137 SBVariablesOptions::IsValid () const
138 {
139     return m_opaque_ap.get() != nullptr;
140 }
141 
142 bool
GetIncludeArguments() const143 SBVariablesOptions::GetIncludeArguments () const
144 {
145     return m_opaque_ap->GetIncludeArguments();
146 }
147 
148 void
SetIncludeArguments(bool arguments)149 SBVariablesOptions::SetIncludeArguments (bool arguments)
150 {
151     m_opaque_ap->SetIncludeArguments(arguments);
152 }
153 
154 bool
GetIncludeLocals() const155 SBVariablesOptions::GetIncludeLocals () const
156 {
157     return m_opaque_ap->GetIncludeLocals();
158 }
159 
160 void
SetIncludeLocals(bool locals)161 SBVariablesOptions::SetIncludeLocals (bool locals)
162 {
163     m_opaque_ap->SetIncludeLocals(locals);
164 }
165 
166 bool
GetIncludeStatics() const167 SBVariablesOptions::GetIncludeStatics () const
168 {
169     return m_opaque_ap->GetIncludeStatics();
170 }
171 
172 void
SetIncludeStatics(bool statics)173 SBVariablesOptions::SetIncludeStatics (bool statics)
174 {
175     m_opaque_ap->SetIncludeStatics(statics);
176 }
177 
178 bool
GetInScopeOnly() const179 SBVariablesOptions::GetInScopeOnly () const
180 {
181     return m_opaque_ap->GetInScopeOnly();
182 }
183 
184 void
SetInScopeOnly(bool in_scope_only)185 SBVariablesOptions::SetInScopeOnly (bool in_scope_only)
186 {
187     m_opaque_ap->SetInScopeOnly(in_scope_only);
188 }
189 
190 bool
GetIncludeRuntimeSupportValues() const191 SBVariablesOptions::GetIncludeRuntimeSupportValues () const
192 {
193     return m_opaque_ap->GetIncludeRuntimeSupportValues();
194 }
195 
196 void
SetIncludeRuntimeSupportValues(bool runtime_support_values)197 SBVariablesOptions::SetIncludeRuntimeSupportValues (bool runtime_support_values)
198 {
199     m_opaque_ap->SetIncludeRuntimeSupportValues(runtime_support_values);
200 }
201 
202 lldb::DynamicValueType
GetUseDynamic() const203 SBVariablesOptions::GetUseDynamic () const
204 {
205     return m_opaque_ap->GetUseDynamic();
206 }
207 
208 void
SetUseDynamic(lldb::DynamicValueType dynamic)209 SBVariablesOptions::SetUseDynamic (lldb::DynamicValueType dynamic)
210 {
211     m_opaque_ap->SetUseDynamic(dynamic);
212 }
213 
214 VariablesOptionsImpl *
operator ->()215 SBVariablesOptions::operator->()
216 {
217     return m_opaque_ap.operator->();
218 }
219 
220 const VariablesOptionsImpl *
operator ->() const221 SBVariablesOptions::operator->() const
222 {
223     return m_opaque_ap.operator->();
224 }
225 
226 VariablesOptionsImpl *
get()227 SBVariablesOptions::get ()
228 {
229     return m_opaque_ap.get();
230 }
231 
232 VariablesOptionsImpl &
ref()233 SBVariablesOptions::ref()
234 {
235     return *m_opaque_ap;
236 }
237 
238 const VariablesOptionsImpl &
ref() const239 SBVariablesOptions::ref() const
240 {
241     return *m_opaque_ap;
242 }
243 
SBVariablesOptions(VariablesOptionsImpl * lldb_object_ptr)244 SBVariablesOptions::SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr) :
245 m_opaque_ap(std::move(lldb_object_ptr))
246 {
247 }
248 
249 void
SetOptions(VariablesOptionsImpl * lldb_object_ptr)250 SBVariablesOptions::SetOptions (VariablesOptionsImpl *lldb_object_ptr)
251 {
252     m_opaque_ap.reset(std::move(lldb_object_ptr));
253 }
254 
255