1 //===-- StreamCallback.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/Utility/StreamCallback.h" 11 12 #include <string> 13 14 using namespace lldb_private; 15 16 StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton) 17 : llvm::raw_ostream(true), m_callback(callback), m_baton(baton) {} 18 19 void StreamCallback::write_impl(const char *Ptr, size_t Size) { 20 m_callback(std::string(Ptr, Size).c_str(), m_baton); 21 } 22 23 uint64_t StreamCallback::current_pos() const { return 0; } 24