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

Source wrapper that buffers the input. More...

#include <staticlib/io/buffered_source.hpp>

Public Member Functions

 buffered_source (Source &&src)
 Constructor, created source wrapper will own specified source.
 buffered_source (const buffered_source &)
 Deleted copy constructor.
buffered_source & operator= (const buffered_source &)
 Deleted copy assignment operator.
 buffered_source (buffered_source &&other) STATICLIB_NOEXCEPT
 Move constructor.
buffered_source & operator= (buffered_source &&other) STATICLIB_NOEXCEPT
 Move assignment operator.
std::streamsize read (span< char > span)
 Buffered read implementation.
std::string read_line (const std::string &ending="\n", size_t max_length=(1<< 16))
 Reads underlying source until specified line ending is met or length threshold exceeded.
Source & get_source ()
 Underlying source accessor.
std::array< char, buf_size > & get_buffer ()
 Buffer accessor.

Detailed Description

template<typename Source, std::size_t buf_size = 4096>
class staticlib::io::buffered_source< Source, buf_size >

Source wrapper that buffers the input.

Constructor & Destructor Documentation

template<typename Source, std::size_t buf_size = 4096>
staticlib::io::buffered_source< Source, buf_size >::buffered_source ( Source &&  src)
inlineexplicit

Constructor, created source wrapper will own specified source.

Parameters
srcinput source
template<typename Source, std::size_t buf_size = 4096>
staticlib::io::buffered_source< Source, buf_size >::buffered_source ( const buffered_source< Source, buf_size > &  )

Deleted copy constructor.

Parameters
otherinstance
template<typename Source, std::size_t buf_size = 4096>
staticlib::io::buffered_source< Source, buf_size >::buffered_source ( buffered_source< Source, buf_size > &&  other)
inline

Move constructor.

Parameters
otherother instance

Member Function Documentation

template<typename Source, std::size_t buf_size = 4096>
std::array<char, buf_size>& staticlib::io::buffered_source< Source, buf_size >::get_buffer ( )
inline

Buffer accessor.

Returns
buffer reference
template<typename Source, std::size_t buf_size = 4096>
Source& staticlib::io::buffered_source< Source, buf_size >::get_source ( )
inline

Underlying source accessor.

Returns
underlying source reference
template<typename Source, std::size_t buf_size = 4096>
buffered_source& staticlib::io::buffered_source< Source, buf_size >::operator= ( const buffered_source< Source, buf_size > &  )

Deleted copy assignment operator.

Parameters
otherinstance
Returns
this instance
template<typename Source, std::size_t buf_size = 4096>
buffered_source& staticlib::io::buffered_source< Source, buf_size >::operator= ( buffered_source< Source, buf_size > &&  other)
inline

Move assignment operator.

Parameters
otherother instance
Returns
this instance
template<typename Source, std::size_t buf_size = 4096>
std::streamsize staticlib::io::buffered_source< Source, buf_size >::read ( span< char >  span)
inline

Buffered read implementation.

Parameters
spanbuffer span
Returns
number of bytes processed
template<typename Source, std::size_t buf_size = 4096>
std::string staticlib::io::buffered_source< Source, buf_size >::read_line ( const std::string &  ending = "\n",
size_t  max_length = (1<<16) 
)
inline

Reads underlying source until specified line ending is met or length threshold exceeded.

Lines consisting solely of line endings will be ignored.

Parameters
endingline ending
max_lengthlength threshold
Returns
line without endline separator or empty string on EOF

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