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"
13 #include "lldb/lldb-enumerations.h"
14 #include "llvm/ADT/StringRef.h"
15 
16 #include <string>
17 
18 #include <cstddef>
19 #include <cstdint>
20 
21 namespace lldb_private {
22 
23 class StreamString : public Stream {
24 public:
25  StreamString();
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 
47 protected:
49  size_t WriteImpl(const void *s, size_t length) override;
50 };
51 
52 } // namespace lldb_private
53 
54 #endif // LLDB_UTILITY_STREAMSTRING_H
lldb_private::StreamString::FillLastLineToColumn
void FillLastLineToColumn(uint32_t column, char fill_char)
Definition: StreamString.cpp:53
lldb_private::Stream
Definition: Stream.h:28
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::StreamString::GetSize
size_t GetSize() const
Definition: StreamString.cpp:38
lldb_private::StreamString::StreamString
StreamString()
Definition: StreamString.cpp:14
lldb_private::StreamString::Clear
void Clear()
Definition: StreamString.cpp:31
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
lldb_private::StreamString
Definition: StreamString.h:23
lldb-enumerations.h
lldb_private::StreamString::Empty
bool Empty() const
Definition: StreamString.cpp:36
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::StreamString::WriteImpl
size_t WriteImpl(const void *s, size_t length) override
Output character bytes to the stream.
Definition: StreamString.cpp:26
uint32_t
lldb_private::StreamString::m_packet
std::string m_packet
Definition: StreamString.h:48
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::StreamString::Flush
void Flush() override
Flush the stream.
Definition: StreamString.cpp:22
lldb_private::StreamString::~StreamString
~StreamString() override
Stream.h
lldb_private::StreamString::GetSizeOfLastLine
size_t GetSizeOfLastLine() const
Definition: StreamString.cpp:40
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138