StreamString.h revision 353358
1228753Smm//===-- StreamString.h ------------------------------------------*- C++ -*-===//
2228753Smm//
3228753Smm// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4228753Smm// See https://llvm.org/LICENSE.txt for license information.
5228753Smm// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6228753Smm//
7228753Smm//===----------------------------------------------------------------------===//
8228753Smm
9228753Smm#ifndef liblldb_StreamString_h_
10228753Smm#define liblldb_StreamString_h_
11228753Smm
12228753Smm#include "lldb/Utility/Stream.h"
13228753Smm#include "lldb/lldb-enumerations.h"
14228753Smm#include "llvm/ADT/StringRef.h"
15228753Smm
16228753Smm#include <string>
17228753Smm
18228753Smm#include <stddef.h>
19228753Smm#include <stdint.h>
20228753Smm
21228753Smmnamespace lldb_private {
22228753Smm
23228753Smmclass StreamString : public Stream {
24228753Smmpublic:
25228753Smm  StreamString();
26228753Smm
27228753Smm  StreamString(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
28228763Smm
29228753Smm  ~StreamString() override;
30228753Smm
31228753Smm  void Flush() override;
32228753Smm
33228753Smm  void Clear();
34228753Smm
35228753Smm  bool Empty() const;
36228753Smm
37228753Smm  size_t GetSize() const;
38248616Smm
39228753Smm  size_t GetSizeOfLastLine() const;
40228753Smm
41228753Smm  llvm::StringRef GetString() const;
42228753Smm
43228753Smm  const char *GetData() const { return m_packet.c_str(); }
44228753Smm
45228753Smm  void FillLastLineToColumn(uint32_t column, char fill_char);
46228753Smm
47228753Smmprotected:
48228753Smm  std::string m_packet;
49228753Smm  size_t WriteImpl(const void *s, size_t length) override;
50228753Smm};
51228753Smm
52228753Smm} // namespace lldb_private
53228753Smm
54228753Smm#endif // liblldb_StreamString_h_
55228753Smm