Ignore:
Timestamp:
Sep 7, 2012, 6:45:53 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Aktualizace balíčku TemplateGenerics na novější verzi. Se starou nešel projekt správně přeložit.
Location:
trunk/Packages/TemplateGenerics/Demo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/TemplateGenerics/Demo

    • Property svn:ignore set to
      heaptrclog.trc
  • trunk/Packages/TemplateGenerics/Demo/UMainForm.pas

    r84 r90  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  ComCtrls, SpecializedList, SpecializedDictionary, SpecializedQueue,
    10   DateUtils, SpecializedMatrix;
     10  DateUtils, SpecializedMatrix, SpecializedStream;
    1111
    1212type
     
    1515
    1616  TMainForm = class(TForm)
     17    ButtonStreamByte: TButton;
    1718    ButtonBenchmarkDictionary: TButton;
    1819    ButtonBenchmarkListPointer: TButton;
     
    3839    procedure ButtonQueueIntegerClick(Sender: TObject);
    3940    procedure ButtonStringListClick(Sender: TObject);
     41    procedure ButtonStreamByteClick(Sender: TObject);
    4042    procedure FormCreate(Sender: TObject);
    4143    procedure FormDestroy(Sender: TObject);
    42   private
    4344  public
    4445    MeasureDuration: TDateTime;
     
    9495    List2.SetArray([2, 0]);
    9596    WriteOutput('EqualTo([7, 11])', BoolToStr(EqualTo(List2)));
     97    InsertCount(0, 3);
     98    WriteOutput('InsertCount(0, 3)', Implode(',', IntToStr));
     99    Fill(0, 3, 9);
     100    WriteOutput('Fill(0, 3, 9)', Implode(',', IntToStr));
    96101  finally
    97102    Free;
     
    119124    WriteOutput('Clear', '[' + Implode('; ', ', ', IntToStr) + ']');
    120125    WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X));
     126  finally
     127    Free;
     128  end;
     129end;
     130
     131procedure TMainForm.ButtonStreamByteClick(Sender: TObject);
     132var
     133  Stream: TMemoryStreamByte;
     134  I: Integer;
     135  ByteArray: array of Byte;
     136  ByteArrayText: string;
     137begin
     138  ListViewOutput.Clear;
     139  LabelTestName.Caption := 'TStreamByte test';
     140  Stream := TMemoryStreamByte.Create;
     141  with Stream do try
     142    WriteOutput('Size := ', IntToStr(Stream.Size));
     143    Write(1);
     144    WriteOutput('Write(1)', '');
     145    WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position));
     146    WriteArray([2, 3, 4]);
     147    WriteOutput('WriteArray([2, 3, 4])', '');
     148    WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position));
     149    Position := 1;
     150    WriteOutput('Position := 1', '');
     151    WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position));
     152    WriteOutput('Read', IntToStr(Read));
     153    WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position));
     154    ByteArray := ReadArray(2);
     155    ByteArrayText := '[';
     156    for I := 0 to Length(ByteArray) - 1 do begin
     157      ByteArrayText := ByteArrayText + IntToStr(ByteArray[I]);
     158      if I < Length(ByteArray) - 1 then ByteArrayText := ByteArrayText + ', ';
     159    end;
     160    ByteArrayText := ByteArrayText + ']';
     161    WriteOutput('ReadArray', ByteArrayText);
     162    WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position));
    121163  finally
    122164    Free;
     
    702744    MoveItems(2, 3, 3);
    703745    WriteOutput('Implode', Implode(',', StrToStr));
     746    InsertCount(0, 3);
     747    WriteOutput('InsertCount(0, 3)', Implode(',', StrToStr));
     748    Fill(0, 3, 'Zero');
     749    WriteOutput('Fill(0, 3, ''Zero'')', Implode(',', StrToStr));
    704750  finally
    705751    Free;
Note: See TracChangeset for help on using the changeset viewer.