Compression: Design time Support


 

AstaLzhCompress has a unit variable of CompressFunc of type CompressFunc:AstacomrpessFunctionType.

 

 

The initilization of AstaLZHCompress will set the CompressFunc to AstaDataSetCompression which uses the freeware LZH components distributed with ASTA. This is what will be called when you set the AstaclientSocket.Compression to AstaCompresssion. Of course you can define custom compression but that will only work at runtime. To use your own compression scheme at design time you must provide your own unit that has an AstaCompressFunctionType that overrides the default CompressFunc used by ASTA for ASTA compression. Just add a unit to your ASTA package that implements a CompressFunc and assign it in your intialization part of the unit and you can have your own custom design time ASTA compression scheme.

 

 

 type

 AstaCompressFunctionType=function (S:String;Compressit:Boolean):String;

 

 Var

 CompressFunc:AstaCompressFunctionType;

 

Function AstaDataSetCompression(S:String;Compressit:Boolean):String;

begin

if compressIt then result:=CompressString(s)

 else result:=DecompressString(s);

end;

 

 

initialization

  CompressFunc:=AstaDataSetCompression;

 

end.

 



ASTA Overview