|
| SocketStream () noexcept=default |
| Default constructor.
|
|
| SocketStream (std::reference_wrapper< const io::StopSource > stopSource) noexcept |
| Constructor that associates a stop source with the socket.
|
|
| SocketStream (SocketDevice &&device) |
| Constructor from a socket device.
|
|
template<tools::OneOf< WithStopSource >... Options> |
| SocketStream (Socket &&socket, Options... options) |
| Constructor from a generic socket object.
|
|
template<tools::OneOf< Protocol, WithStopSource >... Options> |
| SocketStream (int addressFamily, Options... options) |
| Constructor that creates a stream socket.
|
|
template<tools::OneOf< WithStopSource >... Options> |
| SocketStream (posix::File socketFileDescriptor, Options... options) |
| Creates a socket object from a Posix file descriptor.
|
|
template<tools::OneOf< WithStopSource >... Options> |
| SocketStream (windows::Socket socket, Options... options) |
| Creates a socket object from a native Windows socket.
|
|
| ~SocketStream () noexcept=default |
| Noexcept Destructor.
|
|
internal auto | operator= (SocketDevice &&device) -> SocketStream & |
| Assignment operator from a socket device.
|
|
auto | operator= (Socket &&socket) -> SocketStream & |
| Assignment operator for a generic socket object.
|
|
auto | operator= (posix::File socketFileDescriptor) -> SocketStream & |
| Assignment operator for a Posix file descriptor.
|
|
auto | operator= (windows::Socket socket) -> SocketStream & |
| Assignment operator for a native Windows socket.
|
|
| operator bool () const noexcept |
| Checks whether the object contains a valid socket.
|
|
auto | addressFamily () const noexcept -> int |
| Gets the address family of the socket, also called the socket domain.
|
|
auto | protocol () const noexcept -> int |
| Gets the protocol of the socket.
|
|
auto | setReadTimeout (std::chrono::nanoseconds timeout) noexcept |
| Sets the read timeout.
|
|
auto | setWriteTimeout (std::chrono::nanoseconds timeout) noexcept |
| Sets the write timeout.
|
|
auto | setTimeout (std::chrono::nanoseconds timeout) noexcept |
| Sets the read and write timeout to the same value.
|
|
template<typename Value > |
auto | option (int level, int optionName) const -> Value |
| Gets a socket option.
|
|
template<typename Value > |
auto | setOption (int level, int optionName, const Value &value) -> void |
| Sets a socket option.
|
|
template<typename Value > |
auto | getOption (int level, int optionName, std::nothrow_t) const noexcept -> xentara::utils::eh::expected< Value, std::error_code > |
| Gets a socket option.
|
|
template<typename Value > |
auto | setOption (int level, int optionName, const Value &value, std::nothrow_t) noexcept -> std::error_code |
| Sets a socket option without throwing exceptions.
|
|
auto | connect (const Address &address) -> void |
| Connects to an address.
|
|
auto | connect (const Address &address, std::optional< std::chrono::nanoseconds > timeout) -> bool |
| Connects to an address with optional timeout.
|
|
auto | bind (PortNumber portNumber) -> void |
| Binds the socket to a port number on all local interfaces.
|
|
auto | bind (const Address &address) -> void |
| Binds the socket to a specific address.
|
|
auto | localAddress () const -> Address |
| Gets the local address of a bound or connected socket.
|
|
auto | remoteAddress () const -> Address |
| Gets the address that the socket is connected to.
|
|
auto | shutdown (Socket::Direction directions=Socket::Direction::ReadWrite) -> void |
| Shuts down the socket.
|
|
auto | close () noexcept -> void |
| Closes the socket, if one is open.
|
|
auto | socket () const &noexcept -> const Socket & |
| Gets the socket as a generic socket.
|
|
auto | native () const noexcept -> int |
| Gets the underlying Posix file descriptor for the socket.
|
|
auto | native () const noexcept -> SOCKET |
| Gets the underlying Windows Sockets 2 SOCKET.
|
|
| AbstractBufferedInputStream ()=default |
| Default constructor Creates a stream without a buffer.
|
|
virtual | ~InputStream () noexcept(false)=0 |
| Virtual, throwing destructor.
|
|
auto | readElement () -> Element |
| Read a single element from the stream.
|
|
auto | tryReadElement () -> std::optional< Element > |
| Tries to read a single element from a stream.
|
|
template<Element kNoMoreData> |
auto | readElementOr () -> Element |
| Tries to read a single element from a stream.
|
|
auto | peek () -> Element |
| Look at the next element in the stream without actually reading it.
|
|
auto | tryPeek () -> std::optional< Element > |
| Look at the next element in the stream without actually reading it.
|
|
template<Element kNoMoreData> |
auto | peekOr () -> Element |
| Look at the next element in the stream without actually reading it.
|
|
auto | readFromBuffer (std::size_t maxSize) -> std::span< const Element > |
| Reads data from the buffer only.
|
|
auto | eof () -> bool |
| Checks if the end of the stream has been reached.
|
|
template<Element... kAllowedElements> |
auto | readElementIf () -> std::optional< Element > |
| Read an element from the stream if it is one of a list of allowed elements.
|
|
template<std::predicate< Element > Predicate> |
auto | readElementIf (Predicate predicate) -> std::optional< Element > |
| Read an element from the stream if it fits a predicate.
|
|
template<Element kFallback, Element... kAllowedElements> |
auto | readElementIfOr () -> Element |
| Read an element from the stream if it is one of a list of allowed elements.
|
|
template<Element kFallback, std::predicate< Element > Predicate> |
auto | readElementIfOr (Predicate predicate) -> Element |
| Read an element from the stream if it fits a predicate.
|
|
template<tools::Allocator< Element > Allocator = std::allocator<Element>>
requires (!tools::CharType<Element>) |
auto | read (typename std::allocator_traits< Allocator >::size_type size, const Allocator &allocator=Allocator()) -> core::RawVector< Element, Allocator > |
| Read a block of data of a specific size.
|
|
template<typename CharTraits = std::char_traits<Element>, tools::Allocator< Element > Allocator = std::allocator<Element>>
requires tools::CharType<Element> |
auto | read (typename std::allocator_traits< Allocator >::size_type size, const Allocator &allocator=Allocator()) -> std::basic_string< Element, CharTraits, Allocator > |
| Read a block of text of a specific size.
|
|
template<std::size_t kArraySize> |
auto | read (Element(&array)[kArraySize]) -> void |
| Read a block of data into an array.
|
|
template<std::size_t kArraySize> |
auto | read (std::array< Element, kArraySize > &array) -> void |
| Read a block of data into an array.
|
|
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_volatile_t<std::iter_value_t<Iterator>>, Element> |
auto | read (Iterator first, Sentinel last) -> void |
| Read a block of data into an iterator range.
|
|
auto | read (Element *buffer, std::size_t size) -> void |
| Read a block of data into a buffer.
|
|
template<Element... kTerminations>
requires (!tools::CharType<Element>) |
auto | readUntil () -> core::RawVector< Element > |
| Reads all elements until a termination is found.
|
|
template<tools::Allocator< Element > Allocator, Element... kTerminations>
requires (!tools::CharType<Element>) |
auto | readUntil (const Allocator &allocator=Allocator()) -> core::RawVector< Element, Allocator > |
| Reads all elements until a termination is found.
|
|
template<tools::Allocator< Element > Allocator = std::allocator<Element>, std::predicate< Element > Predicate>
requires (!tools::CharType<Element>) |
auto | readUntil (Predicate predicate, const Allocator &allocator=Allocator()) -> core::RawVector< Element, Allocator > |
| Skips all elements until a termination element that fits a predicate.
|
|
template<Element... kTerminations>
requires tools::CharType<Element> |
auto | readUntil () -> std::basic_string< Element > |
| Reads all characters until a termination is found.
|
|
template<typename CharTraits , Element... kTerminations>
requires tools::CharType<Element> |
auto | readUntil () -> std::basic_string< Element, CharTraits > |
| Reads all characters until a termination is found.
|
|
template<typename CharTraits , tools::Allocator< Element > Allocator, Element... kTerminations>
requires tools::CharType<Element> |
auto | readUntil (const Allocator &allocator=Allocator()) -> std::basic_string< Element, CharTraits, Allocator > |
| Reads all characters until a termination is found.
|
|
template<typename CharTraits = std::char_traits<Element>, tools::Allocator< Element > Allocator = std::allocator<Element>, std::predicate< Element > Predicate>
requires tools::CharType<Element> |
auto | readUntil (Predicate predicate, const Allocator &allocator=Allocator()) -> std::basic_string< Element, CharTraits, Allocator > |
| Skips all characters until a termination character that fits a predicate.
|
|
auto | skipElement () -> void |
| Skips a single element from the stream.
|
|
auto | trySkipElement () -> bool |
| Tries to skip a single element from a stream.
|
|
auto | skip (std::size_t size) -> void |
| Skips a block of data.
|
|
template<Element... kSkippableElements> |
auto | skipWhile () -> std::size_t |
| Skips all elements than appear in a list of skippable elements.
|
|
template<std::predicate< Element > Predicate> |
auto | skipWhile (Predicate predicate) -> std::size_t |
| Skips all elements that fit a predicate.
|
|
auto | readPosition () const -> std::optional< ReadPosition > |
| Gets the current read position within the stream.
|
|
auto | setReadPosition (ReadPosition position) -> void |
| Sets the current read position within the device.
|
|
auto | rewind () -> void |
| Sets the current read position to the beginning of the stream.
|
|
template<typename CharTraits = std::char_traits<Element>, tools::Allocator< Element > Allocator = std::allocator<Element>>
requires tools::CharType<Element> |
auto | readLine (const Allocator &allocator=Allocator()) -> std::basic_string< Element, CharTraits, Allocator > |
| Reads a single line.
|
|
auto | skipLine () -> std::size_t |
| Skips the rest of the line.
|
|
template<typename CharTraits = std::char_traits<Element>, tools::Allocator< Element > Allocator = std::allocator<Element>>
requires tools::CharType<Element> |
auto | readWord (const Allocator &allocator=Allocator()) -> std::basic_string< Element, CharTraits, Allocator > |
| Reads a single whitespace-separated word.
|
|
auto | skipWord () -> std::size_t |
| Skips the rest of a whitespace-separated word.
|
|
auto | skipLineEnding () -> bool |
| Skips a single line termination.
|
|
auto | skipWhitespace () -> bool |
| Skips all ASCII whitespace elements.
|
|
auto | readByte () -> Element |
| Alternate name for readElement()
|
|
auto | tryReadByte () -> std::optional< Element > |
| Alternate name for tryReadElement()
|
|
template<Element kNoMoreData>
requires (!tools::CharType<Element>) |
auto | readByteOr () -> Element |
| Alternate name for readElementOr()
|
|
template<Element... kAllowedElements>
requires (!tools::CharType<Element>) |
auto | readByteIf () -> std::optional< Element > |
| Alternate name for readElementIf()
|
|
template<std::predicate< Element > Predicate>
requires (!tools::CharType<Element>) |
auto | readByteIf (Predicate predicate) -> std::optional< Element > |
| Alternate name for readElementIf().
|
|
template<Element kFallback, Element... kAllowedElements>
requires (!tools::CharType<Element>) |
auto | readByteIfOr () -> Element |
| Alternate name for readElementIfOr()
|
|
template<Element kFallback, std::predicate< Element > Predicate>
requires (!tools::CharType<Element>) |
auto | readByteIfOr (Predicate predicate) -> Element |
| Alternate name for readElementIfOr().
|
|
auto | skipByte () -> void |
| Alternate name for skipElement()
|
|
auto | trySkipByte () -> bool |
| Alternate name for trySkipElement() for character streams.
|
|
auto | readChar () -> Element |
| Alternate name for readElement()
|
|
auto | tryReadChar () -> std::optional< Element > |
| Alternate name for tryReadElement()
|
|
template<Element kNoMoreData>
requires tools::CharType<Element> |
auto | readCharOr () -> Element |
| Alternate name for readElementOr()
|
|
template<Element... kAllowedElements>
requires tools::CharType<Element> |
auto | readCharIf () -> std::optional< Element > |
| Alternate name for readElementIf()
|
|
template<std::predicate< Element > Predicate>
requires tools::CharType<Element> |
auto | readCharIf (Predicate predicate) -> std::optional< Element > |
| Alternate name for readElementIf().
|
|
template<Element kFallback, Element... kAllowedElements>
requires tools::CharType<Element> |
auto | readCharIfOr () -> Element |
| Alternate name for readElementIfOr()
|
|
template<Element kFallback, std::predicate< Element > Predicate>
requires tools::CharType<Element> |
auto | readCharIfOr (Predicate predicate) -> Element |
| Alternate name for readElementIfOr().
|
|
auto | skipChar () -> void |
| Alternate name for skipElement()
|
|
auto | trySkipChar () -> bool |
| Alternate name for trySkipElement() for character streams.
|
|
auto | waitForData () -> void |
| Waits for more read data to become available.
|
|
auto | waitForData (std::optional< std::chrono::nanoseconds > timeout) -> bool |
| Waits for more read data to become available within a certain time.
|
|
virtual | ~StreamBase () noexcept(false)=0 |
| Virtual, throwing destructor.
|
|
auto | streamDescription () const -> std::string |
| Get a description of the device.
|
|
| AbstractBufferedOutputStream ()=default |
| Default constructor Creates a stream without a buffer.
|
|
virtual | ~OutputStream () noexcept(false)=0 |
| Virtual, throwing destructor.
|
|
auto | write (Element element) -> void |
| Write a single element to the stream.
|
|
template<std::ranges::contiguous_range Data>
requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, Element> |
auto | write (const Data &data) -> void |
| Write a block of data.
|
|
template<std::size_t kDataSize> |
auto | write (const Element(&data)[kDataSize]) -> void |
| Write a block of data contained in an array.
|
|
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, Element> |
auto | write (Iterator first, Sentinel last) -> void |
| Write a block of data contained in an iterator range.
|
|
auto | write (const Element *data, std::size_t size) -> void |
| Write a block of data contained in a region of memory.
|
|
auto | write (const Element *nullTerminatedString) -> void |
| Write a NULL-teminated string.
|
|
auto | flush () -> void |
| Flushes the buffer.
|
|
|
auto | doGetStreamDescription () const -> std::string final |
| Implementation of InputStream::doGetStreamDescription()
|
|
virtual auto | inputDevice () noexcept -> InputDevice &=0 |
| Called by the framework to get the device.
|
|
auto | doRead (Element *buffer, std::size_t size, bool waitForData) -> std::optional< std::size_t > final |
| Implementation of InputStream::doRead()
|
|
virtual auto | doThrowEndOfStreamError () const -> void final |
| Implementation of InputStream::doRead()
|
|
auto | doWaitForData (std::optional< std::chrono::nanoseconds > timeout) -> bool final |
| Implementation of InputStream::doWaitForData()
|
|
auto | doGetReadPosition () const -> std::optional< std::size_t > final |
| Implementation of InputStream::doGetReadPosition()
|
|
auto | doSetReadPosition (std::size_t position) -> bool final |
| Implementation of InputStream::doSetReadPosition()
|
|
auto | doAdvanceReadPosition (std::size_t offset) -> std::optional< std::size_t > final |
| Implementation of InputStream::doAdvanceReadPosition()
|
|
auto | resetInputBuffer (std::size_t bufferSizeHint=kDefaultBufferSize) -> void |
| Resets the buffer.
|
|
auto | destroyInputBuffer () -> void |
| Destroys the buffer.
|
|
| InputStream () noexcept=default |
| Default constructor.
|
|
| InputStream (Element *bufferBegin, Element *bufferEnd) noexcept |
| Constructor that sets an initially empty buffer.
|
|
| InputStream (Element *bufferBegin, Element *bufferEnd, Element *dataBegin, Element *dataEnd) noexcept |
| Constructor that sets a buffer that possibly already contains some data.
|
|
| InputStream (InputStream &&other) noexcept |
| Move constructor.
|
|
auto | operator= (InputStream &&rhs) noexcept -> InputStream & |
| Move assignemnt operator.
|
|
auto | setReadBuffer (Element *bufferBegin, Element *bufferEnd) noexcept -> void |
| Sets a new empty buffer.
|
|
auto | setReadBuffer (Element *bufferBegin, Element *bufferEnd, Element *dataBegin, Element *dataEnd) noexcept -> void |
| Sets the buffer.
|
|
auto | setReadData (Element *dataBegin, Element *dataEnd) noexcept -> void |
| Sets the position of the data within the buffer.
|
|
auto | readBufferBegin () const -> Element * |
| Reads back the buffer start position.
|
|
auto | readBufferEnd () const -> Element * |
| Reads back the buffer end position.
|
|
auto | readBufferSize () const -> std::size_t |
| Gets the buffer size.
|
|
auto | readDataBegin () const -> Element * |
| Returns the beginning of the unconsumed data in the buffer.
|
|
auto | readDataEnd () const -> Element * |
| Returns the end of the data in the buffer.
|
|
auto | readDataSize () const -> std::size_t |
| Returns the size of the unconsumed data in the buffer.
|
|
virtual auto | doReplenishReadBuffer (bool waitForData) -> bool |
| Called by the framework to place more data into the buffer when it is exhausted.
|
|
virtual auto | outputDevice () noexcept -> OutputDevice &=0 |
| Called by the framework to get the device.
|
|
auto | doWrite (const Element *data, std::size_t size) -> std::size_t final |
| Implementation of InputStream::doWrite()
|
|
auto | resetOutputBuffer (std::size_t bufferSizeHint=kDefaultBufferSize) -> void |
| Resets the buffer.
|
|
auto | destroyOutputBuffer () -> void |
| Destroys the buffer.
|
|
| OutputStream () noexcept=default |
| Default constructor.
|
|
| OutputStream (Element *bufferBegin, Element *bufferEnd) noexcept |
| Constructor that sets an initially empty buffer.
|
|
| OutputStream (Element *bufferBegin, Element *bufferEnd, Element *dataEnd) noexcept |
| Constructor that sets a buffer that possibly already contains some data.
|
|
| OutputStream (OutputStream &&other) noexcept |
| Move constructor.
|
|
auto | operator= (OutputStream &&rhs) noexcept -> OutputStream & |
| Move assignemnt operator.
|
|
auto | setWriteBuffer (Element *bufferBegin, Element *bufferEnd) noexcept -> void |
| Sets a new empty buffer.
|
|
auto | setWriteBuffer (Element *bufferBegin, Element *bufferEnd, Element *dataEnd) noexcept -> void |
| Sets the buffer.
|
|
auto | setWriteDataEnd (Element *dataEnd) noexcept -> void |
| Sets the end of the data within the buffer.
|
|
auto | writeBufferBegin () const -> Element * |
| Writes back the buffer start position.
|
|
auto | writeBufferEnd () const -> Element * |
| Writes back the buffer end position.
|
|
auto | writeBufferSize () const -> std::size_t |
| Gets the buffer size.
|
|
auto | writeDataBegin () const -> Element * |
| Returns the beginning of data in the buffer.
|
|
auto | writeDataEnd () const -> Element * |
| Returns the end of the data in the buffer.
|
|
auto | writeDataSize () const -> std::size_t |
| Returns the size of the unwritten data in the buffer.
|
|
auto | freeBufferBegin () const -> Element * |
| Returns the beginning of the free region of the buffer.
|
|
auto | freeBufferSize () const -> std::size_t |
| Returns the size of the unwritten data in the buffer.
|
|
virtual auto | doFlushWriteBuffer () -> void |
| Called by the framework to write the buffered data to the underlying device once it is full.
|
|