xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Protected Member Functions | List of all members
xtd::io::text_writer Class Reference

#include <text_writer.h>

Definition

Represents a writer that can write a sequential series of characters.

Namespace
xtd::io
Library
xtd.core

Inherits xtd::object.

Inherited by xtd::io::null_text_writer, xtd::io::stream_writer, xtd::io::string_writer, and xtd::io::synchronized_text_writer.

Public Member Functions

virtual void close ()
 Closes the xtd::io::text_reader and releases any system resources associated with the text_reader.
 
virtual void flush ()
 Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.
 
const xtd::ustringnew_line () const noexcept
 Gets the line terminator string used by the current text_writer.
 
void new_line (const xtd::ustring &new_line) noexcept
 Sets the line terminator string used by the current text_writer.
 
void write (bool value)
 Writes the specified bool value to the text stream.
 
template<typename ... args_t>
void write (const xtd::ustring &fmt, args_t &&... args) noexcept
 Writes the specified arguments with specified format to the text stream.
 
virtual void write (const xtd::ustring &value)
 Writes the specified string value to the text stream.
 
void write (double value)
 Writes the specified double value to the text stream.
 
void write (float value)
 Writes the specified float value to the text stream.
 
void write (int16_t value)
 Writes the specified int16_t value to the text stream.
 
void write (int32_t value)
 Writes the specified int32_t value to the text stream.
 
void write (int64_t value)
 Writes the specified int64_t value to the text stream.
 
void write (int8_t value)
 Writes the specified int8_t value to the text stream.
 
void write (uint16_t value)
 Writes the specified uint16_t value to the text stream.
 
void write (uint32_t value)
 Writes the specified uint32_t value to the text stream.
 
void write (uint64_t value)
 Writes the specified uint64_t value to the text stream.
 
void write (uint8_t value)
 Writes the specified uint8_t value to the text stream.
 
template<typename value_t >
void write (value_t value)
 Writes the specified value_t value to the text stream.
 
void write_line ()
 Writes new line to the text stream.
 
void write_line (bool value)
 Writes the specified bool value and new line to the text stream.
 
template<typename ... args_t>
void write_line (const xtd::ustring &fmt, args_t &&... args) noexcept
 Writes the specified arguments with specified format to the text stream.
 
void write_line (const xtd::ustring &value)
 Writes the specified string value and new line to the text stream.
 
void write_line (double value)
 Writes the specified double value and new line to the text stream.
 
void write_line (float value)
 Writes the specified float value and new line to the text stream.
 
void write_line (int16_t value)
 Writes the specified int16_t value and new line to the text stream.
 
void write_line (int32_t value)
 Writes the specified int32_t value and new line to the text stream.
 
void write_line (int64_t value)
 Writes the specified int64_t value and new line to the text stream.
 
void write_line (int8_t value)
 Writes the specified int8_t value and new line to the text stream.
 
void write_line (uint16_t value)
 Writes the specified uint16_t value and new line to the text stream.
 
void write_line (uint32_t value)
 Writes the specified uint32_t value and new line to the text stream.
 
void write_line (uint64_t value)
 Writes the specified uint64_t value and new line to the text stream.
 
void write_line (uint8_t value)
 Writes the specified uint8_t value and new line to the text stream.
 
template<typename value_t >
void write_line (value_t value)
 Writes the specified value_t value and new line to the text stream.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance.
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object.
 

Static Public Member Functions

static null_text_writernull () noexcept
 Provides a text_writer with no backing store that can be written to, but not read from.
 
static synchronized_text_writer synchronised (text_writer &writer) noexcept
 Creates a thread-safe (synchronized) wrapper around the specified text_writer object.
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Protected Attributes

xtd::ustring new_line_
 

Protected Member Functions

 text_writer ()=default
 Initializes a new instance of the xtd::io::text_writer class.
 

Constructor & Destructor Documentation

◆ text_writer()

xtd::io::text_writer::text_writer ( )
protecteddefault

Initializes a new instance of the xtd::io::text_writer class.

Member Function Documentation

◆ close()

virtual void xtd::io::text_writer::close ( )
virtual

Closes the xtd::io::text_reader and releases any system resources associated with the text_reader.

Reimplemented in xtd::io::stream_writer.

◆ flush()

virtual void xtd::io::text_writer::flush ( )
virtual

Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

Remarks
This default method does nothing, but derived classes can virtual the method to provide the appropriate functionality

Reimplemented in xtd::io::stream_writer, and xtd::io::string_writer.

◆ new_line() [1/2]

const xtd::ustring & xtd::io::text_writer::new_line ( ) const
noexcept

Gets the line terminator string used by the current text_writer.

◆ new_line() [2/2]

void xtd::io::text_writer::new_line ( const xtd::ustring new_line)
noexcept

Sets the line terminator string used by the current text_writer.

◆ null()

static null_text_writer & xtd::io::text_writer::null ( )
staticnoexcept

Provides a text_writer with no backing store that can be written to, but not read from.

Remarks
Use null to redirect output to a stream that will not consume any operating system resources.
When the text_writer::write methods are invoked on null, the call simply returns, and no data is actually written to any backing store.

◆ synchronised()

static synchronized_text_writer xtd::io::text_writer::synchronised ( text_writer writer)
staticnoexcept

Creates a thread-safe (synchronized) wrapper around the specified text_writer object.

Parameters
readerThe TextReader object to synchronize.
Returns
text_writer A thread-safe text_writer object.

◆ write() [1/14]

void xtd::io::text_writer::write ( bool  value)

Writes the specified bool value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [2/14]

template<typename ... args_t>
void xtd::io::text_writer::write ( const xtd::ustring fmt,
args_t &&...  args 
)
inlinenoexcept

Writes the specified arguments with specified format to the text stream.

Parameters
formatThe arguments format to write.
argsThe arguments to write with format
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [3/14]

virtual void xtd::io::text_writer::write ( const xtd::ustring value)
virtual

Writes the specified string value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

Reimplemented in xtd::io::null_text_writer, xtd::io::stream_writer, xtd::io::stream_writer, xtd::io::string_writer, and xtd::io::synchronized_text_writer.

◆ write() [4/14]

void xtd::io::text_writer::write ( double  value)

Writes the specified double value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [5/14]

void xtd::io::text_writer::write ( float  value)

Writes the specified float value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [6/14]

void xtd::io::text_writer::write ( int16_t  value)

Writes the specified int16_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [7/14]

void xtd::io::text_writer::write ( int32_t  value)

Writes the specified int32_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [8/14]

void xtd::io::text_writer::write ( int64_t  value)

Writes the specified int64_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [9/14]

void xtd::io::text_writer::write ( int8_t  value)

Writes the specified int8_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [10/14]

void xtd::io::text_writer::write ( uint16_t  value)

Writes the specified uint16_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [11/14]

void xtd::io::text_writer::write ( uint32_t  value)

Writes the specified uint32_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [12/14]

void xtd::io::text_writer::write ( uint64_t  value)

Writes the specified uint64_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [13/14]

void xtd::io::text_writer::write ( uint8_t  value)

Writes the specified uint8_t value to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write() [14/14]

template<typename value_t >
void xtd::io::text_writer::write ( value_t  value)
inline

Writes the specified value_t value to the text stream.

Template Parameters
value_tThe type of value to write.
Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [1/15]

void xtd::io::text_writer::write_line ( )

Writes new line to the text stream.

Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [2/15]

void xtd::io::text_writer::write_line ( bool  value)

Writes the specified bool value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [3/15]

template<typename ... args_t>
void xtd::io::text_writer::write_line ( const xtd::ustring fmt,
args_t &&...  args 
)
inlinenoexcept

Writes the specified arguments with specified format to the text stream.

Parameters
formatThe arguments format to write.
argsThe arguments to write with format.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [4/15]

void xtd::io::text_writer::write_line ( const xtd::ustring value)

Writes the specified string value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [5/15]

void xtd::io::text_writer::write_line ( double  value)

Writes the specified double value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [6/15]

void xtd::io::text_writer::write_line ( float  value)

Writes the specified float value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [7/15]

void xtd::io::text_writer::write_line ( int16_t  value)

Writes the specified int16_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [8/15]

void xtd::io::text_writer::write_line ( int32_t  value)

Writes the specified int32_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [9/15]

void xtd::io::text_writer::write_line ( int64_t  value)

Writes the specified int64_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [10/15]

void xtd::io::text_writer::write_line ( int8_t  value)

Writes the specified int8_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [11/15]

void xtd::io::text_writer::write_line ( uint16_t  value)

Writes the specified uint16_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [12/15]

void xtd::io::text_writer::write_line ( uint32_t  value)

Writes the specified uint32_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [13/15]

void xtd::io::text_writer::write_line ( uint64_t  value)

Writes the specified uint64_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [14/15]

void xtd::io::text_writer::write_line ( uint8_t  value)

Writes the specified uint8_t value and new line to the text stream.

Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

◆ write_line() [15/15]

template<typename value_t >
void xtd::io::text_writer::write_line ( value_t  value)
inline

Writes the specified value_t value and new line to the text stream.

Template Parameters
value_tThe type of value to write.
Parameters
valueThe value to write.
Exceptions
io::io_exceptionAn I/O error occurs.

The documentation for this class was generated from the following file: