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 { 28 public: 29 //------------------------------------------------------------------ 30 // Constructors and Destructors 31 //------------------------------------------------------------------ 32 StreamFile (); 33 34 StreamFile (uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order); 35 36 StreamFile (int fd, bool transfer_ownership); 37 38 StreamFile (const char *path); 39 40 StreamFile (FILE *fh, bool transfer_ownership); 41 42 virtual 43 ~StreamFile(); 44 45 File & 46 GetFile () 47 { 48 return m_file; 49 } 50 51 const File & 52 GetFile () const 53 { 54 return m_file; 55 } 56 57 virtual void 58 Flush (); 59 60 virtual size_t 61 Write (const void *s, size_t length); 62 63 protected: 64 //------------------------------------------------------------------ 65 // Classes that inherit from StreamFile can see and modify these 66 //------------------------------------------------------------------ 67 File m_file; 68 69 private: 70 DISALLOW_COPY_AND_ASSIGN (StreamFile); 71 }; 72 73 } // namespace lldb_private 74 75 #endif // liblldb_StreamFile_h_ 76