Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1 | //===-- SBVariablesOptions.cpp --------------------------------------*- C++ |
| 2 | //-*-===// |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 11 | #include "lldb/API/SBVariablesOptions.h" |
| 12 | |
| 13 | using namespace lldb; |
| 14 | using namespace lldb_private; |
| 15 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 16 | class VariablesOptionsImpl { |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 17 | public: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 18 | VariablesOptionsImpl() |
| 19 | : m_include_arguments(false), m_include_locals(false), |
| 20 | m_include_statics(false), m_in_scope_only(false), |
| 21 | m_include_runtime_support_values(false), |
| 22 | m_use_dynamic(lldb::eNoDynamicValues) {} |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 23 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 24 | VariablesOptionsImpl(const VariablesOptionsImpl &) = default; |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 25 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 26 | ~VariablesOptionsImpl() = default; |
| 27 | |
| 28 | VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default; |
| 29 | |
| 30 | bool GetIncludeArguments() const { return m_include_arguments; } |
| 31 | |
| 32 | void SetIncludeArguments(bool b) { m_include_arguments = b; } |
| 33 | |
| 34 | bool GetIncludeLocals() const { return m_include_locals; } |
| 35 | |
| 36 | void SetIncludeLocals(bool b) { m_include_locals = b; } |
| 37 | |
| 38 | bool GetIncludeStatics() const { return m_include_statics; } |
| 39 | |
| 40 | void SetIncludeStatics(bool b) { m_include_statics = b; } |
| 41 | |
| 42 | bool GetInScopeOnly() const { return m_in_scope_only; } |
| 43 | |
| 44 | void SetInScopeOnly(bool b) { m_in_scope_only = b; } |
| 45 | |
| 46 | bool GetIncludeRuntimeSupportValues() const { |
| 47 | return m_include_runtime_support_values; |
| 48 | } |
| 49 | |
| 50 | void SetIncludeRuntimeSupportValues(bool b) { |
| 51 | m_include_runtime_support_values = b; |
| 52 | } |
| 53 | |
| 54 | lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; } |
| 55 | |
| 56 | void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; } |
| 57 | |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 58 | private: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 59 | bool m_include_arguments : 1; |
| 60 | bool m_include_locals : 1; |
| 61 | bool m_include_statics : 1; |
| 62 | bool m_in_scope_only : 1; |
| 63 | bool m_include_runtime_support_values : 1; |
| 64 | lldb::DynamicValueType m_use_dynamic; |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 67 | SBVariablesOptions::SBVariablesOptions() |
| 68 | : m_opaque_ap(new VariablesOptionsImpl()) {} |
| 69 | |
| 70 | SBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options) |
| 71 | : m_opaque_ap(new VariablesOptionsImpl(options.ref())) {} |
| 72 | |
| 73 | SBVariablesOptions &SBVariablesOptions:: |
| 74 | operator=(const SBVariablesOptions &options) { |
| 75 | m_opaque_ap.reset(new VariablesOptionsImpl(options.ref())); |
| 76 | return *this; |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 79 | SBVariablesOptions::~SBVariablesOptions() = default; |
| 80 | |
| 81 | bool SBVariablesOptions::IsValid() const { |
| 82 | return m_opaque_ap.get() != nullptr; |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 85 | bool SBVariablesOptions::GetIncludeArguments() const { |
| 86 | return m_opaque_ap->GetIncludeArguments(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 87 | } |
| 88 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 89 | void SBVariablesOptions::SetIncludeArguments(bool arguments) { |
| 90 | m_opaque_ap->SetIncludeArguments(arguments); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 91 | } |
| 92 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 93 | bool SBVariablesOptions::GetIncludeLocals() const { |
| 94 | return m_opaque_ap->GetIncludeLocals(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 95 | } |
| 96 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 97 | void SBVariablesOptions::SetIncludeLocals(bool locals) { |
| 98 | m_opaque_ap->SetIncludeLocals(locals); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 99 | } |
| 100 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 101 | bool SBVariablesOptions::GetIncludeStatics() const { |
| 102 | return m_opaque_ap->GetIncludeStatics(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 103 | } |
| 104 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 105 | void SBVariablesOptions::SetIncludeStatics(bool statics) { |
| 106 | m_opaque_ap->SetIncludeStatics(statics); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 107 | } |
| 108 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 109 | bool SBVariablesOptions::GetInScopeOnly() const { |
| 110 | return m_opaque_ap->GetInScopeOnly(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 111 | } |
| 112 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 113 | void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) { |
| 114 | m_opaque_ap->SetInScopeOnly(in_scope_only); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 115 | } |
| 116 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 117 | bool SBVariablesOptions::GetIncludeRuntimeSupportValues() const { |
| 118 | return m_opaque_ap->GetIncludeRuntimeSupportValues(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 119 | } |
| 120 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 121 | void SBVariablesOptions::SetIncludeRuntimeSupportValues( |
| 122 | bool runtime_support_values) { |
| 123 | m_opaque_ap->SetIncludeRuntimeSupportValues(runtime_support_values); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 124 | } |
| 125 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 126 | lldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const { |
| 127 | return m_opaque_ap->GetUseDynamic(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 128 | } |
| 129 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 130 | void SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) { |
| 131 | m_opaque_ap->SetUseDynamic(dynamic); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 132 | } |
| 133 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 134 | VariablesOptionsImpl *SBVariablesOptions::operator->() { |
| 135 | return m_opaque_ap.operator->(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 136 | } |
| 137 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 138 | const VariablesOptionsImpl *SBVariablesOptions::operator->() const { |
| 139 | return m_opaque_ap.operator->(); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 142 | VariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_ap.get(); } |
| 143 | |
| 144 | VariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_ap; } |
| 145 | |
| 146 | const VariablesOptionsImpl &SBVariablesOptions::ref() const { |
| 147 | return *m_opaque_ap; |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 148 | } |
| 149 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 150 | SBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr) |
| 151 | : m_opaque_ap(std::move(lldb_object_ptr)) {} |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 152 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 153 | void SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) { |
| 154 | m_opaque_ap.reset(std::move(lldb_object_ptr)); |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 155 | } |