ValueObjectList.cpp revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
1//===-- ValueObjectList.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#include "lldb/Core/ValueObjectList.h" 11 12// C Includes 13// C++ Includes 14// Other libraries and framework includes 15// Project includes 16#include "lldb/Core/ValueObjectChild.h" 17#include "lldb/Core/ValueObjectRegister.h" 18#include "lldb/Core/ValueObjectVariable.h" 19#include "lldb/Target/ExecutionContext.h" 20#include "lldb/Target/Process.h" 21 22using namespace lldb; 23using namespace lldb_private; 24 25ValueObjectList::ValueObjectList () : 26 m_value_objects() 27{ 28} 29 30ValueObjectList::ValueObjectList (const ValueObjectList &rhs) : 31 m_value_objects(rhs.m_value_objects) 32{ 33} 34 35 36ValueObjectList::~ValueObjectList () 37{ 38} 39 40const ValueObjectList & 41ValueObjectList::operator = (const ValueObjectList &rhs) 42{ 43 if (this != &rhs) 44 m_value_objects = rhs.m_value_objects; 45 return *this; 46} 47 48void 49ValueObjectList::Append (const ValueObjectSP &val_obj_sp) 50{ 51 m_value_objects.push_back(val_obj_sp); 52} 53 54uint32_t 55ValueObjectList::GetSize() const 56{ 57 return m_value_objects.size(); 58} 59 60lldb::ValueObjectSP 61ValueObjectList::GetValueObjectAtIndex (uint32_t idx) 62{ 63 lldb::ValueObjectSP valobj_sp; 64 if (idx < m_value_objects.size()) 65 valobj_sp = m_value_objects[idx]; 66 return valobj_sp; 67} 68 69ValueObjectSP 70ValueObjectList::FindValueObjectByValueName (const char *name) 71{ 72 ConstString name_const_str(name); 73 ValueObjectSP val_obj_sp; 74 collection::iterator pos, end = m_value_objects.end(); 75 for (pos = m_value_objects.begin(); pos != end; ++pos) 76 { 77 if ((*pos)->GetName() == name_const_str) 78 { 79 val_obj_sp = *pos; 80 break; 81 } 82 } 83 return val_obj_sp; 84} 85 86ValueObjectSP 87ValueObjectList::FindValueObjectByUID (lldb::user_id_t uid) 88{ 89 ValueObjectSP valobj_sp; 90 collection::iterator pos, end = m_value_objects.end(); 91 92 for (pos = m_value_objects.begin(); pos != end; ++pos) 93 { 94 if ((*pos)->GetID() == uid) 95 { 96 valobj_sp = *pos; 97 break; 98 } 99 } 100 return valobj_sp; 101} 102 103 104ValueObjectSP 105ValueObjectList::FindValueObjectByPointer (ValueObject *valobj) 106{ 107 ValueObjectSP valobj_sp; 108 collection::iterator pos, end = m_value_objects.end(); 109 110 for (pos = m_value_objects.begin(); pos != end; ++pos) 111 { 112 if ((*pos).get() == valobj) 113 { 114 valobj_sp = *pos; 115 break; 116 } 117 } 118 return valobj_sp; 119} 120