Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 1 | //===-- SBSymbolContextList.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/API/SBSymbolContextList.h" |
| 11 | #include "lldb/Symbol/SymbolContext.h" |
| 12 | |
| 13 | using namespace lldb; |
| 14 | using namespace lldb_private; |
| 15 | |
| 16 | SBSymbolContextList::SBSymbolContextList () : |
Greg Clayton | 4ed315f | 2011-06-21 01:34:41 +0000 | [diff] [blame] | 17 | m_opaque_ap (new SymbolContextList()) |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 18 | { |
| 19 | } |
| 20 | |
| 21 | SBSymbolContextList::SBSymbolContextList (const SBSymbolContextList& rhs) : |
Greg Clayton | 4ed315f | 2011-06-21 01:34:41 +0000 | [diff] [blame] | 22 | m_opaque_ap (new SymbolContextList(*rhs.m_opaque_ap)) |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 23 | { |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | SBSymbolContextList::~SBSymbolContextList () |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | const SBSymbolContextList & |
| 31 | SBSymbolContextList::operator = (const SBSymbolContextList &rhs) |
| 32 | { |
| 33 | if (this != &rhs) |
| 34 | { |
Greg Clayton | 4ed315f | 2011-06-21 01:34:41 +0000 | [diff] [blame] | 35 | *m_opaque_ap = *rhs.m_opaque_ap; |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 36 | } |
| 37 | return *this; |
| 38 | } |
| 39 | |
| 40 | uint32_t |
| 41 | SBSymbolContextList::GetSize() const |
| 42 | { |
| 43 | if (m_opaque_ap.get()) |
| 44 | return m_opaque_ap->GetSize(); |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | SBSymbolContext |
| 49 | SBSymbolContextList::GetContextAtIndex (uint32_t idx) |
| 50 | { |
| 51 | SBSymbolContext sb_sc; |
| 52 | if (m_opaque_ap.get()) |
| 53 | { |
| 54 | SymbolContext sc; |
| 55 | if (m_opaque_ap->GetContextAtIndex (idx, sc)) |
| 56 | { |
| 57 | sb_sc.SetSymbolContext(&sc); |
| 58 | } |
| 59 | } |
| 60 | return sb_sc; |
| 61 | } |
| 62 | |
Greg Clayton | 4ed315f | 2011-06-21 01:34:41 +0000 | [diff] [blame] | 63 | void |
| 64 | SBSymbolContextList::Clear() |
| 65 | { |
| 66 | if (m_opaque_ap.get()) |
| 67 | m_opaque_ap->Clear(); |
| 68 | } |
| 69 | |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 70 | |
| 71 | bool |
| 72 | SBSymbolContextList::IsValid () const |
| 73 | { |
| 74 | return m_opaque_ap.get() != NULL; |
| 75 | } |
| 76 | |
| 77 | |
| 78 | |
| 79 | lldb_private::SymbolContextList* |
| 80 | SBSymbolContextList::operator->() const |
| 81 | { |
| 82 | return m_opaque_ap.get(); |
| 83 | } |
| 84 | |
| 85 | |
| 86 | lldb_private::SymbolContextList& |
| 87 | SBSymbolContextList::operator*() const |
| 88 | { |
| 89 | assert (m_opaque_ap.get()); |
| 90 | return *m_opaque_ap.get(); |
| 91 | } |
| 92 | |
| 93 | |
| 94 | |
| 95 | |