Changeset 312 for Generics/TemplateGenerics/Demo/UMainForm.pas
- Timestamp:
- Jan 9, 2012, 2:22:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Demo/UMainForm.pas
r270 r312 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 ComCtrls, SpecializedList, SpecializedDictionary, SpecializedQueue, 10 DateUtils, SpecializedMatrix ;10 DateUtils, SpecializedMatrix, SpecializedStream; 11 11 12 12 type … … 15 15 16 16 TMainForm = class(TForm) 17 ButtonStreamByte: TButton; 17 18 ButtonBenchmarkDictionary: TButton; 18 19 ButtonBenchmarkListPointer: TButton; … … 38 39 procedure ButtonQueueIntegerClick(Sender: TObject); 39 40 procedure ButtonStringListClick(Sender: TObject); 41 procedure ButtonStreamByteClick(Sender: TObject); 40 42 procedure FormCreate(Sender: TObject); 41 43 procedure FormDestroy(Sender: TObject); 42 private43 44 public 44 45 MeasureDuration: TDateTime; … … 94 95 List2.SetArray([2, 0]); 95 96 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)); 96 101 finally 97 102 Free; … … 119 124 WriteOutput('Clear', '[' + Implode('; ', ', ', IntToStr) + ']'); 120 125 WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X)); 126 finally 127 Free; 128 end; 129 end; 130 131 procedure TMainForm.ButtonStreamByteClick(Sender: TObject); 132 var 133 Stream: TMemoryStreamByte; 134 I: Integer; 135 ByteArray: array of Byte; 136 ByteArrayText: string; 137 begin 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)); 121 163 finally 122 164 Free; … … 702 744 MoveItems(2, 3, 3); 703 745 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)); 704 750 finally 705 751 Free;
Note:
See TracChangeset
for help on using the changeset viewer.