]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Utility/StreamString.h
MFC r348554: 9688 aggsum_fini leaks memory
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Utility / StreamString.h
1 //===-- StreamString.h ------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_StreamString_h_
11 #define liblldb_StreamString_h_
12
13 #include "lldb/Utility/Stream.h"
14 #include "lldb/lldb-enumerations.h"
15 #include "llvm/ADT/StringRef.h"
16
17 #include <string>
18
19 #include <stddef.h>
20 #include <stdint.h>
21
22 namespace lldb_private {
23
24 class StreamString : public Stream {
25 public:
26   StreamString();
27
28   StreamString(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
29
30   ~StreamString() override;
31
32   void Flush() override;
33
34   void Clear();
35
36   bool Empty() const;
37
38   size_t GetSize() const;
39
40   size_t GetSizeOfLastLine() const;
41
42   llvm::StringRef GetString() const;
43
44   const char *GetData() const { return m_packet.c_str(); }
45
46   void FillLastLineToColumn(uint32_t column, char fill_char);
47
48 protected:
49   std::string m_packet;
50   size_t WriteImpl(const void *s, size_t length) override;
51 };
52
53 } // namespace lldb_private
54
55 #endif // liblldb_StreamString_h_