1 //===-- StreamFile.h --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_StreamFile_h_
11 #define liblldb_StreamFile_h_
13 #include "lldb/Host/File.h"
14 #include "lldb/Utility/Stream.h"
15 #include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
16 #include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermission...
18 #include <stdint.h> // for uint32_t
19 #include <stdio.h> // for size_t, FILE
21 namespace lldb_private {
23 class StreamFile : public Stream {
25 //------------------------------------------------------------------
26 // Constructors and Destructors
27 //------------------------------------------------------------------
30 StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
32 StreamFile(int fd, bool transfer_ownership);
34 StreamFile(const char *path);
36 StreamFile(const char *path, uint32_t options,
37 uint32_t permissions = lldb::eFilePermissionsFileDefault);
39 StreamFile(FILE *fh, bool transfer_ownership);
41 ~StreamFile() override;
43 File &GetFile() { return m_file; }
45 const File &GetFile() const { return m_file; }
47 void Flush() override;
49 size_t Write(const void *s, size_t length) override;
52 //------------------------------------------------------------------
53 // Classes that inherit from StreamFile can see and modify these
54 //------------------------------------------------------------------
58 DISALLOW_COPY_AND_ASSIGN(StreamFile);
61 } // namespace lldb_private
63 #endif // liblldb_StreamFile_h_