2012-02-21 18:22:37 +00:00
|
|
|
//===-- StreamCallback.cpp -------------------------------------*- C++ -*-===//
|
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-02-21 18:22:37 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2017-03-06 18:34:25 +00:00
|
|
|
#include "lldb/Utility/StreamCallback.h"
|
2012-02-21 18:22:37 +00:00
|
|
|
|
2017-04-06 18:12:24 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2012-02-21 18:22:37 +00:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
2016-05-18 01:59:10 +00:00
|
|
|
StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
|
2017-02-10 11:49:21 +00:00
|
|
|
: llvm::raw_ostream(true), m_callback(callback), m_baton(baton) {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2017-02-10 11:49:21 +00:00
|
|
|
void StreamCallback::write_impl(const char *Ptr, size_t Size) {
|
|
|
|
|
m_callback(std::string(Ptr, Size).c_str(), m_baton);
|
2012-02-21 18:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
2017-02-10 11:49:21 +00:00
|
|
|
uint64_t StreamCallback::current_pos() const { return 0; }
|