| 116 | } |
| 117 | |
| 118 | uint32_t TQIODeviceTransport::write_partial(const uint8_t* buf, uint32_t len) { |
| 119 | qint64 written; |
| 120 | |
| 121 | if (!dev_->isOpen()) { |
| 122 | throw TTransportException(TTransportException::NOT_OPEN, |
| 123 | "write_partial(): underlying QIODevice is not open"); |
| 124 | } |
| 125 | |
| 126 | written = dev_->write(reinterpret_cast<const char*>(buf), len); |
| 127 | if (written < 0) { |
| 128 | QAbstractSocket* socket; |
| 129 | if ((socket = qobject_cast<QAbstractSocket*>(dev_.get()))) { |
| 130 | throw TTransportException(TTransportException::UNKNOWN, |
| 131 | "write_partial(): failed to write to QAbstractSocket", |
| 132 | socket->error()); |
| 133 | } |
| 134 | |
| 135 | throw TTransportException(TTransportException::UNKNOWN, |
| 136 | "write_partial(): failed to write to underlying QIODevice"); |
| 137 | } |
| 138 | |
| 139 | return (uint32_t)written; |
| 140 | } |
| 141 | |
| 142 | void TQIODeviceTransport::flush() { |
| 143 | if (!dev_->isOpen()) { |
nothing calls this directly
no test coverage detected