dp_intl 1.0.0
Gettext-compatible internationalization library for C++
dp::intl::Stream Class Referenceabstract

Input stream. More...

#include <dp_intl/stream.h>

Inherited by dp::intl::FileStream.

Public Member Functions

virtual ~Stream ()=default
virtual std::size_t readSome (void *dst, std::size_t dstSize)=0
 Read up to dstSize bytes from the stream and advance the stream position by the number of bytes read.
virtual void setPosition (std::int64_t newPosition)=0
 Set the stream position for the next read operation.

Detailed Description

Input stream.

Although the class methods use types such as size_t and int64_t, the dp_intl library will never read or position the stream beyond the first 100 megabytes. This means that if the underlying API used for a concrete Stream is limited to 32-bit integer types, you don't need to handle edge cases like integer overflow or wrap-around.

Constructor & Destructor Documentation

◆ ~Stream()

virtual dp::intl::Stream::~Stream ( )
virtualdefault

Member Function Documentation

◆ readSome()

virtual std::size_t dp::intl::Stream::readSome ( void * dst,
std::size_t dstSize )
pure virtual

Read up to dstSize bytes from the stream and advance the stream position by the number of bytes read.

Returns
The number of bytes read, which can be less than dstSize if the end of the stream is reached.
Exceptions
dp::intl::Error

Implemented in dp::intl::FileStream.

◆ setPosition()

virtual void dp::intl::Stream::setPosition ( std::int64_t newPosition)
pure virtual

Set the stream position for the next read operation.

newPosition is relative to the beginning of the stream. dp_intl will never call this method with a negative newPosition.

Exceptions
dp::intl::Error

Implemented in dp::intl::FileStream.


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