Ignore:
Timestamp:
Sep 21, 2012, 9:19:58 AM (12 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/NativeGenerics/Units/GenericStream.pas

    r323 r425  
    2121    function GetPosition: TIndex;
    2222  public
    23     procedure Assign(Source: TGAbstractStream<TItem>); virtual;
     23    procedure Assign(Source: TGAbstractStream<TItem>); virtual; abstract;
    2424    procedure Write(Item: TItem); virtual; abstract;
    2525    procedure WriteArray(Item: array of TItem); virtual; abstract;
     
    2727    function Read: TItem; virtual; abstract;
    2828    function ReadArray(Count: TIndex): TItemArray; virtual; abstract;
     29    function ReadBuffer(var Buffer; Count: Integer): Integer; virtual; abstract;
    2930    function Insert(Count: TIndex): TIndex; virtual; abstract;
    3031    function Remove(Count: TIndex): TIndex; virtual; abstract;
     
    4142    FPosition: TIndex;
    4243  public
     44    type
     45      PItem = ^TItem;
    4346    procedure Assign(Source: TGAbstractStream<TItem>); override;
    4447    procedure Write(Item: TItem); override;
     
    4851    function ReadArray(Count: TIndex): TItemArray; override;
    4952    function ReadList(List: TGList<TItem>; Count: TIndex): TIndex;
     53    function ReadBuffer(var Buffer; Count: Integer): Integer; override;
    5054    function Insert(Count: TIndex): Integer; override;
    5155    function Remove(Count: TIndex): Integer; override;
     
    5660  end;
    5761
     62    TStreamByte = TGStream<Byte>;
     63
    5864
    5965implementation
     
    6167
    6268{ TGStream }
    63 
    64 procedure TGAbstractStream<TItem>.Assign(Source: TGAbstractStream<TItem>);
    65 begin
    66 end;
    6769
    6870procedure TGAbstractStream<TItem>.SetPosition(AValue: TIndex);
     
    112114procedure TGStream<TItem>.Assign(Source: TGAbstractStream<TItem>);
    113115begin
    114   inherited;
    115116  if Source is TGStream<TItem> then begin
    116117    FList.Assign(TGStream<TItem>(Source).FList);
     
    196197end;
    197198
     199function TGStream<TItem>.ReadBuffer(var Buffer; Count: Integer): Integer;
     200begin
     201  List.GetBuffer(Position, Buffer, Count);
     202end;
     203
    198204
    199205end.
Note: See TracChangeset for help on using the changeset viewer.