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