dp_intl 1.0.0
Gettext-compatible internationalization library for C++
dp::intl::FileStream Class Reference

File stream. More...

#include <dp_intl/file_stream.h>

Inherits dp::intl::Stream.

Public Member Functions

 FileStream (const std::filesystem::path &path)
 Open a file.
 ~FileStream ()
 FileStream (const FileStream &)=delete
FileStream & operator= (const FileStream &)=delete
 FileStream (FileStream &&)=delete
FileStream & operator= (FileStream &&)=delete
std::size_t readSome (void *dst, std::size_t dstSize) override
 Read up to dstSize bytes from the stream and advance the stream position by the number of bytes read.
void setPosition (std::int64_t newPosition) override
 Set the stream position for the next read operation.
Public Member Functions inherited from dp::intl::Stream
virtual ~Stream ()=default

Detailed Description

File stream.

Constructor & Destructor Documentation

◆ FileStream() [1/3]

dp::intl::FileStream::FileStream ( const std::filesystem::path & path)
explicit

Open a file.

Exceptions
FileNotFoundErrorif the file does not exist, or dp::intl::Error on other errors.

◆ ~FileStream()

dp::intl::FileStream::~FileStream ( )

◆ FileStream() [2/3]

dp::intl::FileStream::FileStream ( const FileStream & )
delete

◆ FileStream() [3/3]

dp::intl::FileStream::FileStream ( FileStream && )
delete

Member Function Documentation

◆ operator=() [1/2]

FileStream & dp::intl::FileStream::operator= ( const FileStream & )
delete

◆ operator=() [2/2]

FileStream & dp::intl::FileStream::operator= ( FileStream && )
delete

◆ readSome()

std::size_t dp::intl::FileStream::readSome ( void * dst,
std::size_t dstSize )
overridevirtual

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

Implements dp::intl::Stream.

◆ setPosition()

void dp::intl::FileStream::setPosition ( std::int64_t newPosition)
overridevirtual

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

Implements dp::intl::Stream.


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