2012-02-22 02:22:37 +08:00
|
|
|
//===-- StreamCallback.cpp -------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-03-07 02:34:25 +08:00
|
|
|
#include "lldb/Utility/StreamCallback.h"
|
2012-02-22 02:22:37 +08:00
|
|
|
|
2017-04-07 02:12:24 +08:00
|
|
|
#include <string>
|
|
|
|
|
2012-02-22 02:22:37 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-05-18 09:59:10 +08:00
|
|
|
StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
|
2017-02-10 19:49:21 +08:00
|
|
|
: llvm::raw_ostream(true), m_callback(callback), m_baton(baton) {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-02-10 19:49:21 +08:00
|
|
|
void StreamCallback::write_impl(const char *Ptr, size_t Size) {
|
|
|
|
m_callback(std::string(Ptr, Size).c_str(), m_baton);
|
2012-02-22 02:22:37 +08:00
|
|
|
}
|
|
|
|
|
2017-02-10 19:49:21 +08:00
|
|
|
uint64_t StreamCallback::current_pos() const { return 0; }
|