MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
reader.hpp File Reference
Include dependency graph for io/reader.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mtcore::io::Reader< Impl >
 A reader that reads data from some sort of stream or buffer Note: the data elements read should be trivially constructible, trivially destructible, and trivially copyable. More...
 

Namespaces

namespace  mtcore
 Core library for C++ with Zig-related functionality.
 
namespace  mtcore::io
 
namespace  mtcore::io::readers
 Additional algorithms that can be done on a reader without having to extend the reader type We're encouraging this method of extending readers to avoid readers from becoming incredibly large, and to create a standardized extension mechanism to allow 3rd party extensions of readers.
 

Typedefs

template<ReaderImpl RI>
using mtcore::io::readers::Reader = Reader<RI>
 

Enumerations

enum class  mtcore::io::SliceReaderError { mtcore::io::SliceReaderError::END_OF_FILE , mtcore::io::SliceReaderError::ALLOCATION_FAILED , mtcore::io::SliceReaderError::SIZE_EXCEEDED }
 Errors that can happen from the Slice Reader Note that these are all required by the Reader class as some methods there may allocate. More...
 

Functions

template<typename T>
Result< typename Reader< T >::ResSlice, typename Reader< T >::ErrType > mtcore::io::readers::read_until_or_eof (Reader< T > &self, typename Reader< T >::BuffSlice buff, const std::remove_const_t< typename Reader< T >::ReadElem > &delim)
 Reads data from a reader into a Slice up until there is either a delimiter or end of file If the buffer is not big enough, the error SIZE_EXCEEDED will be returned.
 
template<typename T>
Result< typename Reader< T >::BuffSlice, typename Reader< T >::ErrType > mtcore::io::readers::read_until_or_eof (Reader< T > &self, Allocator &alloc, const std::remove_const_t< typename Reader< T >::ReadElem > &delim, size_t maxSize=std::numeric_limits< size_t >::max())
 Reads data from a reader into an allocated Slice up until there is either a delimiter or end of file If the buffer is not big enough, the error SIZE_EXCEEDED will be returned Will return a Slice that the caller MUST clean up with alloc.destroy_many() Will try to shrink internal buffer before returning.
 
template<typename T>
Result< typename Reader< T >::ResSlice, typename Reader< T >::ErrType > mtcore::io::readers::read_until_no_eof (Reader< T > &self, typename Reader< T >::BuffSlice buff, const std::remove_const_t< typename Reader< T >::ReadElem > &delim)
 Reads data from a reader into a Slice up until there is either a delimiter If the buffer is not big enough, the error SIZE_EXCEEDED will be returned If the end of file is reached, the error END_OF_FILE will be returned.
 
template<typename T>
Result< typename Reader< T >::BuffSlice, typename Reader< T >::ErrType > mtcore::io::readers::read_until_no_eof (Reader< T > &self, Allocator &alloc, const std::remove_const_t< typename Reader< T >::ReadElem > &delim, size_t maxSize=std::numeric_limits< size_t >::max())
 Reads data from a reader into an allocated Slice up until there is either a delimiter If the buffer is not big enough, the error SIZE_EXCEEDED will be returned If the end of file is reached, the error END_OF_FILE will be returned Will return a Slice that the caller MUST clean up with alloc.destroy_many() Will try to shrink internal buffer before returning.
 
template<typename T>
Reader< impl::SliceReaderImpl< T > > mtcore::io::slice_reader (Slice< T > buff)
 Creates a reader to read the contents of a Slice.