1 //===-- StreamFile.h --------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_StreamFile_h_
10 #define liblldb_StreamFile_h_
12 #include "lldb/Host/File.h"
13 #include "lldb/Utility/Stream.h"
14 #include "lldb/lldb-defines.h"
15 #include "lldb/lldb-enumerations.h"
20 namespace lldb_private {
22 class StreamFile : public Stream {
24 // Constructors and Destructors
27 StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
29 StreamFile(int fd, bool transfer_ownership);
31 StreamFile(const char *path);
33 StreamFile(const char *path, uint32_t options,
34 uint32_t permissions = lldb::eFilePermissionsFileDefault);
36 StreamFile(FILE *fh, bool transfer_ownership);
38 ~StreamFile() override;
40 File &GetFile() { return m_file; }
42 const File &GetFile() const { return m_file; }
44 void Flush() override;
48 // Classes that inherit from StreamFile can see and modify these
50 size_t WriteImpl(const void *s, size_t length) override;
53 DISALLOW_COPY_AND_ASSIGN(StreamFile);
56 } // namespace lldb_private
58 #endif // liblldb_StreamFile_h_