#include <ExternalDataSource.h>
Public Member Functions | |
ExternalDataSource (FILE *inputfile=0, FILE *outputfile=0) | |
Create a new instance. | |
virtual | ~ExternalDataSource () |
Implicitly close the connection. | |
bool | send (const char *buffer, size_t length) |
Send some data to the output stream. | |
bool | send (std::string s) |
Send some data down the stream. | |
size_t | receive (char *buffer, size_t length) |
Read some data from the input stream. | |
std::string | receiveLine () |
Read one line from the input stream. | |
std::string | receiveUpto (char c) |
Read characters into a string until character c is read. | |
void | setBlocking (bool mode) |
Set the blocking mode of the input stream. | |
virtual int | close () |
Close the input and output streams. | |
FILE * | inputFile () const |
Return the input stream. | |
FILE * | outputFile () const |
Return the output stream. | |
Protected Attributes | |
FILE * | inputfile |
FILE * | outputfile |
Private Attributes | |
char * | linebuffer |
size_t | linebuffer_size |
Definition at line 28 of file ExternalDataSource.h.
zypp::externalprogram::ExternalDataSource::ExternalDataSource | ( | FILE * | inputfile = 0 , |
|
FILE * | outputfile = 0 | |||
) |
Create a new instance.
inputfile | The stream for reading | |
outputfile | The stream for writing Either can be NULL if no reading/writing is allowed. |
Definition at line 37 of file ExternalDataSource.cc.
zypp::externalprogram::ExternalDataSource::~ExternalDataSource | ( | ) | [virtual] |
Implicitly close the connection.
Definition at line 46 of file ExternalDataSource.cc.
References close(), and linebuffer.
bool zypp::externalprogram::ExternalDataSource::send | ( | const char * | buffer, | |
size_t | length | |||
) |
Send some data to the output stream.
buffer | The data to send | |
length | The size of it |
Definition at line 55 of file ExternalDataSource.cc.
References outputfile.
Referenced by send().
bool zypp::externalprogram::ExternalDataSource::send | ( | std::string | s | ) |
Send some data down the stream.
string | The data to send |
Definition at line 68 of file ExternalDataSource.cc.
size_t zypp::externalprogram::ExternalDataSource::receive | ( | char * | buffer, | |
size_t | length | |||
) |
Read some data from the input stream.
buffer | Where to put the data | |
length | How much to read at most Returns the amount actually received |
Definition at line 95 of file ExternalDataSource.cc.
References inputfile.
string zypp::externalprogram::ExternalDataSource::receiveLine | ( | ) |
Read one line from the input stream.
Returns the line read, including the terminator.
Definition at line 129 of file ExternalDataSource.cc.
References zypp::iostr::getline(), inputfile, linebuffer, and linebuffer_size.
Referenced by zypp::RepoManager::buildCache(), zypp::CheckAccessDeleted::check(), zypp::filesystem::clean_dir(), zypp::filesystem::copy(), zypp::filesystem::copy_dir(), zypp::filesystem::copy_dir_content(), zypp::filesystem::copy_file2dir(), zypp::target::rpm::diffFiles(), zypp::debug::dumpMemOn(), zypp::KeyRing::Impl::dumpPublicKey(), zypp::media::MediaISO::findUnusedLoopDevice(), zypp::target::generateRandomId(), zypp::media::MediaAria2c::getAria2cVersion(), zypp::media::MediaAria2c::getFileCopy(), zypp::RepoInfo::getLicense(), zypp::RepoInfo::getLicenseLocales(), zypp::media::Mount::mount(), zypp::media::MediaCD::openTray(), zypp::ExternalProgram::operator>>(), zypp::KeyRing::Impl::publicKeyIds(), zypp::PublicKey::Impl::readFromFile(), zypp::KeyRing::Impl::readSignatureKeyId(), zypp::media::Mount::umount(), and zypp::media::MediaDISK::verifyIfDiskVolume().
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 76 of file ExternalDataSource.cc.
References inputfile.
void zypp::externalprogram::ExternalDataSource::setBlocking | ( | bool | mode | ) |
Set the blocking mode of the input stream.
mode | True if the reader should be blocked waiting for input. This is the initial default. |
Definition at line 103 of file ExternalDataSource.cc.
References ERR, inputfile, and zypp::str::strerror().
Referenced by zypp::ExternalProgram::close(), and zypp::ExternalProgram::operator>>().
int zypp::externalprogram::ExternalDataSource::close | ( | ) | [virtual] |
Close the input and output streams.
Reimplemented in zypp::ExternalProgram.
Definition at line 145 of file ExternalDataSource.cc.
References inputfile, and outputfile.
Referenced by ~ExternalDataSource().
FILE* zypp::externalprogram::ExternalDataSource::inputFile | ( | ) | const [inline] |
Return the input stream.
Definition at line 99 of file ExternalDataSource.h.
References inputfile.
Referenced by zypp::ExternalProgram::close().
FILE* zypp::externalprogram::ExternalDataSource::outputFile | ( | ) | const [inline] |
Return the output stream.
Definition at line 104 of file ExternalDataSource.h.
References outputfile.
FILE* zypp::externalprogram::ExternalDataSource::inputfile [protected] |
Definition at line 31 of file ExternalDataSource.h.
Referenced by zypp::ExternalProgram::close(), close(), inputFile(), receive(), receiveLine(), receiveUpto(), setBlocking(), and zypp::ExternalProgram::start_program().
FILE* zypp::externalprogram::ExternalDataSource::outputfile [protected] |
Definition at line 32 of file ExternalDataSource.h.
Referenced by close(), outputFile(), send(), and zypp::ExternalProgram::start_program().
char* zypp::externalprogram::ExternalDataSource::linebuffer [private] |
Definition at line 35 of file ExternalDataSource.h.
Referenced by zypp::ExternalProgram::close(), receiveLine(), and ~ExternalDataSource().
size_t zypp::externalprogram::ExternalDataSource::linebuffer_size [private] |
Definition at line 36 of file ExternalDataSource.h.
Referenced by zypp::ExternalProgram::close(), and receiveLine().