1 //===-- StreamBuffer.h ------------------------------------------*- 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 #ifndef liblldb_StreamBuffer_h_
11 #define liblldb_StreamBuffer_h_
15 #include "llvm/ADT/SmallVector.h"
16 #include "lldb/Core/Stream.h"
18 namespace lldb_private {
21 class StreamBuffer : public Stream
25 Stream (0, 4, lldb::eByteOrderBig),
31 StreamBuffer (uint32_t flags,
33 lldb::ByteOrder byte_order) :
34 Stream (flags, addr_size, byte_order),
47 // Nothing to do when flushing a buffer based stream...
51 Write (const void *s, size_t length)
54 m_packet.append ((const char *)s, ((const char *)s) + length);
64 // Beware, this might not be NULL terminated as you can expect from
65 // StringString as there may be random bits in the llvm::SmallVector. If
66 // you are using this class to create a C string, be sure the call PutChar ('\0')
67 // after you have created your string, or use StreamString.
71 return m_packet.data();
77 return m_packet.size();
81 llvm::SmallVector<char, N> m_packet;
85 } // namespace lldb_private
87 #endif // #ifndef liblldb_StreamBuffer_h_