MySQL 8.0.40
Source Code Documentation
Stdin_istream Class Reference

A stdin input stream based on IO_CACHE. More...

#include <basic_istream.h>

Inheritance diagram for Stdin_istream:
[legend]

Public Member Functions

 Stdin_istream ()
 
 Stdin_istream (const Stdin_istream &)=delete
 
Stdin_istreamoperator= (const Stdin_istream &)=delete
 
 ~Stdin_istream () override
 
bool open (std::string *errmsg)
 Opens the stdin stream. More...
 
void close ()
 Closes the stream. More...
 
ssize_t read (unsigned char *buffer, size_t length) override
 Read some bytes from the input stream. More...
 
bool skip (my_off_t bytes)
 Skip bytes data from the stdin stream. More...
 
- Public Member Functions inherited from Basic_istream
virtual ~Basic_istream ()=default
 

Private Attributes

IO_CACHE m_io_cache
 

Detailed Description

A stdin input stream based on IO_CACHE.

It provides a Basic_istream based on stdin.

Constructor & Destructor Documentation

◆ Stdin_istream() [1/2]

Stdin_istream::Stdin_istream ( )
default

◆ Stdin_istream() [2/2]

Stdin_istream::Stdin_istream ( const Stdin_istream )
delete

◆ ~Stdin_istream()

Stdin_istream::~Stdin_istream ( )
override

Member Function Documentation

◆ close()

void Stdin_istream::close ( )

Closes the stream.

It deinitializes IO_CACHE.

◆ open()

bool Stdin_istream::open ( std::string *  errmsg)

Opens the stdin stream.

It initializes the IO_CACHE with stdin.

Parameters
[out]errmsgAn error message is returned if any error happens.

◆ operator=()

Stdin_istream & Stdin_istream::operator= ( const Stdin_istream )
delete

◆ read()

ssize_t Stdin_istream::read ( unsigned char *  buffer,
size_t  length 
)
overridevirtual

Read some bytes from the input stream.

It should read exact 'length' bytes unless error happens or it reaches the end of the stream. It should block when reaching the end of a pipe that is not closed.

Parameters
[out]bufferWhere data will be put in.
[in]lengthThe number of bytes that you want to read. length should not be larger than max long.
Returns
Return values fall into three cases:
Return values
'length'Read 'length' bytes successfully
>=0Reach EOF, return the number of bytes actually read. It is between 0 and length-1.
-1Error.

Implements Basic_istream.

◆ skip()

bool Stdin_istream::skip ( my_off_t  bytes)

Skip bytes data from the stdin stream.

Parameters
[in]bytesHow many bytes should be skipped

Member Data Documentation

◆ m_io_cache

IO_CACHE Stdin_istream::m_io_cache
private

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