From: Christian P. <cp...@se...> - 2004-12-18 15:10:19
|
Am Samstag 18 Dezember 2004 14:03 schrieb stephan beal: > Yo again! > > Question: would it be feasible/realistic to add signals to IODevice. > Something like: > > signalRead( const IODevice &, const char * buff, size_t count ); > signalWrite( const IODevice &, const char * buff, size_t count ); > > The first arg is so that one client slot could listen to multiple IODs, > but we wouldn't want them changing the IOD from the slot, thus the > const. Yes, good idea ! Don't know why it's missing ;-) > This would allow: > > a) send read/write progress feedback in, zB, a UI. > > b) me to plug in the s11n Serializers to IOD, by simply capturing read() > input via a slot, then sending it to the Serializers via an > istringstream copy of the input. (They're designed to read > std::istreams and write to std::ostreams.) > > Or are there good reasons not to do this? > > Quasi-related: > > For streambuffer support, i'm thinking something like this: > > IODevice * my_io_device = new SomeIODevType(...); > IODevStreambuf sb( my_io_device ); > // ^^^^ basically proxies over/underflow() to read/write() > std::ostream os( &sb ); > // use any IODevice via any std::stream > > i don't know if it'll work, though. When i've tried to implement custom > stream buffers i've failed horribly - the architecture, while sound, > confuses me. Too many low-level details to track at once for my mind to > keep up with. > > Hell, this support may already exist in P. If so, i haven't found it > yet. Please have a look at P::IOStream. Regards, Christian |