StreamFile.h revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
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 23namespace lldb_private { 24 25class StreamFile : public Stream 26{ 27public: 28 //------------------------------------------------------------------ 29 // Constructors and Destructors 30 //------------------------------------------------------------------ 31 StreamFile (); 32 33 StreamFile (uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order, FILE *f); 34 35 StreamFile (FILE *f); 36 37 StreamFile (uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order, const char *path, const char *permissions = "w"); 38 39 StreamFile (const char *path, const char *permissions = "w"); 40 41 virtual 42 ~StreamFile(); 43 44 void 45 Close (); 46 47 bool 48 Open (const char *path, const char *permissions = "w"); 49 50 virtual void 51 Flush (); 52 53 virtual int 54 Write (const void *s, size_t length); 55 56 FILE * 57 GetFileHandle (); 58 59 void 60 SetFileHandle (FILE *file, bool close_file); 61 62 const char * 63 GetFilePathname (); 64 65protected: 66 //------------------------------------------------------------------ 67 // Classes that inherit from StreamFile can see and modify these 68 //------------------------------------------------------------------ 69 FILE* m_file; ///< File handle to dump to. 70 bool m_close_file; 71 std::string m_path_name; 72}; 73 74} // namespace lldb_private 75 76#endif // liblldb_StreamFile_h_ 77