1 //===-- StreamCallback.cpp ------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "lldb/Utility/StreamCallback.h" 10 11 #include <string> 12 13 using namespace lldb_private; 14 StreamCallback(lldb::LogOutputCallback callback,void * baton)15StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton) 16 : llvm::raw_ostream(true), m_callback(callback), m_baton(baton) {} 17 write_impl(const char * Ptr,size_t Size)18void StreamCallback::write_impl(const char *Ptr, size_t Size) { 19 m_callback(std::string(Ptr, Size).c_str(), m_baton); 20 } 21 current_pos() const22uint64_t StreamCallback::current_pos() const { return 0; } 23