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 StreamString : public Stream {
24public:
26
27 StreamString(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
28
29 ~StreamString() override;
30
31 void Flush() override;
32
33 void Clear();
34
35 bool Empty() const;
36
37 size_t GetSize() const;
38
39 size_t GetSizeOfLastLine() const;
40
41 llvm::StringRef GetString() const;
42
43 const char *GetData() const { return m_packet.c_str(); }
44
45 void FillLastLineToColumn(uint32_t column, char fill_char);
46
47protected:
48 std::string m_packet;
49 size_t WriteImpl(const void *s, size_t length) override;
50};
51
52} // namespace lldb_private
53
54#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:43
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.