21 d->_readChannels.clear();
23 d->_readChannels.push_back(
IOBuffer(
d->_readBufChunkSize ) );
34 d->_readChannels.clear();
49 if ( channel >=
d->_readChannels.size() ) {
53 d->_currentReadChannel = channel;
62 return d->_currentReadChannel;
70 return d->_readChannels.size();
106 return readAll(
d->_currentReadChannel );
111 if ( !
canRead() || maxSize <= 0 )
113 return read(
d_func()->_currentReadChannel, maxSize );
121 return read(
d->_currentReadChannel,
buf, maxSize );
139 if ( !
canRead() || maxSize <= 0 )
143 const auto r =
read( channel,
res.data(), maxSize );
151 if ( !
canRead() || maxSize < 0 )
154 if ( channel >=
d->_readChannels.size() ) {
159 int64_t
readSoFar =
d->_readChannels[ channel ].read(
buf, maxSize );
173 if ( !
canRead() || maxSize < 0 )
176 if ( channel >=
d->_readChannels.size() ) {
185 ERR <<
"Calling channelReadLine with maxSize > int64_t(ByteArray::maxSize) " << std::endl;
194 if ( maxSize == 0 || maxSize >= (
maxBArrSize - 1) ) {
203 result.resize( std::min( std::size_t(maxSize), std::size_t(result.size() +
d->_readBufChunkSize )) );
215 result.resize( maxSize );
227 result.shrink_to_fit();
236 if ( !
canRead() || maxSize < 0 )
239 if ( channel >=
d->_readChannels.size() ) {
245 ERR <<
"channelReadLine needs at least a buffsize of 2" << std::endl;
249 int64_t
toRead = maxSize - 1;
251 if (
d->_readChannels[channel].size () > 0 )
259 bool hasError =
false;
279 return hasError ? -1 : 0;
296 if ( !
canRead() || channel >=
d->_readChannels.size() )
298 return d->_readChannels[channel].canReadLine();
305 return write( data.data(), data.size() );
326 return d_func()->_readyRead;
331 return d_func()->_channelReadyRead;
336 return d_func()->_sigBytesWritten;
341 return d_func()->_sigAllBytesWritten;
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
static std::size_t maxSize()
IODevicePrivate(IODevice &p)
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()
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)
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)