1.1.5. TBUUCode компонент

1.1.5. TBUUCode компонент

Определение интерфейса компонента TUUCode, базируется на ранее приведенных и объясненных процедур Triplet2Kwartet и Kwartet2Triplet, заметим, что ниже приведенный код использует условное компилирование в зависимости от версий Delphi и C++Builder.

unit UUCode;

 interface

 uses

 {$IFDEF WIN32}

   Windows,

 {$ELSE}

   WinTypes, WinProcs,

 {$ENDIF}

   SysUtils, Messages, Classes, Graphics, Controls, Forms;

 {$IFNDEF WIN32}

 type

   ShortString = String;

 {$ENDIF}

 type

   EUUCode = class(Exception);

   TAlgorithm = (filecopy, uuencode, uudecode, xxencode, xxdecode, Base64encode, Base64decode);

   TUnixCRLF = (CRLF, LF);

   TProgressEvent = procedure(Percent:Word) of Object;

   TBUUCode = class(TComponent)

   public

   { Public class declarations (override) }

     constructor Create(AOwner: TComponent); override;

   private

   { Private field declarations }

     FAbout: ShortString;

     FActive: Boolean;

     FAlgorithm: TAlgorithm;

     FFileMode: Word;

     FHeaders: Boolean;

     FInputFileName: TFileName;

     FOutputFileName: TFileName;

     FOnProgress: TProgressEvent;

     FUnixCRLF: TUnixCRLF;

   { Dummy method to get read-only About property }

     procedure Dummy(Ignore: ShortString);

   protected

   { Protected Activate method }

     procedure Activate(GoActive: Boolean);

   public

   { Public UUCode interface declaration }

     procedure UUCode;

   published

   { Published design declarations }

     property About: ShortString read FAbout write Dummy;

     property Active: Boolean read FActive write Activate;

     property Algorithm: TAlgorithm read Falgorithm write FAlgorithm;

     property FileMode: Word read FFileMode write FFileMode;

     property Headers: Boolean read FHeaders write FHeaders;

     property InputFile: TFileName read FInputFileName write FInputFileName;

     property OutputFile: TFileName read FOutputFileName write FOutputFileName;

     property UnixCRLF: TUnixCRLF read FUnixCRLF write FUnixCRLF;

   published

   { Published Event property }

     property OnProgress: TProgressEvent read FOnProgress write FOnProgress;

   end {TUUCode};