21 d->_readChannels.clear();
23 d->_readChannels.push_back(
IOBuffer(
d->_readBufChunkSize ) );
34 d->_readChannels.clear();
47 if ( channel >=
d->_readChannels.size() ) {
53 d->_sigReadChannelFinished.emit( channel );
61 if ( channel >=
d->_readChannels.size() ) {
65 d->_currentReadChannel = channel;
74 return d->_currentReadChannel;
82 return d->_readChannels.size();
124 return readAll(
d->_currentReadChannel );
129 if ( !
canRead() || maxSize <= 0 )
131 return read(
d_func()->_currentReadChannel, maxSize );
139 return read(
d->_currentReadChannel,
buf, maxSize );
157 if ( !
canRead() || maxSize <= 0 )
161 const auto r =
read( channel,
res.data(), maxSize );
169 if ( !
canRead() || maxSize < 0 )
172 if ( channel >=
d->_readChannels.size() ) {
177 int64_t
readSoFar =
d->_readChannels[ channel ].read(
buf, maxSize );
191 if ( !
canRead() || maxSize < 0 )
194 if ( channel >=
d->_readChannels.size() ) {
203 ERR <<
"Calling channelReadUntil with maxSize > int64_t(ByteArray::maxSize) " << std::endl;
212 if ( maxSize == 0 || maxSize >= (
maxBArrSize - 1) ) {
221 result.resize( std::min( std::size_t(maxSize), std::size_t(result.size() +
d->_readBufChunkSize )) );
233 result.resize( maxSize );
245 result.shrink_to_fit();
264 if ( !
canRead() || maxSize < 0 )
267 if ( channel >=
d->_readChannels.size() ) {
273 ERR <<
"channelReadUntil needs at least a buffsize of 2" << std::endl;
277 int64_t
toRead = maxSize - 1;
279 if (
d->_readChannels[channel].size () > 0 )
287 bool hasError =
false;
307 return hasError ? -1 : 0;
326 return d->_readChannels[channel].size();
332 if ( !
canRead() || channel >=
d->_readChannels.size() )
334 return d->_readChannels[channel].canReadUntil(
delim );
340 if ( !
canRead() || channel >=
d->_readChannels.size() )
342 return d->_readChannels[channel].canReadLine();
349 return write( data.data(), data.size() );
370 return d_func()->_readyRead;
375 return d_func()->_channelReadyRead;
380 return d_func()->_sigBytesWritten;
385 return d_func()->_sigAllBytesWritten;
390 return d_func()->_sigReadChannelFinished;
400 return traits_type::eof();
403 if (
_dev->write ( &
buf, 1 ) == 1 ) {
404 return traits_type::not_eof(
__c);
406 return traits_type::eof();
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
static std::size_t maxSize()
IODeviceOStreamBuf(IODeviceRef dev)
int_type overflow(int_type __c) override
IODevicePrivate(IODevice &p)
ByteArray channelReadUntil(uint channel, const char delim, int64_t maxSize=0)
virtual void readChannelChanged(uint channel)=0
virtual int64_t writeData(const char *data, int64_t count)=0
virtual ByteArray readLine(const int64_t maxSize=0)
SignalProxy< void(uint)> sigChannelReadyRead()
SignalProxy< void(uint) > sigReadChannelFinished()
void setReadChannelCount(uint channels)
SignalProxy< void()> sigReadyRead()
virtual int64_t bytesAvailable() const
virtual int64_t rawBytesAvailable(uint channel) const =0
SignalProxy< void(int64_t)> sigBytesWritten()
virtual int64_t readData(uint channel, char *buffer, int64_t bufsize)=0
bool waitForReadyRead(int timeout)
void finishReadChannel(uint channel)
bool canReadUntil(uint channel, const char delim) const
int64_t readBufferCount() const
SignalProxy< void()> sigAllBytesWritten()
void setReadChannel(uint channel)
uint currentReadChannel() const
ByteArray read(int64_t maxSize)
ByteArray channelReadLine(uint channel, int64_t maxSize=0)
int64_t write(const ByteArray &data)
virtual bool open(const OpenMode mode)
int readChannelCount() const
constexpr std::string_view outOfRangeErrMsg("Channel index out of range")
#define ZYPP_IMPL_PRIVATE(Class)