blob: 0730096c5f3c38935005c953e662a5aabaad5366 [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"
Greg Clayton7dd5c512012-02-06 01:44:54 +000011#include "lldb/API/SBStream.h"
Greg Clayton466f6c42010-09-10 18:31:35 +000012#include "lldb/Symbol/SymbolContext.h"
13
14using namespace lldb;
15using namespace lldb_private;
16
17SBSymbolContextList::SBSymbolContextList () :
Greg Clayton4ed315f2011-06-21 01:34:41 +000018 m_opaque_ap (new SymbolContextList())
Greg Clayton466f6c42010-09-10 18:31:35 +000019{
20}
21
22SBSymbolContextList::SBSymbolContextList (const SBSymbolContextList& rhs) :
Greg Clayton4ed315f2011-06-21 01:34:41 +000023 m_opaque_ap (new SymbolContextList(*rhs.m_opaque_ap))
Greg Clayton466f6c42010-09-10 18:31:35 +000024{
Greg Clayton466f6c42010-09-10 18:31:35 +000025}
26
27SBSymbolContextList::~SBSymbolContextList ()
28{
29}
30
31const SBSymbolContextList &
32SBSymbolContextList::operator = (const SBSymbolContextList &rhs)
33{
34 if (this != &rhs)
35 {
Greg Clayton4ed315f2011-06-21 01:34:41 +000036 *m_opaque_ap = *rhs.m_opaque_ap;
Greg Clayton466f6c42010-09-10 18:31:35 +000037 }
38 return *this;
39}
40
41uint32_t
42SBSymbolContextList::GetSize() const
43{
44 if (m_opaque_ap.get())
45 return m_opaque_ap->GetSize();
46 return 0;
47}
48
49SBSymbolContext
50SBSymbolContextList::GetContextAtIndex (uint32_t idx)
51{
52 SBSymbolContext sb_sc;
53 if (m_opaque_ap.get())
54 {
55 SymbolContext sc;
56 if (m_opaque_ap->GetContextAtIndex (idx, sc))
57 {
58 sb_sc.SetSymbolContext(&sc);
59 }
60 }
61 return sb_sc;
62}
63
Greg Clayton4ed315f2011-06-21 01:34:41 +000064void
65SBSymbolContextList::Clear()
66{
67 if (m_opaque_ap.get())
68 m_opaque_ap->Clear();
69}
70
Greg Clayton7dd5c512012-02-06 01:44:54 +000071void
72SBSymbolContextList::Append(SBSymbolContext &sc)
73{
74 if (sc.IsValid() && m_opaque_ap.get())
75 m_opaque_ap->Append(*sc);
76}
77
78void
79SBSymbolContextList::Append(SBSymbolContextList &sc_list)
80{
81 if (sc_list.IsValid() && m_opaque_ap.get())
82 m_opaque_ap->Append(*sc_list);
83}
84
Greg Clayton466f6c42010-09-10 18:31:35 +000085
86bool
87SBSymbolContextList::IsValid () const
88{
89 return m_opaque_ap.get() != NULL;
90}
91
92
93
94lldb_private::SymbolContextList*
95SBSymbolContextList::operator->() const
96{
97 return m_opaque_ap.get();
98}
99
100
101lldb_private::SymbolContextList&
102SBSymbolContextList::operator*() const
103{
104 assert (m_opaque_ap.get());
105 return *m_opaque_ap.get();
106}
107
Greg Clayton7dd5c512012-02-06 01:44:54 +0000108bool
109SBSymbolContextList::GetDescription (lldb::SBStream &description)
110{
111 Stream &strm = description.ref();
112 if (m_opaque_ap.get())
113 m_opaque_ap->GetDescription (&strm, lldb::eDescriptionLevelFull, NULL);
114 return true;
115}
Greg Clayton466f6c42010-09-10 18:31:35 +0000116
117