1//===-- StreamFile.cpp ------------------------------------------*- 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#include "lldb/Core/StreamFile.h" 11 12// C Includes 13#include <stdio.h> 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/Core/Error.h" 18 19 20using namespace lldb; 21using namespace lldb_private; 22 23//---------------------------------------------------------------------- 24// StreamFile constructor 25//---------------------------------------------------------------------- 26StreamFile::StreamFile () : 27 Stream (), 28 m_file () 29{ 30} 31 32StreamFile::StreamFile (uint32_t flags, uint32_t addr_size, ByteOrder byte_order) : 33 Stream (flags, addr_size, byte_order), 34 m_file () 35{ 36} 37 38StreamFile::StreamFile (int fd, bool transfer_ownership) : 39 Stream (), 40 m_file (fd, transfer_ownership) 41{ 42} 43 44StreamFile::StreamFile (FILE *fh, bool transfer_ownership) : 45 Stream (), 46 m_file (fh, transfer_ownership) 47{ 48} 49 50StreamFile::StreamFile (const char *path) : 51 Stream (), 52 m_file (path, File::eOpenOptionWrite | File::eOpenOptionCanCreate, File::ePermissionsDefault) 53{ 54} 55 56 57StreamFile::~StreamFile() 58{ 59} 60 61void 62StreamFile::Flush () 63{ 64 m_file.Flush(); 65} 66 67size_t 68StreamFile::Write (const void *s, size_t length) 69{ 70 m_file.Write (s, length); 71 return length; 72} 73