]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/StreamFile.h
MFV r319948: 5428 provide fts(), reallocarray(), and strtonum()
[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 // C Includes
14 // C++ Includes
15
16 #include <string>
17
18 // Other libraries and framework includes
19 // Project includes
20
21 #include "lldb/Core/Stream.h"
22 #include "lldb/Host/File.h"
23
24 namespace lldb_private {
25
26 class StreamFile : public Stream {
27 public:
28   //------------------------------------------------------------------
29   // Constructors and Destructors
30   //------------------------------------------------------------------
31   StreamFile();
32
33   StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
34
35   StreamFile(int fd, bool transfer_ownership);
36
37   StreamFile(const char *path);
38
39   StreamFile(const char *path, uint32_t options,
40              uint32_t permissions = lldb::eFilePermissionsFileDefault);
41
42   StreamFile(FILE *fh, bool transfer_ownership);
43
44   ~StreamFile() override;
45
46   File &GetFile() { return m_file; }
47
48   const File &GetFile() const { return m_file; }
49
50   void Flush() override;
51
52   size_t Write(const void *s, size_t length) override;
53
54 protected:
55   //------------------------------------------------------------------
56   // Classes that inherit from StreamFile can see and modify these
57   //------------------------------------------------------------------
58   File m_file;
59
60 private:
61   DISALLOW_COPY_AND_ASSIGN(StreamFile);
62 };
63
64 } // namespace lldb_private
65
66 #endif // liblldb_StreamFile_h_