CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | Friends | List of all members
CppCommon::StdInput Class Reference

Standard input stream. More...

#include <stream.h>

Inheritance diagram for CppCommon::StdInput:
CppCommon::Reader

Public Member Functions

 StdInput ()
 
 StdInput (const StdInput &)=delete
 
 StdInput (StdInput &&stream)=delete
 
virtual ~StdInput ()
 
StdInputoperator= (const StdInput &)=delete
 
StdInputoperator= (StdInput &&stream)=delete
 
 operator bool () const noexcept
 Check if the stream is valid. More...
 
void * stream () const noexcept
 Get the native stream handler. More...
 
bool IsValid () const noexcept
 Is stream valid? More...
 
size_t Read (void *buffer, size_t size) override
 Read a bytes buffer from the stream. More...
 
void swap (StdInput &stream) noexcept
 Swap two instances. More...
 
std::vector< uint8_t > ReadAllBytes ()
 Read all bytes. More...
 
std::string ReadAllText ()
 Read all text. More...
 
std::vector< std::string > ReadAllLines ()
 Read all text lines. More...
 
- Public Member Functions inherited from CppCommon::Reader
 Reader () noexcept=default
 
 Reader (const Reader &) noexcept=default
 
 Reader (Reader &&) noexcept=default
 
virtual ~Reader () noexcept=default
 
Readeroperator= (const Reader &) noexcept=default
 
Readeroperator= (Reader &&) noexcept=default
 
std::vector< uint8_t > ReadAllBytes ()
 Read all bytes. More...
 
std::string ReadAllText ()
 Read all text. More...
 
std::vector< std::string > ReadAllLines ()
 Read all text lines. More...
 

Friends

void swap (StdInput &stream1, StdInput &stream2) noexcept
 

Detailed Description

Standard input stream.

Thread-safe.

Definition at line 24 of file stream.h.

Constructor & Destructor Documentation

◆ StdInput() [1/3]

CppCommon::StdInput::StdInput ( )

Definition at line 235 of file stream.cpp.

◆ StdInput() [2/3]

CppCommon::StdInput::StdInput ( const StdInput )
delete

◆ StdInput() [3/3]

CppCommon::StdInput::StdInput ( StdInput &&  stream)
delete

◆ ~StdInput()

CppCommon::StdInput::~StdInput ( )
virtual

Definition at line 246 of file stream.cpp.

Member Function Documentation

◆ IsValid()

bool CppCommon::StdInput::IsValid ( ) const
noexcept

Is stream valid?

Definition at line 253 of file stream.cpp.

◆ operator bool()

CppCommon::StdInput::operator bool ( ) const
inlineexplicitnoexcept

Check if the stream is valid.

Definition at line 36 of file stream.h.

◆ operator=() [1/2]

StdInput& CppCommon::StdInput::operator= ( const StdInput )
delete

◆ operator=() [2/2]

StdInput& CppCommon::StdInput::operator= ( StdInput &&  stream)
delete

◆ Read()

size_t CppCommon::StdInput::Read ( void *  buffer,
size_t  size 
)
overridevirtual

Read a bytes buffer from the stream.

Parameters
buffer- Buffer to read
size- Buffer size
Returns
Count of read bytes

Implements CppCommon::Reader.

Definition at line 254 of file stream.cpp.

◆ ReadAllBytes()

std::vector< uint8_t > CppCommon::Reader::ReadAllBytes

Read all bytes.

Returns
Bytes buffer

Definition at line 46 of file reader.cpp.

◆ ReadAllLines()

std::vector< std::string > CppCommon::Reader::ReadAllLines

Read all text lines.

Returns
Text lines

Definition at line 56 of file reader.cpp.

◆ ReadAllText()

std::string CppCommon::Reader::ReadAllText

Read all text.

Returns
Text string

Definition at line 51 of file reader.cpp.

◆ stream()

void * CppCommon::StdInput::stream ( ) const
noexcept

Get the native stream handler.

Definition at line 252 of file stream.cpp.

◆ swap()

void CppCommon::StdInput::swap ( StdInput stream)
noexcept

Swap two instances.

Definition at line 256 of file stream.cpp.

Friends And Related Function Documentation

◆ swap

void swap ( StdInput stream1,
StdInput stream2 
)
friend

Definition at line 11 of file stream.inl.


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