#include <zypp-core/zyppng/io/iodevice.h>
|
| ZYPP_DECLARE_FLAGS (OpenMode, OpenModeFlag) |
|
| IODevice () |
|
virtual void | close () |
|
void | setReadChannel (uint channel) |
|
uint | currentReadChannel () const |
|
int | readChannelCount () const |
|
bool | canRead () const |
|
bool | canWrite () const |
|
bool | isOpen () const |
|
ByteArray | readAll () |
|
ByteArray | read (int64_t maxSize) |
|
int64_t | read (char *buf, int64_t maxSize) |
|
virtual ByteArray | readLine (const int64_t maxSize=0) |
|
virtual int64_t | bytesAvailable () const |
|
bool | canReadLine () const |
|
ByteArray | readAll (uint channel) |
|
ByteArray | read (uint channel, int64_t maxSize) |
|
int64_t | read (uint channel, char *buf, int64_t maxSize) |
|
ByteArray | channelReadLine (uint channel, int64_t maxSize=0) |
|
virtual int64_t | channelReadLine (uint channel, char *buf, const int64_t maxSize) |
|
virtual int64_t | bytesAvailable (uint channel) const |
|
bool | canReadLine (uint channel) const |
|
int64_t | write (const ByteArray &data) |
|
int64_t | write (const char *data, int64_t len) |
|
bool | waitForReadyRead (int timeout) |
|
virtual bool | waitForReadyRead (uint channel, int timeout)=0 |
|
SignalProxy< void()> | sigReadyRead () |
|
SignalProxy< void(uint)> | sigChannelReadyRead () |
|
SignalProxy< void(int64_t)> | sigBytesWritten () |
|
SignalProxy< void()> | sigAllBytesWritten () |
|
| Base () |
|
virtual | ~Base () |
|
WeakPtr | parent () const |
|
void | addChild (const Base::Ptr &child) |
|
void | removeChild (const Ptr &child) |
|
const std::unordered_set< Ptr > & | children () const |
|
std::thread::id | threadId () const |
|
template<typename T > |
std::vector< std::weak_ptr< T > > | findChildren () const |
|
template<typename T > |
std::shared_ptr< T > | shared_this () const |
|
template<typename T > |
std::shared_ptr< T > | shared_this () |
|
template<typename T > |
std::weak_ptr< T > | weak_this () const |
|
template<typename T > |
std::weak_ptr< T > | weak_this () |
|
template<typename SenderFunc , typename ReceiverFunc > |
auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
|
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> |
std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
|
|
template<typename Obj , typename Functor > |
static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
|
template<typename SenderFunc , typename ReceiverFunc > |
static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
|
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> |
static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
|
std::unique_ptr< BasePrivate > | d_ptr |
|
The IODevice class represents a async sequential IO device, like a Socket or Pipe, to receive and or send data.
Definition at line 31 of file iodevice.h.
◆ Ptr
◆ WeakPtr
◆ OpenModeFlag
Enumerator |
---|
Closed | |
ReadOnly | |
WriteOnly | |
ReadWrite | |
Definition at line 36 of file iodevice.h.
◆ IODevice() [1/2]
zyppng::IODevice::IODevice |
( |
| ) |
|
◆ IODevice() [2/2]
◆ ZYPP_DECLARE_PRIVATE()
zyppng::IODevice::ZYPP_DECLARE_PRIVATE |
( |
IODevice | | ) |
|
|
private |
◆ ZYPP_DECLARE_FLAGS()
zyppng::IODevice::ZYPP_DECLARE_FLAGS |
( |
OpenMode | , |
|
|
OpenModeFlag | ) |
◆ close()
void zyppng::IODevice::close |
( |
| ) |
|
|
virtual |
◆ setReadChannel()
void zyppng::IODevice::setReadChannel |
( |
uint | channel | ) |
|
◆ currentReadChannel()
uint zyppng::IODevice::currentReadChannel |
( |
| ) |
const |
◆ readChannelCount()
int zyppng::IODevice::readChannelCount |
( |
| ) |
const |
◆ canRead()
bool zyppng::IODevice::canRead |
( |
| ) |
const |
◆ canWrite()
bool zyppng::IODevice::canWrite |
( |
| ) |
const |
◆ isOpen()
bool zyppng::IODevice::isOpen |
( |
| ) |
const |
◆ readAll() [1/2]
◆ read() [1/4]
ByteArray zyppng::IODevice::read |
( |
int64_t | maxSize | ) |
|
◆ read() [2/4]
int64_t zyppng::IODevice::read |
( |
char * | buf, |
|
|
int64_t | maxSize ) |
◆ readLine()
ByteArray zyppng::IODevice::readLine |
( |
const int64_t | maxSize = 0 | ) |
|
|
virtual |
◆ bytesAvailable() [1/2]
int64_t zyppng::IODevice::bytesAvailable |
( |
| ) |
const |
|
virtual |
◆ canReadLine() [1/2]
bool zyppng::IODevice::canReadLine |
( |
| ) |
const |
◆ readAll() [2/2]
ByteArray zyppng::IODevice::readAll |
( |
uint | channel | ) |
|
◆ read() [3/4]
ByteArray zyppng::IODevice::read |
( |
uint | channel, |
|
|
int64_t | maxSize ) |
◆ read() [4/4]
int64_t zyppng::IODevice::read |
( |
uint | channel, |
|
|
char * | buf, |
|
|
int64_t | maxSize ) |
◆ channelReadLine() [1/2]
ByteArray zyppng::IODevice::channelReadLine |
( |
uint | channel, |
|
|
int64_t | maxSize = 0 ) |
Convenience function that reads a line from the device into a ByteArray. Since this function has no way to signal if a error happened, a empty ByteArray is returned if there was no data or if a error occured.
Definition at line 170 of file iodevice.cc.
◆ channelReadLine() [2/2]
int64_t zyppng::IODevice::channelReadLine |
( |
uint | channel, |
|
|
char * | buf, |
|
|
const int64_t | maxSize ) |
|
virtual |
Reads data from the device until one of the following conditions are met:
- A
is encountered
- maxSize nr of bytes have been read
- a error occurs on the device
If bytes have been read from the device this always returns the number of bytes that have been read, otherwise if no data was read 0 is returned or if a error occurs -1 is returned.
Definition at line 232 of file iodevice.cc.
◆ bytesAvailable() [2/2]
int64_t zyppng::IODevice::bytesAvailable |
( |
uint | channel | ) |
const |
|
virtual |
◆ canReadLine() [2/2]
bool zyppng::IODevice::canReadLine |
( |
uint | channel | ) |
const |
Returns true if a line can be read from the currently buffered data in the given channel
Definition at line 293 of file iodevice.cc.
◆ write() [1/2]
int64_t zyppng::IODevice::write |
( |
const ByteArray & | data | ) |
|
◆ write() [2/2]
int64_t zyppng::IODevice::write |
( |
const char * | data, |
|
|
int64_t | len ) |
◆ waitForReadyRead() [1/2]
bool zyppng::IODevice::waitForReadyRead |
( |
int | timeout | ) |
|
Blocks the current event loop to wait until there are bytes available to read from the device. This always operates on the read channel that is selected as the default when the function is first called, even if the default channel would be changed during the wait.
- See also
- zyppng::IODevice::currentReadChannel
- Note
- do not use until there is a very good reason, like event processing should not continue until readyRead was sent
Definition at line 315 of file iodevice.cc.
◆ waitForReadyRead() [2/2]
virtual bool zyppng::IODevice::waitForReadyRead |
( |
uint | channel, |
|
|
int | timeout ) |
|
pure virtual |
Blocks the current event loop to wait until there are bytes available to read from the given read channel.
- Note
- do not use until there is a very good reason, like event processing should not continue until readyRead was sent
Implemented in zyppng::AsyncDataSource, and zyppng::Socket.
◆ sigReadyRead()
SignalProxy< void()> zyppng::IODevice::sigReadyRead |
( |
| ) |
|
Signal is emitted when there is data available to read on the current default read channel
Definition at line 324 of file iodevice.cc.
◆ sigChannelReadyRead()
SignalProxy< void(uint)> zyppng::IODevice::sigChannelReadyRead |
( |
| ) |
|
Signal is emitted when there is data available on the given channel
Definition at line 329 of file iodevice.cc.
◆ sigBytesWritten()
SignalProxy< void(int64_t)> zyppng::IODevice::sigBytesWritten |
( |
| ) |
|
Signal is emitted every time bytes have been written to the underlying device. This can be used to track how much data was actually sent.
Definition at line 334 of file iodevice.cc.
◆ sigAllBytesWritten()
SignalProxy< void()> zyppng::IODevice::sigAllBytesWritten |
( |
| ) |
|
Signal is emitted every time all bytes have been written to the underlying device.
Definition at line 339 of file iodevice.cc.
◆ open()
bool zyppng::IODevice::open |
( |
const OpenMode | mode | ) |
|
|
protectedvirtual |
◆ rawBytesAvailable()
virtual int64_t zyppng::IODevice::rawBytesAvailable |
( |
uint | channel | ) |
const |
|
protectedpure virtual |
◆ writeData()
virtual int64_t zyppng::IODevice::writeData |
( |
const char * | data, |
|
|
int64_t | count ) |
|
protectedpure virtual |
◆ readData()
virtual int64_t zyppng::IODevice::readData |
( |
uint | channel, |
|
|
char * | buffer, |
|
|
int64_t | bufsize ) |
|
protectedpure virtual |
◆ readChannelChanged()
virtual void zyppng::IODevice::readChannelChanged |
( |
uint | channel | ) |
|
|
protectedpure virtual |
◆ setReadChannelCount()
void zyppng::IODevice::setReadChannelCount |
( |
uint | channels | ) |
|
|
protected |
The documentation for this class was generated from the following files: