Hi Atul,
I don’t remember the exact example from the GoF book but I think that State won’t suit our case so good. The reason is that QAbstractSocket already abstracts some of the details. For example, the disconnected signal is emitted by QAbstractSocket when recv returns 0. Additionally, if you look at the implementation of SocketTransport, you’ll see there are actually no switches that a State would eliminate.
I’m glad you like the decorator idea! I’m thinking about an alternative - add a setCodec() method to the Transport interface, or extend it to a new EncodedTransport interface?
Regards,
Peter
