LLDB mainline
StreamString.h
Go to the documentation of this file.
1//===-- StreamString.h ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_UTILITY_STREAMSTRING_H
10#define LLDB_UTILITY_STREAMSTRING_H
11
12#include "lldb/Utility/Stream.h"
14#include "llvm/ADT/StringRef.h"
15
16#include <string>
17
18#include <cstddef>
19#include <cstdint>
20
21namespace lldb_private {
22
23class ScriptInterpreter;
24
25class StreamString : public Stream {
26public:
27 StreamString(bool colors = false);
28
29 StreamString(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
30
31 ~StreamString() override;
32
33 void Flush() override;
34
35 void Clear();
36
37 bool Empty() const;
38
39 size_t GetSize() const;
40
41 size_t GetSizeOfLastLine() const;
42
43 llvm::StringRef GetString() const;
44
45 const char *GetData() const { return m_packet.c_str(); }
46
47 void FillLastLineToColumn(uint32_t column, char fill_char);
48
49protected:
50 friend class ScriptInterpreter;
51
52 std::string m_packet;
53 size_t WriteImpl(const void *s, size_t length) override;
54};
55
56} // namespace lldb_private
57
58#endif // LLDB_UTILITY_STREAMSTRING_H
size_t WriteImpl(const void *s, size_t length) override
Output character bytes to the stream.
size_t GetSizeOfLastLine() const
const char * GetData() const
Definition: StreamString.h:45
void Flush() override
Flush the stream.
llvm::StringRef GetString() const
void FillLastLineToColumn(uint32_t column, char fill_char)
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.