Re: Pipe multiple QProcess
Re: Pipe multiple QProcess
:O that's very, very interesting! Thanks a lot :)
Re: Pipe multiple QProcess
It's also very easy to implement a pipe based on QIODevice.
Re: Pipe multiple QProcess
wysota, that's interesting. Reading briefly the QIODevice documentation it seems to me that such a pipe would be implemented sub-classing it, using a QByteArray to store writes and emitting readyReads, right?
The only thing I do not understand is if it's possible to automatically attach a QProcess to multiple QIODevice, so that when one has data ready, they are copied to every other connected device... In other words, I do not see why it should be more convenient to use a QIODevice to pipe.
Re: Pipe multiple QProcess
Quote:
Originally Posted by
akiross
wysota, that's interesting. Reading briefly the QIODevice documentation it seems to me that such a pipe would be implemented sub-classing it, using a QByteArray to store writes and emitting readyReads, right?
Basically, yes.
Quote:
The only thing I do not understand is if it's possible to automatically attach a QProcess to multiple QIODevice
You can implement a multiplexer device that reads from one source and writes to multiple destinations.
Quote:
In other words, I do not see why it should be more convenient to use a QIODevice to pipe.
It would be more convenient because you retain the QIODevice API so you can use the pipe with anything that can read from QIODevice or write to QIODevice. Bear in mind QProcess, QFile, QAbstractSocket are all QIODevice subclasses.
Re: Pipe multiple QProcess
Well, my original post was mainly directed to the creation of the multiplexer itself, but it seems that I have to tailor a solution by myself.
Thanks anyway, I will consider creating a QIODevice to pipe (and multiplex).