class raw_fd_ostream

Declaration

class raw_fd_ostream : public raw_pwrite_stream { /* full declaration omitted */ };

Description

A raw_ostream that writes to a file descriptor.

Declared at: llvm/include/llvm/Support/raw_ostream.h:397

Inherits from: raw_pwrite_stream

Member Variables

Inherited from raw_ostream:

public static BLACK = Colors::BLACK
public static RED = Colors::RED
public static GREEN = Colors::GREEN
public static YELLOW = Colors::YELLOW
public static BLUE = Colors::BLUE
public static MAGENTA = Colors::MAGENTA
public static CYAN = Colors::CYAN
public static WHITE = Colors::WHITE
public static SAVEDCOLOR = Colors::SAVEDCOLOR
public static RESET = Colors::RESET

Method Overview

Inherited from raw_pwrite_stream:

Inherited from raw_ostream:

Methods

llvm::raw_ostream& changeColor(enum Colors colors,
                               bool bold = false,
                               bool bg = false)

Description

Changes the foreground color of text that will be output from this point forward.

Declared at: llvm/include/llvm/Support/raw_ostream.h:467

Parameters

enum Colors colors
bool bold = false
bool bg = false

Returns

itself so it can be used within < < invocations

void clear_error()

Description

Set the flag read by has_error() to false. If the error flag is set at the time when this raw_ostream's destructor is called, report_fatal_error is called to report the error. Use clear_error() after handling the error to avoid this behavior. "Errors should never pass silently. Unless explicitly silenced." - from The Zen of Python, by Tim Peters

Declared at: llvm/include/llvm/Support/raw_ostream.h:496

void close()

Description

Manually flush the stream and close the file. Note that this does not call fsync.

Declared at: llvm/include/llvm/Support/raw_ostream.h:459

void enable_colors(bool enable)

Declared at: llvm/include/llvm/Support/raw_ostream.h:477

Parameters

bool enable

std::error_code error() const

Declared at: llvm/include/llvm/Support/raw_ostream.h:479

bool has_colors() const

Description

This function determines if this stream is displayed and supports colors.

Declared at: llvm/include/llvm/Support/raw_ostream.h:475

bool has_error() const

Description

Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encountered. This doesn't implicitly flush any pending output. Also, it doesn't guarantee to detect all errors unless the stream has been closed.

Declared at: llvm/include/llvm/Support/raw_ostream.h:485

bool is_displayed() const

Description

This function determines if this stream is connected to a "tty" or "console" window. That is, the output would be displayed to the user rather than being put on a pipe or stored in a file.

Declared at: llvm/include/llvm/Support/raw_ostream.h:473

raw_fd_ostream(llvm::StringRef Filename,
               std::error_code& EC,
               sys::fs::CreationDisposition Disp)

Declared at: llvm/include/llvm/Support/raw_ostream.h:440

Parameters

llvm::StringRef Filename
std::error_code& EC
sys::fs::CreationDisposition Disp

raw_fd_ostream(int fd,
               bool shouldClose,
               bool unbuffered = false)

Description

FD is the file descriptor that this writes to. If ShouldClose is true, this closes the file when the stream is destroyed. If FD is for stdout or stderr, it will not be closed.

Declared at: llvm/include/llvm/Support/raw_ostream.h:453

Parameters

int fd
bool shouldClose
bool unbuffered = false

raw_fd_ostream(llvm::StringRef Filename,
               std::error_code& EC,
               sys::fs::CreationDisposition Disp,
               sys::fs::FileAccess Access,
               sys::fs::OpenFlags Flags)

Declared at: llvm/include/llvm/Support/raw_ostream.h:446

Parameters

llvm::StringRef Filename
std::error_code& EC
sys::fs::CreationDisposition Disp
sys::fs::FileAccess Access
sys::fs::OpenFlags Flags

raw_fd_ostream(llvm::StringRef Filename,
               std::error_code& EC,
               sys::fs::OpenFlags Flags)

Declared at: llvm/include/llvm/Support/raw_ostream.h:444

Parameters

llvm::StringRef Filename
std::error_code& EC
sys::fs::OpenFlags Flags

raw_fd_ostream(llvm::StringRef Filename,
               std::error_code& EC,
               sys::fs::FileAccess Access)

Declared at: llvm/include/llvm/Support/raw_ostream.h:442

Parameters

llvm::StringRef Filename
std::error_code& EC
sys::fs::FileAccess Access

raw_fd_ostream(llvm::StringRef Filename,
               std::error_code& EC)

Description

Open the specified file for writing. If an error occurs, information about the error is put into EC, and the stream should be immediately destroyed;\p Flags allows optional flags to control how the file will be opened. As a special case, if Filename is "-", then the stream will use STDOUT_FILENO instead of opening a file. This will not close the stdout descriptor.

Declared at: llvm/include/llvm/Support/raw_ostream.h:439

Parameters

llvm::StringRef Filename
std::error_code& EC

llvm::raw_ostream& resetColor()

Description

Resets the colors to terminal defaults. Call this when you are done outputting colored text, or before program exit.

Declared at: llvm/include/llvm/Support/raw_ostream.h:469

llvm::raw_ostream& reverseColor()

Description

Reverses the foreground and background colors.

Declared at: llvm/include/llvm/Support/raw_ostream.h:471

uint64_t seek(uint64_t off)

Description

Flushes the stream and repositions the underlying file descriptor position to the offset specified from the beginning of the file.

Declared at: llvm/include/llvm/Support/raw_ostream.h:465

Parameters

uint64_t off

bool supportsSeeking()

Declared at: llvm/include/llvm/Support/raw_ostream.h:461

~raw_fd_ostream()

Declared at: llvm/include/llvm/Support/raw_ostream.h:455