idstreamrandomaccess.pas

来自「网络控件适用于Delphi6」· PAS 代码 · 共 54 行

PAS
54
字号
{ $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence                                   }
{ Team Coherence is Copyright 2002 by Quality Software Components      }
{                                                                      }
{ For further information / comments, visit our WEB site at            }
{ http://www.TeamCoherence.com                                         }
{**********************************************************************}
{}
{ $Log:  88162: IdStreamRandomAccess.pas 
{
{   Rev 1.1    2004.05.20 1:40:30 PM  czhower
{ Last of the IdStream updates
}
unit IdStreamRandomAccess;

interface

uses
  IdStream;

type
  TIdStreamRandomAccess = class(TIdStream)
  protected
    function GetPosition: Integer; virtual; abstract;
    function GetSize: Integer; virtual; abstract;
    procedure SetPosition(const AValue: Integer); virtual; abstract;
  public
    function BOF: Boolean; virtual;
    function EOF: Boolean; virtual;
    procedure Skip(
      ASize: Integer
      ); virtual; abstract;
    //
    property Position: Integer read GetPosition write SetPosition;
    property Size: Integer read GetSize;
  end;

implementation

{ TIdStreamRandomAccess }

function TIdStreamRandomAccess.BOF: Boolean;
begin
  Result := Position = 0;
end;

function TIdStreamRandomAccess.EOF: Boolean;
begin
  Result := Position >= Size - 1;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?