]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/StreamFile.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Core / StreamFile.h
1 //===-- StreamFile.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_StreamFile_h_
11 #define liblldb_StreamFile_h_
12
13 #include "lldb/Host/File.h"
14 #include "lldb/Utility/Stream.h"
15 #include "lldb/lldb-defines.h"
16 #include "lldb/lldb-enumerations.h"
17
18 #include <stdint.h>
19 #include <stdio.h>
20
21 namespace lldb_private {
22
23 class StreamFile : public Stream {
24 public:
25   //------------------------------------------------------------------
26   // Constructors and Destructors
27   //------------------------------------------------------------------
28   StreamFile();
29
30   StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
31
32   StreamFile(int fd, bool transfer_ownership);
33
34   StreamFile(const char *path);
35
36   StreamFile(const char *path, uint32_t options,
37              uint32_t permissions = lldb::eFilePermissionsFileDefault);
38
39   StreamFile(FILE *fh, bool transfer_ownership);
40
41   ~StreamFile() override;
42
43   File &GetFile() { return m_file; }
44
45   const File &GetFile() const { return m_file; }
46
47   void Flush() override;
48
49
50 protected:
51   //------------------------------------------------------------------
52   // Classes that inherit from StreamFile can see and modify these
53   //------------------------------------------------------------------
54   File m_file;
55   size_t WriteImpl(const void *s, size_t length) override;
56
57 private:
58   DISALLOW_COPY_AND_ASSIGN(StreamFile);
59 };
60
61 } // namespace lldb_private
62
63 #endif // liblldb_StreamFile_h_