Hi,

I'm wondering how to set a custom driver object for TReader instances.
Both in TReader and TWriter the Driver property is read-only, but in
TWriter I can at least use the alternative constructor which takes a
TAbstractObjectWriter. TReader only has the constructor which takes a
TStream and a buffer size Integer. Why is that?

Actually, this slightly ugly snippet from LResources/CreateLRSReader
shows that I'm not the only one trying to do this (where Result is a
TReader instance):

  // hack to set a write protected variable.
  // DestroyDriver:=true; TReader will free it
  Driver:=LRSObjectReaderClass.Create(s,4096);
  p:=...@result.driver;
  Result.Driver.Free;
  TAbstractObjectReader(p^):=Driver;


Any hints why this is implemented as it is, and whether there are
cleaner ways of using custom drivers would be highly appreciated.

Cheers
Roland
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to