1 //===-- SBSourceManager.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 11 #include "lldb/API/SBSourceManager.h" 12 #include "lldb/API/SBStream.h" 13 14 #include "lldb/API/SBFileSpec.h" 15 #include "lldb/Core/Stream.h" 16 #include "lldb/Core/StreamFile.h" 17 #include "lldb/Core/SourceManager.h" 18 19 20 using namespace lldb; 21 using namespace lldb_private; 22 23 24 SBSourceManager::SBSourceManager (SourceManager* source_manager) : 25 m_opaque_ptr (source_manager) 26 { 27 } 28 29 SBSourceManager::~SBSourceManager() 30 { 31 } 32 33 SBSourceManager::SBSourceManager(const SBSourceManager &rhs) : 34 m_opaque_ptr (rhs.m_opaque_ptr) 35 { 36 } 37 38 const SBSourceManager & 39 SBSourceManager::operator = (const SBSourceManager &rhs) 40 { 41 m_opaque_ptr = rhs.m_opaque_ptr; 42 return *this; 43 } 44 45 size_t 46 SBSourceManager::DisplaySourceLinesWithLineNumbers 47 ( 48 const SBFileSpec &file, 49 uint32_t line, 50 uint32_t context_before, 51 uint32_t context_after, 52 const char* current_line_cstr, 53 SBStream &s 54 ) 55 { 56 if (m_opaque_ptr == NULL) 57 return 0; 58 59 if (s.m_opaque_ap.get() == NULL) 60 return 0; 61 62 if (file.IsValid()) 63 { 64 return m_opaque_ptr->DisplaySourceLinesWithLineNumbers (*file, 65 line, 66 context_before, 67 context_after, 68 current_line_cstr, 69 s.m_opaque_ap.get()); 70 } 71 return 0; 72 } 73