Changeset 324
- Timestamp:
- Feb 8, 2012, 1:04:21 PM (13 years ago)
- Location:
- Generics/NativeGenerics
- Files:
-
- 2 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Demo/Demo.lpi
r323 r324 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count=" 59">40 <Units Count="69"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> 43 43 <IsPartOfProject Value="True"/> 44 44 <UnitName Value="Demo"/> 45 <EditorIndex Value=" 9"/>45 <EditorIndex Value="17"/> 46 46 <WindowIndex Value="0"/> 47 47 <TopLine Value="1"/> … … 57 57 <ResourceBaseClass Value="Form"/> 58 58 <UnitName Value="UMainForm"/> 59 <IsVisibleTab Value="True"/>60 59 <EditorIndex Value="0"/> 61 60 <WindowIndex Value="0"/> 62 <TopLine Value="1 78"/>63 <CursorPos X="1 5" Y="191"/>61 <TopLine Value="166"/> 62 <CursorPos X="1" Y="179"/> 64 63 <UsageCount Value="233"/> 65 64 <Bookmarks Count="1"> 66 <Item0 X="65" Y="27 6" ID="2"/>65 <Item0 X="65" Y="275" ID="2"/> 67 66 </Bookmarks> 68 67 <Loaded Value="True"/> … … 440 439 <Filename Value="../Units/GenericList.pas"/> 441 440 <UnitName Value="GenericList"/> 442 <EditorIndex Value=" 3"/>443 <WindowIndex Value="0"/> 444 <TopLine Value=" 516"/>445 <CursorPos X=" 1" Y="528"/>446 <UsageCount Value=" 37"/>441 <EditorIndex Value="11"/> 442 <WindowIndex Value="0"/> 443 <TopLine Value="7"/> 444 <CursorPos X="3" Y="8"/> 445 <UsageCount Value="40"/> 447 446 <Loaded Value="True"/> 448 447 </Unit46> … … 450 449 <Filename Value="../Units/GenericMatrix.pas"/> 451 450 <UnitName Value="GenericMatrix"/> 452 <EditorIndex Value="8"/> 453 <WindowIndex Value="0"/> 454 <TopLine Value="77"/> 455 <CursorPos X="1" Y="85"/> 456 <UsageCount Value="15"/> 451 <IsVisibleTab Value="True"/> 452 <EditorIndex Value="16"/> 453 <WindowIndex Value="0"/> 454 <TopLine Value="92"/> 455 <CursorPos X="5" Y="106"/> 456 <UsageCount Value="18"/> 457 457 <Loaded Value="True"/> 458 458 </Unit47> … … 460 460 <Filename Value="../Units/GenericStream.pas"/> 461 461 <UnitName Value="GenericStream"/> 462 <EditorIndex Value=" 1"/>463 <WindowIndex Value="0"/> 464 <TopLine Value=" 102"/>465 <CursorPos X=" 20" Y="117"/>466 <UsageCount Value="1 5"/>462 <EditorIndex Value="9"/> 463 <WindowIndex Value="0"/> 464 <TopLine Value="34"/> 465 <CursorPos X="18" Y="48"/> 466 <UsageCount Value="18"/> 467 467 <Loaded Value="True"/> 468 468 </Unit48> … … 478 478 <Filename Value="../Units/GenericDictionary.pas"/> 479 479 <UnitName Value="GenericDictionary"/> 480 <EditorIndex Value=" 7"/>480 <EditorIndex Value="15"/> 481 481 <WindowIndex Value="0"/> 482 482 <TopLine Value="1"/> 483 483 <CursorPos X="1" Y="1"/> 484 <UsageCount Value="1 6"/>484 <UsageCount Value="19"/> 485 485 <Loaded Value="True"/> 486 486 </Unit50> 487 487 <Unit51> 488 488 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/objpas/sysutils/sysunih.inc"/> 489 <EditorIndex Value=" 6"/>489 <EditorIndex Value="14"/> 490 490 <WindowIndex Value="0"/> 491 491 <TopLine Value="9"/> 492 492 <CursorPos X="10" Y="22"/> 493 <UsageCount Value="1 6"/>493 <UsageCount Value="19"/> 494 494 <Loaded Value="True"/> 495 495 <DefaultSyntaxHighlighter Value="Delphi"/> … … 498 498 <Filename Value="../Units/SpecializedList.pas"/> 499 499 <UnitName Value="SpecializedList"/> 500 <EditorIndex Value="1 0"/>501 <WindowIndex Value="0"/> 502 <TopLine Value=" 1"/>503 <CursorPos X=" 23" Y="11"/>504 <UsageCount Value="1 6"/>500 <EditorIndex Value="18"/> 501 <WindowIndex Value="0"/> 502 <TopLine Value="45"/> 503 <CursorPos X="1" Y="68"/> 504 <UsageCount Value="19"/> 505 505 <Loaded Value="True"/> 506 506 </Unit52> 507 507 <Unit53> 508 508 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/classesh.inc"/> 509 <EditorIndex Value=" 2"/>509 <EditorIndex Value="10"/> 510 510 <WindowIndex Value="0"/> 511 511 <TopLine Value="257"/> 512 512 <CursorPos X="3" Y="270"/> 513 <UsageCount Value="1 3"/>513 <UsageCount Value="16"/> 514 514 <Loaded Value="True"/> 515 515 </Unit53> … … 533 533 <Filename Value="../Units/GenericRange.pas"/> 534 534 <UnitName Value="GenericRange"/> 535 <EditorIndex Value=" 4"/>535 <EditorIndex Value="12"/> 536 536 <WindowIndex Value="0"/> 537 537 <TopLine Value="4"/> 538 538 <CursorPos X="33" Y="8"/> 539 <UsageCount Value="1 6"/>539 <UsageCount Value="19"/> 540 540 <Loaded Value="True"/> 541 541 </Unit56> … … 550 550 <Filename Value="../Units/GenericTree.pas"/> 551 551 <UnitName Value="GenericTree"/> 552 <EditorIndex Value="13"/> 553 <WindowIndex Value="0"/> 554 <TopLine Value="1"/> 555 <CursorPos X="1" Y="1"/> 556 <UsageCount Value="19"/> 557 <Loaded Value="True"/> 558 </Unit58> 559 <Unit59> 560 <Filename Value="../Units/GenericString.pas"/> 561 <UnitName Value="GenericString"/> 562 <EditorIndex Value="19"/> 563 <WindowIndex Value="0"/> 564 <TopLine Value="35"/> 565 <CursorPos X="23" Y="40"/> 566 <UsageCount Value="12"/> 567 <Loaded Value="True"/> 568 </Unit59> 569 <Unit60> 570 <Filename Value="../Units/GenericBitmap.pas"/> 571 <UnitName Value="GenericBitmap"/> 572 <EditorIndex Value="20"/> 573 <WindowIndex Value="0"/> 574 <TopLine Value="22"/> 575 <CursorPos X="18" Y="46"/> 576 <UsageCount Value="11"/> 577 <Loaded Value="True"/> 578 </Unit60> 579 <Unit61> 580 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/> 581 <UnitName Value="Graphics"/> 582 <EditorIndex Value="1"/> 583 <WindowIndex Value="0"/> 584 <TopLine Value="1151"/> 585 <CursorPos X="22" Y="1165"/> 586 <UsageCount Value="11"/> 587 <Loaded Value="True"/> 588 </Unit61> 589 <Unit62> 590 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/include/rasterimage.inc"/> 591 <EditorIndex Value="8"/> 592 <WindowIndex Value="0"/> 593 <TopLine Value="310"/> 594 <CursorPos X="22" Y="314"/> 595 <UsageCount Value="11"/> 596 <Loaded Value="True"/> 597 </Unit62> 598 <Unit63> 599 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/include/bitmapcanvas.inc"/> 600 <EditorIndex Value="7"/> 601 <WindowIndex Value="0"/> 602 <TopLine Value="53"/> 603 <CursorPos X="3" Y="46"/> 604 <UsageCount Value="11"/> 605 <Loaded Value="True"/> 606 </Unit63> 607 <Unit64> 608 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/packages/fcl-image/src/fpcanvas.pp"/> 609 <UnitName Value="FPCanvas"/> 610 <EditorIndex Value="4"/> 611 <WindowIndex Value="0"/> 612 <TopLine Value="347"/> 613 <CursorPos X="15" Y="360"/> 614 <UsageCount Value="11"/> 615 <Loaded Value="True"/> 616 </Unit64> 617 <Unit65> 618 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/packages/fcl-image/src/fpcanvas.inc"/> 619 <EditorIndex Value="6"/> 620 <WindowIndex Value="0"/> 621 <TopLine Value="308"/> 622 <CursorPos X="3" Y="310"/> 623 <UsageCount Value="11"/> 624 <Loaded Value="True"/> 625 </Unit65> 626 <Unit66> 627 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/packages/fcl-image/src/fpcdrawh.inc"/> 552 628 <EditorIndex Value="5"/> 553 629 <WindowIndex Value="0"/> 554 <TopLine Value="1"/> 555 <CursorPos X="33" Y="8"/> 556 <UsageCount Value="16"/> 557 <Loaded Value="True"/> 558 </Unit58> 630 <TopLine Value="54"/> 631 <CursorPos X="3" Y="63"/> 632 <UsageCount Value="11"/> 633 <Loaded Value="True"/> 634 </Unit66> 635 <Unit67> 636 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/include/canvas.inc"/> 637 <EditorIndex Value="2"/> 638 <WindowIndex Value="0"/> 639 <TopLine Value="147"/> 640 <CursorPos X="3" Y="152"/> 641 <UsageCount Value="11"/> 642 <Loaded Value="True"/> 643 </Unit67> 644 <Unit68> 645 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/interfacebase.pp"/> 646 <UnitName Value="InterfaceBase"/> 647 <EditorIndex Value="3"/> 648 <WindowIndex Value="0"/> 649 <TopLine Value="153"/> 650 <CursorPos X="15" Y="166"/> 651 <UsageCount Value="11"/> 652 <Loaded Value="True"/> 653 </Unit68> 559 654 </Units> 560 655 <JumpHistory Count="30" HistoryIndex="29"> 561 656 <Position1> 562 <Filename Value=" UMainForm.pas"/>563 <Caret Line=" 443" Column="1" TopLine="429"/>657 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/> 658 <Caret Line="2342" Column="15" TopLine="2329"/> 564 659 </Position1> 565 660 <Position2> 566 <Filename Value=" UMainForm.pas"/>567 <Caret Line=" 442" Column="3" TopLine="429"/>661 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/> 662 <Caret Line="1008" Column="3" TopLine="995"/> 568 663 </Position2> 569 664 <Position3> 570 <Filename Value=" UMainForm.pas"/>571 <Caret Line=" 656" Column="20" TopLine="643"/>665 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/> 666 <Caret Line="1182" Column="17" TopLine="1169"/> 572 667 </Position3> 573 668 <Position4> 574 <Filename Value=" UMainForm.pas"/>575 <Caret Line="1 89" Column="3" TopLine="182"/>669 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/> 670 <Caret Line="1176" Column="67" TopLine="1169"/> 576 671 </Position4> 577 672 <Position5> 578 <Filename Value="../Units/Generic Stream.pas"/>579 <Caret Line=" 43" Column="15" TopLine="30"/>673 <Filename Value="../Units/GenericMatrix.pas"/> 674 <Caret Line="35" Column="14" TopLine="73"/> 580 675 </Position5> 581 676 <Position6> 582 <Filename Value=" UMainForm.pas"/>583 <Caret Line=" 191" Column="1" TopLine="182"/>677 <Filename Value="../Units/GenericMatrix.pas"/> 678 <Caret Line="28" Column="51" TopLine="17"/> 584 679 </Position6> 585 680 <Position7> 586 <Filename Value=" UMainForm.pas"/>587 <Caret Line="1 92" Column="1" TopLine="182"/>681 <Filename Value="../Units/GenericMatrix.pas"/> 682 <Caret Line="13" Column="6" TopLine="18"/> 588 683 </Position7> 589 684 <Position8> 590 <Filename Value=" UMainForm.pas"/>591 <Caret Line=" 193" Column="1" TopLine="182"/>685 <Filename Value="../Units/GenericMatrix.pas"/> 686 <Caret Line="30" Column="43" TopLine="9"/> 592 687 </Position8> 593 688 <Position9> 594 <Filename Value=" UMainForm.pas"/>595 <Caret Line=" 194" Column="1" TopLine="182"/>689 <Filename Value="../Units/GenericMatrix.pas"/> 690 <Caret Line="34" Column="36" TopLine="21"/> 596 691 </Position9> 597 692 <Position10> 598 <Filename Value=" UMainForm.pas"/>599 <Caret Line=" 195" Column="1" TopLine="182"/>693 <Filename Value="../Units/GenericMatrix.pas"/> 694 <Caret Line="30" Column="45" TopLine="22"/> 600 695 </Position10> 601 696 <Position11> 602 697 <Filename Value="UMainForm.pas"/> 603 <Caret Line=" 196" Column="1" TopLine="182"/>698 <Caret Line="47" Column="1" TopLine="34"/> 604 699 </Position11> 605 700 <Position12> 606 <Filename Value=" UMainForm.pas"/>607 <Caret Line=" 197" Column="1" TopLine="182"/>701 <Filename Value="../Units/GenericMatrix.pas"/> 702 <Caret Line="57" Column="21" TopLine="44"/> 608 703 </Position12> 609 704 <Position13> 610 <Filename Value=" UMainForm.pas"/>611 <Caret Line=" 198" Column="1" TopLine="182"/>705 <Filename Value="../Units/GenericMatrix.pas"/> 706 <Caret Line="81" Column="1" TopLine="78"/> 612 707 </Position13> 613 708 <Position14> 614 <Filename Value=" UMainForm.pas"/>615 <Caret Line=" 199" Column="1" TopLine="182"/>709 <Filename Value="../Units/GenericMatrix.pas"/> 710 <Caret Line="55" Column="56" TopLine="30"/> 616 711 </Position14> 617 712 <Position15> 618 <Filename Value=" UMainForm.pas"/>619 <Caret Line=" 200" Column="1" TopLine="182"/>713 <Filename Value="../Units/GenericMatrix.pas"/> 714 <Caret Line="98" Column="1" TopLine="75"/> 620 715 </Position15> 621 716 <Position16> 622 <Filename Value=" UMainForm.pas"/>623 <Caret Line=" 201" Column="1" TopLine="182"/>717 <Filename Value="../Units/GenericMatrix.pas"/> 718 <Caret Line="59" Column="40" TopLine="36"/> 624 719 </Position16> 625 720 <Position17> 626 <Filename Value=" UMainForm.pas"/>627 <Caret Line=" 202" Column="1" TopLine="191"/>721 <Filename Value="../Units/GenericMatrix.pas"/> 722 <Caret Line="48" Column="39" TopLine="35"/> 628 723 </Position17> 629 724 <Position18> 630 <Filename Value=" UMainForm.pas"/>631 <Caret Line=" 203" Column="1" TopLine="191"/>725 <Filename Value="../Units/GenericMatrix.pas"/> 726 <Caret Line="67" Column="1" TopLine="46"/> 632 727 </Position18> 633 728 <Position19> 634 <Filename Value=" UMainForm.pas"/>635 <Caret Line=" 204" Column="1" TopLine="191"/>729 <Filename Value="../Units/GenericMatrix.pas"/> 730 <Caret Line="104" Column="53" TopLine="91"/> 636 731 </Position19> 637 732 <Position20> 638 <Filename Value=" UMainForm.pas"/>639 <Caret Line=" 205" Column="1" TopLine="191"/>733 <Filename Value="../Units/GenericMatrix.pas"/> 734 <Caret Line="181" Column="26" TopLine="168"/> 640 735 </Position20> 641 736 <Position21> 642 <Filename Value="../Units/Generic Stream.pas"/>643 <Caret Line=" 11" Column="19" TopLine="1"/>737 <Filename Value="../Units/GenericMatrix.pas"/> 738 <Caret Line="53" Column="80" TopLine="40"/> 644 739 </Position21> 645 740 <Position22> 646 <Filename Value="../Units/Generic Stream.pas"/>647 <Caret Line=" 23" Column="32" TopLine="10"/>741 <Filename Value="../Units/GenericMatrix.pas"/> 742 <Caret Line="57" Column="14" TopLine="44"/> 648 743 </Position22> 649 744 <Position23> 650 <Filename Value="../Units/Generic Stream.pas"/>651 <Caret Line=" 38" Column="43" TopLine="25"/>745 <Filename Value="../Units/GenericMatrix.pas"/> 746 <Caret Line="50" Column="39" TopLine="37"/> 652 747 </Position23> 653 748 <Position24> 654 <Filename Value="../Units/Generic Stream.pas"/>655 <Caret Line=" 43" Column="40" TopLine="30"/>749 <Filename Value="../Units/GenericMatrix.pas"/> 750 <Caret Line="57" Column="14" TopLine="44"/> 656 751 </Position24> 657 752 <Position25> 658 <Filename Value="../Units/Generic Stream.pas"/>659 <Caret Line=" 64" Column="52" TopLine="51"/>753 <Filename Value="../Units/GenericMatrix.pas"/> 754 <Caret Line="49" Column="3" TopLine="37"/> 660 755 </Position25> 661 756 <Position26> 662 <Filename Value="../Units/Generic Stream.pas"/>663 <Caret Line=" 105" Column="23" TopLine="90"/>757 <Filename Value="../Units/GenericMatrix.pas"/> 758 <Caret Line="54" Column="35" TopLine="41"/> 664 759 </Position26> 665 760 <Position27> 666 <Filename Value="../Units/Generic Stream.pas"/>667 <Caret Line=" 38" Column="11" TopLine="25"/>761 <Filename Value="../Units/GenericMatrix.pas"/> 762 <Caret Line="49" Column="1" TopLine="41"/> 668 763 </Position27> 669 764 <Position28> 670 <Filename Value="../Units/Generic Stream.pas"/>671 <Caret Line=" 199" Column="15" TopLine="174"/>765 <Filename Value="../Units/GenericMatrix.pas"/> 766 <Caret Line="56" Column="1" TopLine="44"/> 672 767 </Position28> 673 768 <Position29> 674 <Filename Value=" UMainForm.pas"/>675 <Caret Line=" 744" Column="81" TopLine="1"/>769 <Filename Value="../Units/GenericMatrix.pas"/> 770 <Caret Line="639" Column="28" TopLine="628"/> 676 771 </Position29> 677 772 <Position30> 678 <Filename Value=" UMainForm.pas"/>679 <Caret Line="1 84" Column="13" TopLine="171"/>773 <Filename Value="../Units/GenericMatrix.pas"/> 774 <Caret Line="107" Column="18" TopLine="91"/> 680 775 </Position30> 681 776 </JumpHistory> … … 732 827 <WatchKind Value="wpkWrite"/> 733 828 <Source Value="UMainForm.pas"/> 734 <Line Value="20 5"/>829 <Line Value="204"/> 735 830 </Item1> 736 831 </BreakPoints> -
Generics/NativeGenerics/Demo/UMainForm.pas
r323 r324 45 45 public 46 46 MeasureDuration: TDateTime; 47 Bitmap: TBitmap;48 47 procedure UpdateButtonState(Enabled: Boolean); 49 48 procedure WriteOutput(Text1: string = ''; Text2: string = ''); -
Generics/NativeGenerics/NativeGenerics.lpk
r321 r324 28 28 <License Value="GNU/GPL"/> 29 29 <Version Minor="1"/> 30 <Files Count="1 1">30 <Files Count="12"> 31 31 <Item1> 32 32 <Filename Value="ReadMe.txt"/> … … 66 66 </Item9> 67 67 <Item10> 68 <Filename Value="Units\ SpecializedList.pas"/>69 <UnitName Value=" SpecializedList"/>68 <Filename Value="Units\GenericMatrix.pas"/> 69 <UnitName Value="GenericMatrix"/> 70 70 </Item10> 71 71 <Item11> 72 <Filename Value="Units\Generic Matrix.pas"/>73 <UnitName Value="Generic Matrix"/>72 <Filename Value="Units\GenericString.pas"/> 73 <UnitName Value="GenericString"/> 74 74 </Item11> 75 <Item12> 76 <Filename Value="Units\GenericBitmap.pas"/> 77 <UnitName Value="GenericBitmap"/> 78 </Item12> 75 79 </Files> 76 80 <Type Value="RunAndDesignTime"/> -
Generics/NativeGenerics/NativeGenerics.pas
r321 r324 9 9 uses 10 10 GenericList, GenericTree, GenericDictionary, GenericQueue, GenericRange, 11 GenericSet, GenericStack, GenericStream, SpecializedList, GenericMatrix,12 LazarusPackageIntf;11 GenericSet, GenericStack, GenericStream, GenericMatrix, GenericString, 12 GenericBitmap, LazarusPackageIntf; 13 13 14 14 implementation -
Generics/NativeGenerics/Units/GenericList.pas
r322 r324 10 10 type 11 11 12 { TG List }13 14 TG List<TItem> = class12 { TGAbstractList } 13 14 TGAbstractList<TItem> = class 15 15 public 16 16 type … … 21 21 TItemArray = array of TItem; 22 22 private 23 function GetLast: TItem; virtual; abstract; 24 procedure SetLast(AValue: TItem); virtual; abstract; 25 function GetFirst: TItem; virtual; abstract; 26 procedure SetFirst(AValue: TItem); virtual; abstract; 27 function GetCount: TIndex; virtual; abstract; 28 procedure SetCount(const AValue: TIndex); virtual; abstract; 29 procedure SetCapacity(const AValue: TIndex); virtual; abstract; 30 function GetCapacity: TIndex; virtual; abstract; 31 function Get(Index: TIndex): TItem; virtual; abstract; 32 procedure Put(Index: TIndex; const AValue: TItem); virtual; abstract; 33 public 34 constructor Create; virtual; 35 property Count: TIndex read GetCount write SetCount; 36 property Capacity: TIndex read GetCapacity write SetCapacity; 37 property Items[Index: TIndex]: TItem read Get write Put; default; 38 property First: TItem read GetFirst write SetFirst; 39 property Last: TItem read GetLast write SetLast; 40 end; 41 42 { TGList } 43 44 TGList<TItem> = class(TGAbstractList<TItem>) 45 private 23 46 FCount: TIndex; 24 47 FItems: array of TItem; 25 function Get(Index: TIndex): TItem; 26 function GetCapacity: TIndex; 27 function GetFirst: TItem; 28 function GetLast: TItem; 29 procedure SetCapacity(const AValue: TIndex); 48 function Get(Index: TIndex): TItem; override; 49 function GetCapacity: TIndex; override; 50 function GetFirst: TItem; override; 51 function GetLast: TItem; override; 52 function GetCount: TIndex; override; 53 procedure SetCapacity(const AValue: TIndex); override; 30 54 procedure SetCapacityOptimized(const NewCapacity: TIndex); 31 procedure SetCount(const AValue: TIndex); 32 procedure SetFirst(AValue: TItem); 33 procedure SetLast(AValue: TItem); 34 procedure Put(Index: TIndex; const AValue: TItem); virtual;55 procedure SetCount(const AValue: TIndex); override; 56 procedure SetFirst(AValue: TItem); override; 57 procedure SetLast(AValue: TItem); override; 58 procedure Put(Index: TIndex; const AValue: TItem); override; 35 59 procedure QuickSort(L, R : TIndex; Compare: TSortCompare); 36 60 public … … 47 71 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 48 72 function Extract(Item: TItem): TItem; 49 property First: TItem read GetFirst write SetFirst;50 73 procedure Fill(Start, Count: TIndex; Value: TItem); 51 74 function GetArray(Index, ACount: TIndex): TItemArray; … … 68 91 procedure Sort(Compare: TSortCompare); 69 92 procedure SetArray(Values: array of TItem); 70 property Count: TIndex read FCount write SetCount;71 property Capacity: TIndex read GetCapacity write SetCapacity;72 property Items[Index: TIndex]: TItem read Get write Put; default;73 property Last: TItem read GetLast write SetLast;74 93 end; 75 94 … … 82 101 procedure Clear; override; 83 102 procedure Assign(Source: TGList<TItem>); override; 84 constructor Create; 103 constructor Create; override; 85 104 destructor Destroy; override; 86 105 end; … … 286 305 end; 287 306 307 function TGList<TItem>.GetCount: TIndex; 308 begin 309 Result := FCount; 310 end; 311 288 312 procedure TGList<TItem>.SetLast(AValue: TItem); 289 313 begin … … 663 687 end; 664 688 689 { TGAbstractList<TItem> } 690 691 constructor TGAbstractList<TItem>.Create; 692 begin 693 end; 694 665 695 end. -
Generics/NativeGenerics/Units/GenericMatrix.pas
r321 r324 9 9 10 10 type 11 TG Matrix<TItem> = class11 TGAbstractMatrix<TItem> = class 12 12 public 13 13 type … … 24 24 Y: TIndexY; 25 25 end; 26 protected 27 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; virtual; abstract; 28 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); virtual; abstract; 29 function GetItem(Index: TIndex): TItem; virtual; abstract; 30 function GetCapacity: TIndex; virtual; abstract; 31 function GetLast: TItem; virtual; abstract; 32 function GetFirst: TItem; virtual; abstract; 33 function GetCount: TIndex; virtual; abstract; 34 procedure SetLast(AValue: TItem); virtual; abstract; 35 procedure SetFirst(AValue: TItem); virtual; abstract; 36 procedure PutItem(Index: TIndex; const AValue: TItem); virtual; abstract; 37 procedure SetCount(const AValue: TIndex); virtual; abstract; 38 public 39 property Count: TIndex read GetCount write SetCount; 40 property ItemsXY[X: TIndexX; Y: TIndexY]: TItem 41 read GetItemXY write PutItemXY; default; 42 property Items[Index: TIndex]: TItem 43 read GetItem write PutItem; 44 property Last: TItem read GetLast write SetLast; 45 end; 46 47 TGMatrix<TItem> = class(TGAbstractMatrix<TItem>) 48 public 49 type 50 TIndex = TGAbstractMatrix<TItem>.TIndex; 51 protected 52 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; override; 53 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); override; 54 function GetItem(Index: TIndex): TItem; override; 55 function GetLast: TItem; override; 56 function GetFirst: TItem; override; 57 function GetCount: TIndex; override; 58 procedure SetLast(AValue: TItem); override; 59 procedure SetFirst(AValue: TItem); override; 60 procedure PutItem(Index: TIndex; const AValue: TItem); override; 61 procedure SetCount(const AValue: TIndex); override; 26 62 private 27 63 FItems: array of array of TItem; 28 64 FCount: TIndex; 29 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; 30 function GetItem(Index: TIndex): TItem; 31 function GetCapacity: TIndex; 32 function GetLast: TItem; 33 function GetFirst: TItem; 65 function GetCapacity: TIndex; override; 34 66 procedure SetCapacity(const AValue: TIndex); 35 procedure SetLast(AValue: TItem);36 procedure SetFirst(AValue: TItem);37 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); virtual;38 procedure PutItem(Index: TIndex; const AValue: TItem); virtual;39 procedure SetCount(const AValue: TIndex);40 67 public 41 68 function Add(Item: TItem): TIndex; … … 72 99 procedure Sort(Compare: TSortCompare); 73 100 procedure SetArray(Values: array of TItem); 74 property Count: TIndex read FCount write SetCount;75 101 property Capacity: TIndex read GetCapacity write SetCapacity; 76 property ItemsXY[X: TIndexX; Y: TIndexY]: TItem 77 read GetItemXY write PutItemXY; default; 78 property Items[Index: TIndex]: TItem 79 read GetItem write PutItem; 80 property Last: TItem read GetLast write SetLast; 102 end; 103 104 TGRawMatrix<TItem> = class(TGAbstractMatrix<TItem>) 105 public 106 type 107 TIndex = TGAbstractMatrix<TItem>.TIndex; 108 private 109 FData: Pointer; 110 FCount: TIndex; 81 111 end; 82 112 … … 620 650 end; 621 651 652 function TGMatrix<TItem>.GetCount: TIndex; 653 begin 654 Result := FCount; 655 end; 656 657 622 658 end.
Note:
See TracChangeset
for help on using the changeset viewer.