libzypp  17.23.5
zypp::externalprogram::ExternalDataSource Class Reference

Bidirectional stream to external data. More...

#include <ExternalDataSource.h>

Inheritance diagram for zypp::externalprogram::ExternalDataSource:

Public Member Functions

 ExternalDataSource (FILE *inputfile=0, FILE *outputfile=0)
 Create a new instance. More...
virtual ~ExternalDataSource ()
 Implicitly close the connection. More...
bool send (const char *buffer, size_t length)
 Send some data to the output stream. More...
bool send (std::string s)
 Send some data down the stream. More...
size_t receive (char *buffer, size_t length)
 Read some data from the input stream. More...
std::string receiveLine ()
 Read one line from the input stream. More...
std::string receiveUpto (char c)
 Read characters into a string until character c is read. More...
void setBlocking (bool mode)
 Set the blocking mode of the input stream. More...
virtual int close ()
 Close the input and output streams. More...
FILE * inputFile () const
 Return the input stream. More...
FILE * outputFile () const
 Return the output stream. More...

Protected Attributes

FILE * inputfile
FILE * outputfile

Private Attributes

char * linebuffer
size_t linebuffer_size

Detailed Description

Bidirectional stream to external data.

Definition at line 25 of file ExternalDataSource.h.

Constructor & Destructor Documentation

◆ ExternalDataSource()

zypp::externalprogram::ExternalDataSource::ExternalDataSource ( FILE *  inputfile = 0,
FILE *  outputfile = 0 

Create a new instance.

inputfileThe stream for reading
outputfileThe stream for writing Either can be NULL if no reading/writing is allowed.

Definition at line 34 of file

◆ ~ExternalDataSource()

zypp::externalprogram::ExternalDataSource::~ExternalDataSource ( )

Implicitly close the connection.

Definition at line 43 of file

Member Function Documentation

◆ send() [1/2]

bool zypp::externalprogram::ExternalDataSource::send ( const char *  buffer,
size_t  length 

Send some data to the output stream.

bufferThe data to send
lengthThe size of it

Definition at line 52 of file

◆ send() [2/2]

bool zypp::externalprogram::ExternalDataSource::send ( std::string  s)

Send some data down the stream.

stringThe data to send

Definition at line 65 of file

◆ receive()

size_t zypp::externalprogram::ExternalDataSource::receive ( char *  buffer,
size_t  length 

Read some data from the input stream.

bufferWhere to put the data
lengthHow much to read at most Returns the amount actually received

Definition at line 92 of file

◆ receiveLine()

std::string zypp::externalprogram::ExternalDataSource::receiveLine ( )

Read one line from the input stream.

Returns the line read, including the terminator.

Definition at line 126 of file

◆ receiveUpto()

std::string zypp::externalprogram::ExternalDataSource::receiveUpto ( char  c)

Read characters into a string until character c is read.

C is put at the end of the string.

Definition at line 73 of file

◆ setBlocking()

void zypp::externalprogram::ExternalDataSource::setBlocking ( bool  mode)

Set the blocking mode of the input stream.

modeTrue if the reader should be blocked waiting for input. This is the initial default.

Definition at line 100 of file

◆ close()

int zypp::externalprogram::ExternalDataSource::close ( )

Close the input and output streams.

Reimplemented in zypp::ExternalProgram.

Definition at line 142 of file

◆ inputFile()

FILE* zypp::externalprogram::ExternalDataSource::inputFile ( ) const

Return the input stream.

Definition at line 96 of file ExternalDataSource.h.

◆ outputFile()

FILE* zypp::externalprogram::ExternalDataSource::outputFile ( ) const

Return the output stream.

Definition at line 101 of file ExternalDataSource.h.

Member Data Documentation

◆ inputfile

FILE* zypp::externalprogram::ExternalDataSource::inputfile

Definition at line 28 of file ExternalDataSource.h.

◆ outputfile

FILE* zypp::externalprogram::ExternalDataSource::outputfile

Definition at line 29 of file ExternalDataSource.h.

◆ linebuffer

char* zypp::externalprogram::ExternalDataSource::linebuffer

Definition at line 32 of file ExternalDataSource.h.

◆ linebuffer_size

size_t zypp::externalprogram::ExternalDataSource::linebuffer_size

Definition at line 33 of file ExternalDataSource.h.

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