staticlib_io  1.2.11
 All Classes Namespaces Files Functions Variables
Public Member Functions | List of all members
staticlib::io::limited_source< Source > Class Template Reference

Source wrapper that limits the number of bytes read through it and returns EOF on threshold exceed. More...

#include <staticlib/io/limited_source.hpp>

Public Member Functions

 limited_source (Source &&src, size_t limit_bytes)
 Constructor, created source wrapper will own specified source.
 limited_source (const limited_source &)
 Deleted copy constructor.
limited_source & operator= (const limited_source &)
 Deleted copy assignment operator.
 limited_source (limited_source &&other) STATICLIB_NOEXCEPT
 Move constructor.
limited_source & operator= (limited_source &&other) STATICLIB_NOEXCEPT
 Move assignment operator.
std::streamsize read (span< char > origin_span)
 Counting read implementation.
size_t get_count ()
 Returns number of bytes read through this instance.
Source & get_source ()
 Underlying source accessor.

Detailed Description

template<typename Source>
class staticlib::io::limited_source< Source >

Source wrapper that limits the number of bytes read through it and returns EOF on threshold exceed.

Constructor & Destructor Documentation

template<typename Source >
staticlib::io::limited_source< Source >::limited_source ( Source &&  src,
size_t  limit_bytes 
)
inline

Constructor, created source wrapper will own specified source.

Parameters
srcinput source
limit_bytesmax number of bytes allowed to be read from this source
template<typename Source >
staticlib::io::limited_source< Source >::limited_source ( const limited_source< Source > &  )

Deleted copy constructor.

Parameters
otherinstance
template<typename Source >
staticlib::io::limited_source< Source >::limited_source ( limited_source< Source > &&  other)
inline

Move constructor.

Parameters
otherother instance

Member Function Documentation

template<typename Source >
size_t staticlib::io::limited_source< Source >::get_count ( )
inline

Returns number of bytes read through this instance.

Returns
number of bytes read through this instance
template<typename Source >
Source& staticlib::io::limited_source< Source >::get_source ( )
inline

Underlying source accessor.

Returns
underlying source reference
template<typename Source >
limited_source& staticlib::io::limited_source< Source >::operator= ( const limited_source< Source > &  )

Deleted copy assignment operator.

Parameters
otherinstance
Returns
this instance
template<typename Source >
limited_source& staticlib::io::limited_source< Source >::operator= ( limited_source< Source > &&  other)
inline

Move assignment operator.

Parameters
otherother instance
Returns
this instance
template<typename Source >
std::streamsize staticlib::io::limited_source< Source >::read ( span< char >  origin_span)
inline

Counting read implementation.

Parameters
spanbuffer span
Returns
number of bytes processed

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