Re: Re: Re: SourceComment: BDecoder::readInt()

hi,

I think what Atul means is that there is no need to make extensive encapsulation: a wrapper is good if you want to change the output of a method to another format for example. But in the case of

BinaryReader::toInt() which calls QByteArray::toInt(), it is useless, we should call QByteArray::toInt() directly, that  increase the amount of methods calls.

Did i confused everybody a bit more? :-)

Peter Dimov wrote:

I’m a bit confused, Atul! Are you talking about BDecoder or BinaryReader? Could you elaborate your point a bit please?

Regards,
Peter

Peter Dimov wrote:Hi Atul, the thing is that with integers we might need to swap bytes whereas readBytes() and readCString() should never swap bytes. Or maybe I got you wrong?

Peter

atul wrote:Dear all

Why not use

int QByteArray::toInt() and leave all the processing to it? ;-)

I mean we could write a BinaryReader::toInt() wrapper and that could just call the QByteArray version….

So there would be a lot of less code to maintain ( and more reuse etc… )

Could the same ideas be used for BDecoder::readString?

I think I will write another SourceComment for that ;-)

—- cheerio atul

Would you like to post a relpy?


This post is a reply to:
Re: Re: SourceComment: BDecoder::readInt()
I'm a bit confused, Atul! Are you talking about BDecoder or BinaryReader? Could you elaborate your point a bit please? Regards, Peter Peter Dimov wrote:Hi Atul, the thing is that with integers (more...)

No follow-ups yet.