]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/lldb/source/Core/StreamFile.cpp
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / tools / lldb / source / Core / StreamFile.cpp
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
20 using namespace lldb;
21 using namespace lldb_private;
22
23 //----------------------------------------------------------------------
24 // StreamFile constructor
25 //----------------------------------------------------------------------
26 StreamFile::StreamFile () :
27     Stream (),
28     m_file ()
29 {
30 }
31
32 StreamFile::StreamFile (uint32_t flags, uint32_t addr_size, ByteOrder byte_order) :
33     Stream (flags, addr_size, byte_order),
34     m_file ()
35 {
36 }
37
38 StreamFile::StreamFile (int fd, bool transfer_ownership) :
39     Stream (),
40     m_file (fd, transfer_ownership)
41 {
42 }
43
44 StreamFile::StreamFile (FILE *fh, bool transfer_ownership) :
45     Stream (),
46     m_file (fh, transfer_ownership)
47 {
48 }
49
50 StreamFile::StreamFile (const char *path) :
51     Stream (),
52     m_file (path, File::eOpenOptionWrite | File::eOpenOptionCanCreate, lldb::eFilePermissionsFileDefault)
53 {
54 }
55
56
57 StreamFile::~StreamFile()
58 {
59 }
60
61 void
62 StreamFile::Flush ()
63 {
64     m_file.Flush();
65 }
66
67 size_t
68 StreamFile::Write (const void *s, size_t length)
69 {
70     m_file.Write (s, length);
71     return length;
72 }