1 //===-- StreamBroadcast.cpp -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Core/StreamAsynchronousIO.h"
12 #include "lldb/lldb-private.h"
13 #include "lldb/Core/Debugger.h"
16 using namespace lldb_private;
19 StreamAsynchronousIO::StreamAsynchronousIO (Debugger &debugger, bool for_stdout) :
20 Stream (0, 4, eByteOrderBig),
21 m_debugger (debugger),
23 m_for_stdout (for_stdout)
27 StreamAsynchronousIO::~StreamAsynchronousIO ()
29 // Flush when we destroy to make sure we display the data
34 StreamAsynchronousIO::Flush ()
38 m_debugger.PrintAsync (m_data.data(), m_data.size(), m_for_stdout);
39 m_data = std::move(std::string());
44 StreamAsynchronousIO::Write (const void *s, size_t length)
46 m_data.append ((const char *)s, length);