13 #define _GNU_SOURCE 1 // for ::getline 25 #include <zypp-core/base/Logger.h> 26 #include <zypp-core/base/ExternalDataSource.h> 27 #include <zypp-core/AutoDispose.h> 28 #include <zypp-core/zyppng/base/private/linuxhelpers_p.h> 33 namespace externalprogram {
56 bool success = fwrite( buffer, length, 1,
outputfile ) != 0;
68 DBG <<
"send (" << s <<
")";
69 return send( s.data(), s.length() );
78 std::ostringstream datas;
82 if ( readc == EOF )
break;
84 if ( (
char)readc == c )
break;
98 return received.second;
105 return fread( buffer, 1, length,
inputfile );
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::string receiveUpto(char c)
Read characters into a string until delimiter c or EOF is read.
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.
BlockingMode setFILEBlocking(FILE *file, bool mode)
Enables or disabled non blocking mode on a file descriptor.
ExternalDataSource(FILE *inputfile=0, FILE *outputfile=0)
Create a new instance.
std::string getline(std::istream &str)
Read one line from stream.
virtual int close()
Close the input and output streams.
std::pair< ReceiveUpToResult, std::string > receiveUpto(FILE *file, char c, timeout_type timeout, bool failOnUnblockError)
void setBlocking(bool mode)
Set the blocking mode of the input stream.
virtual ~ExternalDataSource()
Implicitly close the connection.
FILE * inputFile() const
Return the input stream.
Easy-to use interface to the ZYPP dependency resolver.
bool send(const char *buffer, size_t length)
Send some data to the output stream.