xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::io Namespace Reference

Input/Output functionality. More...

Classes

class  AbstractBufferedInputStream
 Base class for input streams that use a private allocated read buffer. More...
 
class  AbstractBufferedOutputStream
 Base class for output streams that use a private allocated write buffer. More...
 
class  AbstractDeviceInputStream
 Base class for input streams that read from an InputDevice. More...
 
class  AbstractDeviceOutputStream
 Base class for output streams that read from an OutputDevice. More...
 
class  ConnectionClosed
 Mixin class used to denote that a connection was closed on a communication device. More...
 
class  DeviceBase
 Common base class for input and output devices. More...
 
class  DeviceInputStream
 A stream that reads from an io::InputDevice. More...
 
class  DeviceOutputStream
 A stream that writes to an io::OutputDevice. More...
 
class  EndOfDataError
 An exception that is thrown when not enough data could be read. More...
 
class  EndOfStreamError
 An exception that is thrown when the end of the stream has been reached. More...
 
class  File
 A file. More...
 
class  FileExistsError
 An exception that is thrown when trying to create a file that already exists. More...
 
class  FileInputStream
 A stream that reads from a file. More...
 
class  FileNotFoundError
 An exception that is thrown when trying to open a file that does not exist. More...
 
class  FileOutputStream
 A stream that writes to a file. More...
 
class  InputDevice
 Base class for all input devices. More...
 
class  InputStream
 Base class for input streams. More...
 
class  MemoryInputDevice
 A device that reads data from memory. More...
 
class  MemoryInputStream
 A stream that reads data from memory. More...
 
class  MemoryOutputDevice
 A device that writes data to a memory region. More...
 
class  MemoryOutputDevice< Void >
 A specialization for MemoryOutputDevice that uses void as element type. More...
 
class  MemoryOutputDeviceBase
 Common base class for specializations of MemoryOutputDevice. More...
 
class  MemoryOutputStream
 A stream that writes data to a memory region. More...
 
class  MemoryOutputStream< Element, void >
 A specialization for MemoryOutputStream that uses void as element type. More...
 
class  MemoryOutputStreamBase
 Common base class for specializations of MemoryOutputStream. More...
 
class  OutputDevice
 Base class for all output devices. More...
 
class  OutputStream
 Base class for input streams. More...
 
class  ReadTimeoutError
 An exception that is thrown when no more data arrived within a reasonable time. More...
 
class  StopRequested
 Exception thrown when an operation is interrupted programmatically using a stop source. More...
 
class  StopSource
 A class that allows interrupting wait operations on communications classes. More...
 
class  StreamBase
 Common base class for input and output streams. More...
 
class  WriteTimeoutError
 An exception that is thrown when data could not be send within a reasonable time. More...
 

Concepts

concept  MemoryStreamStorageElement
 Concept for storage elements for MemoryInputStream and MemoryOutputStream.
 
concept  StreamElement
 Concept for stream elements.
 

Typedefs

template<MemoryStreamStorageElement StorageElement>
using MemoryStreamElement = typename detail::DeducedMemoryStreamElement< StorageElement >::Type
 A suitable element type for MemoryInputStream and MemoryOutputStream for a storage element type.
 

Functions

template<typename Exception >
auto throwWithConnectionClosed (Exception &&exception)
 Throws an exception derived from both ConnectionClosed another exception type.
 
template<typename Exception >
auto throwWithConnectionClosed (bool isConnectionClosed, Exception &&exception)
 Throws an exception, optionally mixing in the class ConnectionClosed.
 
template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
 MemoryInputStream (Iterator, Iterator) -> MemoryInputStream< MemoryStreamElement< std::iter_value_t< Iterator > > >
 
template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
 MemoryInputStream (Iterator, std::iter_difference_t< Iterator >) -> MemoryInputStream< MemoryStreamElement< std::iter_value_t< Iterator > > >
 
template<memory::VoidPointer Pointer>
 MemoryInputStream (Pointer, Pointer) -> MemoryInputStream< std::byte >
 
template<memory::VoidPointer Pointer>
 MemoryInputStream (Pointer, std::size_t) -> MemoryInputStream< std::byte >
 
template<std::ranges::contiguous_range Region>
requires MemoryStreamStorageElement<std::ranges::range_value_t<Region>>
 MemoryInputStream (const Region &) -> MemoryInputStream< MemoryStreamElement< std::ranges::range_value_t< Region > > >
 
template<memory::MemoryIterator Iterator>
 MemoryOutputDevice (Iterator, Iterator) -> MemoryOutputDevice< std::remove_volatile_t< std::iter_value_t< Iterator > > >
 
template<memory::MemoryIterator Iterator>
 MemoryOutputDevice (Iterator, std::iter_difference_t< Iterator >) -> MemoryOutputDevice< std::remove_volatile_t< std::iter_value_t< Iterator > > >
 
template<memory::VoidPointer Pointer>
 MemoryOutputDevice (Pointer, Pointer) -> MemoryOutputDevice< std::remove_volatile_t< std::remove_pointer_t< Pointer > > >
 
template<memory::VoidPointer Pointer>
 MemoryOutputDevice (Pointer, std::size_t) -> MemoryOutputDevice< std::remove_volatile_t< std::remove_pointer_t< Pointer > > >
 
template<memory::MemoryRegion Region>
 MemoryOutputDevice (Region &region) -> MemoryOutputDevice< std::remove_volatile_t< std::ranges::range_value_t< Region > > >
 
template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
 MemoryOutputStream (Iterator, Iterator) -> MemoryOutputStream< MemoryStreamElement< std::iter_value_t< Iterator > >, std::iter_value_t< Iterator > >
 
template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
 MemoryOutputStream (Iterator, std::iter_difference_t< Iterator >) -> MemoryOutputStream< MemoryStreamElement< std::iter_value_t< Iterator > >, std::iter_value_t< Iterator > >
 
template<std::ranges::contiguous_range Region>
requires MemoryStreamStorageElement<std::ranges::range_value_t<Region>>
 MemoryOutputStream (Region &) -> MemoryOutputStream< MemoryStreamElement< std::ranges::range_value_t< Region > >, std::ranges::range_value_t< Region > >
 
template<memory::VoidPointer Pointer>
 MemoryOutputStream (Pointer, Pointer) -> MemoryOutputStream< std::remove_pointer_t< Pointer >, std::byte >
 
template<memory::VoidPointer Pointer>
 MemoryOutputStream (Pointer, std::size_t) -> MemoryOutputStream< std::remove_pointer_t< Pointer >, std::byte >
 

Detailed Description

Input/Output functionality.

This namespace contains classes for performing streaming I/O with different devices like files, memory blocks etc.

Typedef Documentation

◆ MemoryStreamElement

template<MemoryStreamStorageElement StorageElement>
using xentara::utils::io::MemoryStreamElement = typedef typename detail::DeducedMemoryStreamElement<StorageElement>::Type

A suitable element type for MemoryInputStream and MemoryOutputStream for a storage element type.

This type alias deduces the best memory stream element type for memory containing a certain type of data. The types chosen are as follows:

  • character types (char, wchar_t, char8_t, char16_t, char32_t) are used directly
  • non-character 8-bit types are mapped to std::byte
  • 16-bit types are mapped to char16_t
  • 32-bit types are mapped to char32_t

Function Documentation

◆ MemoryInputStream() [1/5]

template<std::ranges::contiguous_range Region>
requires MemoryStreamStorageElement<std::ranges::range_value_t<Region>>
xentara::utils::io::MemoryInputStream ( const Region &  ) -> MemoryInputStream< MemoryStreamElement< std::ranges::range_value_t< Region > > >

◆ MemoryInputStream() [2/5]

template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
xentara::utils::io::MemoryInputStream ( Iterator  ,
Iterator   
) -> MemoryInputStream< MemoryStreamElement< std::iter_value_t< Iterator > > >

◆ MemoryInputStream() [3/5]

template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
xentara::utils::io::MemoryInputStream ( Iterator  ,
std::iter_difference_t< Iterator >   
) -> MemoryInputStream< MemoryStreamElement< std::iter_value_t< Iterator > > >

◆ MemoryInputStream() [4/5]

template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryInputStream ( Pointer  ,
Pointer   
) -> MemoryInputStream< std::byte >

◆ MemoryInputStream() [5/5]

template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryInputStream ( Pointer  ,
std::size_t   
) -> MemoryInputStream< std::byte >

◆ MemoryOutputDevice() [1/5]

template<memory::MemoryIterator Iterator>
xentara::utils::io::MemoryOutputDevice ( Iterator  ,
Iterator   
) -> MemoryOutputDevice< std::remove_volatile_t< std::iter_value_t< Iterator > > >

◆ MemoryOutputDevice() [2/5]

template<memory::MemoryIterator Iterator>
xentara::utils::io::MemoryOutputDevice ( Iterator  ,
std::iter_difference_t< Iterator >   
) -> MemoryOutputDevice< std::remove_volatile_t< std::iter_value_t< Iterator > > >

◆ MemoryOutputDevice() [3/5]

template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryOutputDevice ( Pointer  ,
Pointer   
) -> MemoryOutputDevice< std::remove_volatile_t< std::remove_pointer_t< Pointer > > >

◆ MemoryOutputDevice() [4/5]

template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryOutputDevice ( Pointer  ,
std::size_t   
) -> MemoryOutputDevice< std::remove_volatile_t< std::remove_pointer_t< Pointer > > >

◆ MemoryOutputDevice() [5/5]

template<memory::MemoryRegion Region>
xentara::utils::io::MemoryOutputDevice ( Region &  region) -> MemoryOutputDevice< std::remove_volatile_t< std::ranges::range_value_t< Region > > >

◆ MemoryOutputStream() [1/5]

template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
xentara::utils::io::MemoryOutputStream ( Iterator  ,
Iterator   
) -> MemoryOutputStream< MemoryStreamElement< std::iter_value_t< Iterator > >, std::iter_value_t< Iterator > >

◆ MemoryOutputStream() [2/5]

template<std::contiguous_iterator Iterator>
requires MemoryStreamStorageElement<std::iter_value_t<Iterator>>
xentara::utils::io::MemoryOutputStream ( Iterator  ,
std::iter_difference_t< Iterator >   
) -> MemoryOutputStream< MemoryStreamElement< std::iter_value_t< Iterator > >, std::iter_value_t< Iterator > >

◆ MemoryOutputStream() [3/5]

template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryOutputStream ( Pointer  ,
Pointer   
) -> MemoryOutputStream< std::remove_pointer_t< Pointer >, std::byte >

◆ MemoryOutputStream() [4/5]

template<memory::VoidPointer Pointer>
xentara::utils::io::MemoryOutputStream ( Pointer  ,
std::size_t   
) -> MemoryOutputStream< std::remove_pointer_t< Pointer >, std::byte >

◆ MemoryOutputStream() [5/5]

template<std::ranges::contiguous_range Region>
requires MemoryStreamStorageElement<std::ranges::range_value_t<Region>>
xentara::utils::io::MemoryOutputStream ( Region &  ) -> MemoryOutputStream< MemoryStreamElement< std::ranges::range_value_t< Region > >, std::ranges::range_value_t< Region > >

◆ throwWithConnectionClosed() [1/2]

template<typename Exception >
auto xentara::utils::io::throwWithConnectionClosed ( bool  isConnectionClosed,
Exception &&  exception 
)

Throws an exception, optionally mixing in the class ConnectionClosed.

This function either throws an exception directly, or throws an exception of an internal type derived publicly from both ConnectionClosed and std::decay_t<Exception>, depending on a flag.

Parameters
isConnectionClosedtrue to mix in the class ConnectionClosed, or false to throw the exception directly.
exceptionThe exception to throw

◆ throwWithConnectionClosed() [2/2]

template<typename Exception >
auto xentara::utils::io::throwWithConnectionClosed ( Exception &&  exception)

Throws an exception derived from both ConnectionClosed another exception type.

This function throws an exception of an internal type derived publicly from both ConnectionClosed and std::decay_t<Exception>.

Parameters
exceptionThe exception to throw