]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / include / lldb / Core / StreamFile.h
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
49   File m_file;
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_