blob: ca6c80ca99942b7423df6c3d66378d9b267a8a54 [file] [log] [blame]
Greg Clayton466f6c42010-09-10 18:31:35 +00001//===-- 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
13using namespace lldb;
14using namespace lldb_private;
15
16SBSymbolContextList::SBSymbolContextList () :
Greg Clayton4ed315f2011-06-21 01:34:41 +000017 m_opaque_ap (new SymbolContextList())
Greg Clayton466f6c42010-09-10 18:31:35 +000018{
19}
20
21SBSymbolContextList::SBSymbolContextList (const SBSymbolContextList& rhs) :
Greg Clayton4ed315f2011-06-21 01:34:41 +000022 m_opaque_ap (new SymbolContextList(*rhs.m_opaque_ap))
Greg Clayton466f6c42010-09-10 18:31:35 +000023{
Greg Clayton466f6c42010-09-10 18:31:35 +000024}
25
26SBSymbolContextList::~SBSymbolContextList ()
27{
28}
29
30const SBSymbolContextList &
31SBSymbolContextList::operator = (const SBSymbolContextList &rhs)
32{
33 if (this != &rhs)
34 {
Greg Clayton4ed315f2011-06-21 01:34:41 +000035 *m_opaque_ap = *rhs.m_opaque_ap;
Greg Clayton466f6c42010-09-10 18:31:35 +000036 }
37 return *this;
38}
39
40uint32_t
41SBSymbolContextList::GetSize() const
42{
43 if (m_opaque_ap.get())
44 return m_opaque_ap->GetSize();
45 return 0;
46}
47
48SBSymbolContext
49SBSymbolContextList::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 Clayton4ed315f2011-06-21 01:34:41 +000063void
64SBSymbolContextList::Clear()
65{
66 if (m_opaque_ap.get())
67 m_opaque_ap->Clear();
68}
69
Greg Clayton466f6c42010-09-10 18:31:35 +000070
71bool
72SBSymbolContextList::IsValid () const
73{
74 return m_opaque_ap.get() != NULL;
75}
76
77
78
79lldb_private::SymbolContextList*
80SBSymbolContextList::operator->() const
81{
82 return m_opaque_ap.get();
83}
84
85
86lldb_private::SymbolContextList&
87SBSymbolContextList::operator*() const
88{
89 assert (m_opaque_ap.get());
90 return *m_opaque_ap.get();
91}
92
93
94
95