module watt.io.streams.stdc

Stream implementations in which the underlying implementation is libc FILEs.

Code Map

//! Stream implementations in which the underlying implementation is libc
//! FILEs.
module watt.io.streams.stdc;


//! An OutputStream in which the sink is a file.
class OutputStdcStream : OutputStream
{
public:
	//! The underlying FILE handle.
	handle: FILE*;


public:
	//! Construct a new OutputStdcStream from a filename. This will use the
	//! mode string "w", so will overwrite any file with the given name that
	//! already exists.
	this(filename: const(char)[]) { }
	//! Construct a new OutputStdcStream with a filename, using the given mode
	//! string.
	this(filename: const(char)[], flags: const(char)[]) { }
	//! Close the underlying FILE handle.
	fn close() { }
	//! Is this stream open?
	fn isOpen() bool { }
	//! Write a single character to the stream.
	fn put(c: dchar) { }
	//! Write a string to the stream.
	fn write(s: scope (const(scope (char)[])) { }
	//! Ensure all buffered input is written to the stream.
	fn flush() { }
}

//! An InputStream in which the source is a file.
class InputStdcStream : InputStream
{
public:
	//! The underlying FILE handle.
	handle: FILE*;


public:
	//! Construct a new stream from a filename.
	this(filename: const(char)[]) { }
	//! Construct a new InputStdcStream with a filename, using the given mode
	//! string.
	this(filename: const(char)[], flags: const(char)[]) { }
	//! Close the underlying FILE handle.
	fn close() { }
	//! Is this stream open?
	fn isOpen() bool { }
	//! Read a single character from this stream.
	fn get() dchar { }
	//! Read from the stream into buffer.
	fn read(buffer: u8[]) u8[] { }
	//! Has this stream reached EOF?
	fn eof() bool { }
}
class OutputStdcStream : OutputStream

An OutputStream in which the sink is a file.

handle: FILE*

The underlying FILE handle.

this(filename: const(char)[])

Construct a new OutputStdcStream from a filename. This will use the mode string "w", so will overwrite any file with the given name that already exists.

this(filename: const(char)[], flags: const(char)[])

Construct a new OutputStdcStream with a filename, using the given mode string.

fn close()

Close the underlying FILE handle.

fn isOpen() bool

Is this stream open?

fn put(c: dchar)

Write a single character to the stream.

fn write(s: scope (const(scope (char)[]))

Write a string to the stream.

fn flush()

Ensure all buffered input is written to the stream.

class InputStdcStream : InputStream

An InputStream in which the source is a file.

handle: FILE*

The underlying FILE handle.

this(filename: const(char)[])

Construct a new stream from a filename.

this(filename: const(char)[], flags: const(char)[])

Construct a new InputStdcStream with a filename, using the given mode string.

fn close()

Close the underlying FILE handle.

fn isOpen() bool

Is this stream open?

fn get() dchar

Read a single character from this stream.

fn read(buffer: u8[]) u8[]

Read from the stream into buffer.

Return

The slice of buffer actually used.

fn eof() bool

Has this stream reached EOF?