join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicStreamView< Seekable > Class Template Reference

basic stream view. More...

#include <view.hpp>

Public Types

using ViewPos = std::streampos
 

Public Member Functions

 BasicStreamView (std::istream &in)
 default constructor.
 
 BasicStreamView (const BasicStreamView &other)=delete
 copy constructor.
 
BasicStreamViewoperator= (const BasicStreamView &other)=delete
 copy assignment.
 
 BasicStreamView (BasicStreamView &&other)=delete
 move constructor.
 
BasicStreamViewoperator= (BasicStreamView &&other)=delete
 move assignment.
 
 ~BasicStreamView ()=default
 destroy instance.
 
int peek () const noexcept
 get character without extracting it.
 
int get () noexcept
 extracts character.
 
bool getIf (char expected) noexcept
 extracts expected character.
 
bool getIfNoCase (char expected) noexcept
 extracts expected character (case insensitive, ASCII-only).
 
size_t read (char *buf, size_t count) noexcept
 read characters.
 
void readUntilEscaped (std::string &out) noexcept
 read characters until escaped.
 
int skipWhitespaces () noexcept
 skip whitespaces.
 
int skipWhitespacesAndComments () noexcept
 skip whitespaces and comments.
 
template<bool S = Seekable>
std::enable_if< S, ViewPos >::type tell () const noexcept
 get input position indicator.
 
template<bool S = Seekable>
std::enable_if< S, void >::type seek (ViewPos pos) noexcept
 seek to the specified position.
 

Detailed Description

template<bool Seekable = true>
class join::BasicStreamView< Seekable >

basic stream view.

Member Typedef Documentation

◆ ViewPos

template<bool Seekable = true>
using join::BasicStreamView< Seekable >::ViewPos = std::streampos

Constructor & Destructor Documentation

◆ BasicStreamView() [1/3]

template<bool Seekable = true>
join::BasicStreamView< Seekable >::BasicStreamView ( std::istream & in)
inline

default constructor.

Parameters
ininput stream.

◆ BasicStreamView() [2/3]

template<bool Seekable = true>
join::BasicStreamView< Seekable >::BasicStreamView ( const BasicStreamView< Seekable > & other)
delete

copy constructor.

Parameters
otherobject to copy.

◆ BasicStreamView() [3/3]

template<bool Seekable = true>
join::BasicStreamView< Seekable >::BasicStreamView ( BasicStreamView< Seekable > && other)
delete

move constructor.

Parameters
otherobject to move.

◆ ~BasicStreamView()

template<bool Seekable = true>
join::BasicStreamView< Seekable >::~BasicStreamView ( )
default

destroy instance.

Member Function Documentation

◆ get()

template<bool Seekable = true>
int join::BasicStreamView< Seekable >::get ( )
inlinenoexcept

extracts character.

Returns
extracted character.

◆ getIf()

template<bool Seekable = true>
bool join::BasicStreamView< Seekable >::getIf ( char expected)
inlinenoexcept

extracts expected character.

Parameters
expectedexpected character.
Returns
true if extracted, false otherwise.

◆ getIfNoCase()

template<bool Seekable = true>
bool join::BasicStreamView< Seekable >::getIfNoCase ( char expected)
inlinenoexcept

extracts expected character (case insensitive, ASCII-only).

Parameters
expectedexpected character.
Returns
true if extracted, false otherwise.

◆ operator=() [1/2]

template<bool Seekable = true>
BasicStreamView & join::BasicStreamView< Seekable >::operator= ( BasicStreamView< Seekable > && other)
delete

move assignment.

Parameters
otherobject to move.
Returns
a reference of the current object.

◆ operator=() [2/2]

template<bool Seekable = true>
BasicStreamView & join::BasicStreamView< Seekable >::operator= ( const BasicStreamView< Seekable > & other)
delete

copy assignment.

Parameters
otherobject to copy.
Returns
a reference of the current object.

◆ peek()

template<bool Seekable = true>
int join::BasicStreamView< Seekable >::peek ( ) const
inlinenoexcept

get character without extracting it.

Returns
extracted character.

◆ read()

template<bool Seekable = true>
size_t join::BasicStreamView< Seekable >::read ( char * buf,
size_t count )
inlinenoexcept

read characters.

Parameters
bufoutput buffer.
countnumber of characters to read.
Returns
number of characters read.

◆ readUntilEscaped()

template<bool Seekable = true>
void join::BasicStreamView< Seekable >::readUntilEscaped ( std::string & out)
inlinenoexcept

read characters until escaped.

Parameters
outoutput buffer.

◆ seek()

template<bool Seekable = true>
template<bool S = Seekable>
std::enable_if< S, void >::type join::BasicStreamView< Seekable >::seek ( ViewPos pos)
inlinenoexcept

seek to the specified position.

Parameters
posposition to seek to.

◆ skipWhitespaces()

template<bool Seekable = true>
int join::BasicStreamView< Seekable >::skipWhitespaces ( )
inlinenoexcept

skip whitespaces.

Returns
0 on success, -1 otherwise.

◆ skipWhitespacesAndComments()

template<bool Seekable = true>
int join::BasicStreamView< Seekable >::skipWhitespacesAndComments ( )
inlinenoexcept

skip whitespaces and comments.

Returns
0 on success, -1 otherwise.

◆ tell()

template<bool Seekable = true>
template<bool S = Seekable>
std::enable_if< S, ViewPos >::type join::BasicStreamView< Seekable >::tell ( ) const
inlinenoexcept

get input position indicator.

Returns
current position.

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