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 () : |
| 17 | m_opaque_ap () |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | SBSymbolContextList::SBSymbolContextList (const SBSymbolContextList& rhs) : |
| 22 | m_opaque_ap () |
| 23 | { |
| 24 | if (rhs.IsValid()) |
| 25 | *m_opaque_ap = *rhs.m_opaque_ap; |
| 26 | } |
| 27 | |
| 28 | SBSymbolContextList::~SBSymbolContextList () |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | const SBSymbolContextList & |
| 33 | SBSymbolContextList::operator = (const SBSymbolContextList &rhs) |
| 34 | { |
| 35 | if (this != &rhs) |
| 36 | { |
| 37 | if (rhs.IsValid()) |
| 38 | m_opaque_ap.reset (new lldb_private::SymbolContextList(*rhs.m_opaque_ap.get())); |
| 39 | } |
| 40 | return *this; |
| 41 | } |
| 42 | |
| 43 | uint32_t |
| 44 | SBSymbolContextList::GetSize() const |
| 45 | { |
| 46 | if (m_opaque_ap.get()) |
| 47 | return m_opaque_ap->GetSize(); |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | SBSymbolContext |
| 52 | SBSymbolContextList::GetContextAtIndex (uint32_t idx) |
| 53 | { |
| 54 | SBSymbolContext sb_sc; |
| 55 | if (m_opaque_ap.get()) |
| 56 | { |
| 57 | SymbolContext sc; |
| 58 | if (m_opaque_ap->GetContextAtIndex (idx, sc)) |
| 59 | { |
| 60 | sb_sc.SetSymbolContext(&sc); |
| 61 | } |
| 62 | } |
| 63 | return sb_sc; |
| 64 | } |
| 65 | |
| 66 | |
| 67 | bool |
| 68 | SBSymbolContextList::IsValid () const |
| 69 | { |
| 70 | return m_opaque_ap.get() != NULL; |
| 71 | } |
| 72 | |
| 73 | |
| 74 | |
| 75 | lldb_private::SymbolContextList* |
| 76 | SBSymbolContextList::operator->() const |
| 77 | { |
| 78 | return m_opaque_ap.get(); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | lldb_private::SymbolContextList& |
| 83 | SBSymbolContextList::operator*() const |
| 84 | { |
| 85 | assert (m_opaque_ap.get()); |
| 86 | return *m_opaque_ap.get(); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | |
| 91 | |