|
StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
|
Abstract base class for implementing external data readers. More...
#include <reader.hxx>


Public Member Functions | |
| Reader () noexcept=default | |
| Default constructor. | |
| Reader (const Reader &other)=default | |
| Copy constructor. | |
| Reader (Reader &&other) noexcept=default | |
| Move constructor. | |
| virtual | ~Reader () noexcept=default |
| Destructor. | |
| Reader & | operator= (const Reader &other)=default |
| Copy assignment operator. | |
| Reader & | operator= (Reader &&other) noexcept=default |
| Move assignment operator. | |
| virtual Expected< Buffer::Simple, Buffer::Exception > | Read (const size_t &min=0) const noexcept=0 |
| Reads data from an external source. | |
Public Member Functions inherited from StormByte::Clonable< Reader > | |
| constexpr | Clonable ()=default |
| constexpr | Clonable (const Clonable &)=default |
| constexpr | Clonable (Clonable &&) noexcept=default |
| constexpr Clonable & | operator= (const Clonable &)=default |
| constexpr Clonable & | operator= (Clonable &&) noexcept=default |
| virtual constexpr | ~Clonable () noexcept=default |
| virtual PointerType | Clone () const=0 |
| virtual PointerType | Move ()=0 |
Additional Inherited Members | |
Public Types inherited from StormByte::Clonable< Reader > | |
| using | PointerType = std::shared_ptr< Reader > |
| Pointer type. | |
Static Public Member Functions inherited from StormByte::Clonable< Reader > | |
| static PointerType | MakePointer (Args &&... args) |
Abstract base class for implementing external data readers.
The Reader class provides an interface for reading external data into a buffer. It is designed to be used with the External buffer, enabling dynamic data retrieval from external sources such as files, network streams, or other producers.
Key Features:
Read() method that must be implemented by derived classes.Buffer::Simple object or throwing a Buffer::Exception in case of errors.This class is ideal for scenarios where data needs to be fetched dynamically from external sources and integrated into the External buffer.
|
defaultnoexcept |
Default constructor.
Initializes a Reader instance. Derived classes should implement the Read() method to provide specific functionality for reading external data.
Copy constructor.
| other | The Reader instance to copy from. |
|
defaultnoexcept |
Move constructor.
| other | The Reader instance to move from. |
|
virtualdefaultnoexcept |
Destructor.
Cleans up the Reader instance. Derived classes should ensure that any resources used for external data retrieval are properly released.
|
pure virtualnoexcept |
Reads data from an external source.
| min | The minimum number of bytes to read (0 to read any available bytes). |
Expected<Buffer::Simple, Buffer::Exception> containing the read data or an exception.This method must be implemented by derived classes to provide functionality for reading data from an external source. The returned data is encapsulated in a Buffer::Simple object.
Behavior:
Buffer::Simple object.Unexpected<Buffer::Exception> should be returned.Buffer::Simple object with no data) is considered a valid response.Error Handling:
Unexpected<Buffer::Exception> to signal errors.Buffer::Exception provides details about the error, such as the reason for failure.Usage: This method is typically called by the External buffer to dynamically fetch or generate data before performing read operations.