Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame^] | 1 | //===-- SBModule.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/SBModule.h" |
| 11 | #include "lldb/API/SBFileSpec.h" |
| 12 | #include "lldb/Core/Module.h" |
| 13 | |
| 14 | using namespace lldb; |
| 15 | |
| 16 | |
| 17 | SBModule::SBModule () : |
| 18 | m_lldb_object_sp () |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | SBModule::SBModule (const lldb::ModuleSP& module_sp) : |
| 23 | m_lldb_object_sp (module_sp) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | SBModule::~SBModule () |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | bool |
| 32 | SBModule::IsValid () const |
| 33 | { |
| 34 | return m_lldb_object_sp.get() != NULL; |
| 35 | } |
| 36 | |
| 37 | SBFileSpec |
| 38 | SBModule::GetFileSpec () const |
| 39 | { |
| 40 | SBFileSpec file_spec; |
| 41 | if (m_lldb_object_sp) |
| 42 | file_spec.SetFileSpec(m_lldb_object_sp->GetFileSpec()); |
| 43 | return file_spec; |
| 44 | } |
| 45 | |
| 46 | const uint8_t * |
| 47 | SBModule::GetUUIDBytes () const |
| 48 | { |
| 49 | if (m_lldb_object_sp) |
| 50 | return (const uint8_t *)m_lldb_object_sp->GetUUID().GetBytes(); |
| 51 | return NULL; |
| 52 | } |
| 53 | |
| 54 | |
| 55 | bool |
| 56 | SBModule::operator == (const SBModule &rhs) const |
| 57 | { |
| 58 | if (m_lldb_object_sp) |
| 59 | return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get(); |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | bool |
| 64 | SBModule::operator != (const SBModule &rhs) const |
| 65 | { |
| 66 | if (m_lldb_object_sp) |
| 67 | return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get(); |
| 68 | return false; |
| 69 | } |
| 70 | |
| 71 | lldb::ModuleSP & |
| 72 | SBModule::operator *() |
| 73 | { |
| 74 | return m_lldb_object_sp; |
| 75 | } |
| 76 | |
| 77 | lldb_private::Module * |
| 78 | SBModule::operator ->() |
| 79 | { |
| 80 | return m_lldb_object_sp.get(); |
| 81 | } |
| 82 | |
| 83 | const lldb_private::Module * |
| 84 | SBModule::operator ->() const |
| 85 | { |
| 86 | return m_lldb_object_sp.get(); |
| 87 | } |
| 88 | |
| 89 | lldb_private::Module * |
| 90 | SBModule::get() |
| 91 | { |
| 92 | return m_lldb_object_sp.get(); |
| 93 | } |
| 94 | |
| 95 | const lldb_private::Module * |
| 96 | SBModule::get() const |
| 97 | { |
| 98 | return m_lldb_object_sp.get(); |
| 99 | } |
| 100 | |
| 101 | |
| 102 | void |
| 103 | SBModule::SetModule (const lldb::ModuleSP& module_sp) |
| 104 | { |
| 105 | m_lldb_object_sp = module_sp; |
| 106 | } |
| 107 | |