Changeset 321 for Generics/NativeGenerics/Demo/UMainForm.pas
- Timestamp:
- Feb 7, 2012, 3:35:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Demo/UMainForm.pas
r320 r321 15 15 16 16 TMainForm = class(TForm) 17 ButtonStreamByte: TButton; 17 18 ButtonBenchmarkDictionary: TButton; 18 19 ButtonBenchmarkListPointer: TButton; … … 37 38 procedure ButtonListObjectClick(Sender: TObject); 38 39 procedure ButtonQueueIntegerClick(Sender: TObject); 40 procedure ButtonStreamByteClick(Sender: TObject); 39 41 procedure ButtonStringListClick(Sender: TObject); 40 42 procedure FormCreate(Sender: TObject); … … 94 96 List2.SetArray([2, 0]); 95 97 WriteOutput('EqualTo([7, 11])', BoolToStr(EqualTo(List2))); 98 InsertCount(0, 3); 99 WriteOutput('InsertCount(0, 3)', Implode(',', IntToStr)); 100 Fill(0, 3, 9); 101 WriteOutput('Fill(0, 3, 9)', Implode(',', IntToStr)); 96 102 finally 97 103 Free; … … 170 176 WriteOutput('Dequeued item', IntToStr(Dequeue)); 171 177 WriteOutput('Dequeue', List.Implode(',', IntToStr)); 178 finally 179 Free; 180 end; 181 end; 182 183 procedure TMainForm.ButtonStreamByteClick(Sender: TObject); 184 var 185 Stream: TMemoryStreamByte; 186 I: Integer; 187 ByteArray: array of Byte; 188 ByteArrayText: string; 189 begin 190 ListViewOutput.Clear; 191 LabelTestName.Caption := 'TStreamByte test'; 192 Stream := TMemoryStreamByte.Create; 193 with Stream do try 194 WriteOutput('Size := ', IntToStr(Stream.Size)); 195 Write(1); 196 WriteOutput('Write(1)', ''); 197 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 198 WriteArray([2, 3, 4]); 199 WriteOutput('WriteArray([2, 3, 4])', ''); 200 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 201 Position := 1; 202 WriteOutput('Position := 1', ''); 203 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 204 WriteOutput('Read', IntToStr(Read)); 205 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 206 ByteArray := ReadArray(2); 207 ByteArrayText := '['; 208 for I := 0 to Length(ByteArray) - 1 do begin 209 ByteArrayText := ByteArrayText + IntToStr(ByteArray[I]); 210 if I < Length(ByteArray) - 1 then ByteArrayText := ByteArrayText + ', '; 211 end; 212 ByteArrayText := ByteArrayText + ']'; 213 WriteOutput('ReadArray', ByteArrayText); 214 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 172 215 finally 173 216 Free; … … 705 748 MoveItems(2, 3, 3); 706 749 WriteOutput('Implode', Implode(',', StrToStr)); 750 InsertCount(0, 3); 751 WriteOutput('InsertCount(0, 3)', Implode(',', StrToStr)); 752 Fill(0, 3, 'Zero'); 753 WriteOutput('Fill(0, 3, ''Zero'')', Implode(',', StrToStr)); 707 754 finally 708 755 Free;
Note:
See TracChangeset
for help on using the changeset viewer.