LLDB mainline
ValueObjectList.cpp
Go to the documentation of this file.
1//===-- ValueObjectList.cpp -----------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
13
14#include <utility>
15
16using namespace lldb;
17using namespace lldb_private;
18
20 if (this != &rhs)
22 return *this;
23}
24
25void ValueObjectList::Append(const ValueObjectSP &val_obj_sp) {
26 m_value_objects.push_back(val_obj_sp);
27}
28
29void ValueObjectList::Append(const ValueObjectList &valobj_list) {
30 std::copy(valobj_list.m_value_objects.begin(), // source begin
31 valobj_list.m_value_objects.end(), // source end
32 back_inserter(m_value_objects)); // destination
33}
34
35size_t ValueObjectList::GetSize() const { return m_value_objects.size(); }
36
37void ValueObjectList::Resize(size_t size) { m_value_objects.resize(size); }
38
40 lldb::ValueObjectSP valobj_sp;
41 if (idx < m_value_objects.size())
42 valobj_sp = m_value_objects[idx];
43 return valobj_sp;
44}
45
47 lldb::ValueObjectSP valobj_sp;
48 if (idx < m_value_objects.size()) {
49 valobj_sp = m_value_objects[idx];
50 m_value_objects.erase(m_value_objects.begin() + idx);
51 }
52 return valobj_sp;
53}
54
56 const ValueObjectSP &valobj_sp) {
57 if (idx >= m_value_objects.size())
58 m_value_objects.resize(idx + 1);
59 m_value_objects[idx] = valobj_sp;
60}
61
63 ConstString name_const_str(name);
64 ValueObjectSP val_obj_sp;
65 collection::iterator pos, end = m_value_objects.end();
66 for (pos = m_value_objects.begin(); pos != end; ++pos) {
67 ValueObject *valobj = (*pos).get();
68 if (valobj && valobj->GetName() == name_const_str) {
69 val_obj_sp = *pos;
70 break;
71 }
72 }
73 return val_obj_sp;
74}
75
77 ValueObjectSP valobj_sp;
78 collection::iterator pos, end = m_value_objects.end();
79
80 for (pos = m_value_objects.begin(); pos != end; ++pos) {
81 // Watch out for NULL objects in our list as the list might get resized to
82 // a specific size and lazily filled in
83 ValueObject *valobj = (*pos).get();
84 if (valobj && valobj->GetID() == uid) {
85 valobj_sp = *pos;
86 break;
87 }
88 }
89 return valobj_sp;
90}
91
94 ValueObjectSP valobj_sp;
95 collection::iterator pos, end = m_value_objects.end();
96
97 for (pos = m_value_objects.begin(); pos != end; ++pos) {
98 ValueObject *valobj = (*pos).get();
99 if (valobj && valobj == find_valobj) {
100 valobj_sp = *pos;
101 break;
102 }
103 }
104 return valobj_sp;
105}
106
107void ValueObjectList::Swap(ValueObjectList &value_object_list) {
108 m_value_objects.swap(value_object_list.m_value_objects);
109}
A uniqued constant string class.
Definition: ConstString.h:40
A collection of ValueObject values that.
void SetValueObjectAtIndex(size_t idx, const lldb::ValueObjectSP &valobj_sp)
void Append(const lldb::ValueObjectSP &val_obj_sp)
const ValueObjectList & operator=(const ValueObjectList &rhs)
lldb::ValueObjectSP FindValueObjectByValueName(const char *name)
lldb::ValueObjectSP GetValueObjectAtIndex(size_t idx)
lldb::ValueObjectSP FindValueObjectByPointer(ValueObject *valobj)
lldb::ValueObjectSP RemoveValueObjectAtIndex(size_t idx)
lldb::ValueObjectSP FindValueObjectByUID(lldb::user_id_t uid)
void Swap(ValueObjectList &value_object_list)
lldb::user_id_t GetID() const
Returns a unique id for this ValueObject.
Definition: ValueObject.h:490
ConstString GetName() const
Definition: ValueObject.h:487
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:480
uint64_t user_id_t
Definition: lldb-types.h:82