LLDB  mainline
StreamFile.h
Go to the documentation of this file.
1 //===-- StreamFile.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 liblldb_StreamFile_h_
10 #define liblldb_StreamFile_h_
11 
12 #include "lldb/Host/File.h"
13 #include "lldb/Utility/Stream.h"
14 #include "lldb/lldb-defines.h"
15 #include "lldb/lldb-enumerations.h"
16 
17 #include <stdint.h>
18 #include <stdio.h>
19 
20 namespace lldb_private {
21 
22 class StreamFile : public Stream {
23 public:
24  // Constructors and Destructors
25  StreamFile();
26 
27  StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
28 
29  StreamFile(int fd, bool transfer_ownership);
30 
31  StreamFile(const char *path);
32 
33  StreamFile(const char *path, uint32_t options,
34  uint32_t permissions = lldb::eFilePermissionsFileDefault);
35 
36  StreamFile(FILE *fh, bool transfer_ownership);
37 
38  ~StreamFile() override;
39 
40  File &GetFile() { return m_file; }
41 
42  const File &GetFile() const { return m_file; }
43 
44  void Flush() override;
45 
46 
47 protected:
48  // Classes that inherit from StreamFile can see and modify these
50  size_t WriteImpl(const void *s, size_t length) override;
51 
52 private:
53  DISALLOW_COPY_AND_ASSIGN(StreamFile);
54 };
55 
56 } // namespace lldb_private
57 
58 #endif // liblldb_StreamFile_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
void Flush() override
Flush the stream.
Definition: StreamFile.cpp:44
A file class.
Definition: File.h:29
const File & GetFile() const
Definition: StreamFile.h:42
size_t WriteImpl(const void *s, size_t length) override
Output character bytes to the stream.
Definition: StreamFile.cpp:46