About IAStream,ISource,IPeek,IGetLine | developer.brewmp.com About IAStream,ISource,IPeek,IGetLine | developer.brewmp.com

Developer

About IAStream,ISource,IPeek,IGetLine

Forums:

I am confused about these four Interface. Most of them are abstract Interface.

Anyone can tell me what are their detail usages(one by one)??

And What is the difference between IAstream and ISource?? It seems nothing difference, why these two interface exist meanwhile??

And what is the difference between ISource, IPeek,IGetLine, They are inherited one by one, ISource->IPeek->IGetLine. Then what is the exact difference of them??

Waiting for your help

ISource is a readable data stream
IPeek is an ISource that is random. It has peek/advance functionality
IGetLine is an IPeek that parses lines, as it's name might suggest... It inherits from IPeek rather than ISource because it too is random access - you can unget a line.
That just rephrases the documentation slightly, but I hope it helps...
As for ISource vs IAStream - I can only assume someone once thought they might go in two different directions. They appear to be binary compatible, and I'm fairly sure you could get away with casting one to the other without using ISOURCEUTIL_SourceFromAStream.

ISource is a readable data stream
IPeek is an ISource that is random. It has peek/advance functionality
IGetLine is an IPeek that parses lines, as it's name might suggest... It inherits from IPeek rather than ISource because it too is random access - you can unget a line.
That just rephrases the documentation slightly, but I hope it helps...
As for ISource vs IAStream - I can only assume someone once thought they might go in two different directions. They appear to be binary compatible, and I'm fairly sure you could get away with casting one to the other without using ISOURCEUTIL_SourceFromAStream.

I wouldn't call ISource and IAStream binary compatible. Yes, the Read function appears at the same place in both vtables, and takes the same arguments, so if that's the only function you call then you can cast one to the other without anything breaking. But the Readable functions are completely different and IAStream doesn't support QueryInterface.
IAStream is older (ISource was introduced in BREW 1.1), but ISource is "better" if only because it supports QueryInterface.
-Erik

I wouldn't call ISource and IAStream binary compatible. Yes, the Read function appears at the same place in both vtables, and takes the same arguments, so if that's the only function you call then you can cast one to the other without anything breaking. But the Readable functions are completely different and IAStream doesn't support QueryInterface.
IAStream is older (ISource was introduced in BREW 1.1), but ISource is "better" if only because it supports QueryInterface.
-Erik