- Timestamp:
- Nov 8, 2010, 12:29:19 PM (14 years ago)
- Location:
- Generics
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/units/GenericList.pas
r67 r90 9 9 10 10 resourcestring 11 SNotImplemented = 'Not impleme mnted';11 SNotImplemented = 'Not implemented'; 12 12 13 13 type -
Generics/TemplateGenerics/Demo/Demo.lpi
r88 r90 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count="9 1">40 <Units Count="94"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> … … 46 46 <TopLine Value="1"/> 47 47 <CursorPos X="26" Y="8"/> 48 <UsageCount Value="6 3"/>48 <UsageCount Value="64"/> 49 49 <DefaultSyntaxHighlighter Value="Delphi"/> 50 50 </Unit0> … … 59 59 <WindowIndex Value="0"/> 60 60 <TopLine Value="1"/> 61 <CursorPos X=" 35" Y="10"/>62 <UsageCount Value="6 3"/>61 <CursorPos X="15" Y="33"/> 62 <UsageCount Value="64"/> 63 63 <Loaded Value="True"/> 64 64 <LoadedDesigner Value="True"/> … … 679 679 <Unit78> 680 680 <Filename Value="../Generic/GenericList.inc"/> 681 <EditorIndex Value="1 3"/>681 <EditorIndex Value="16"/> 682 682 <WindowIndex Value="0"/> 683 683 <TopLine Value="58"/> 684 684 <CursorPos X="86" Y="71"/> 685 <UsageCount Value="1 3"/>685 <UsageCount Value="14"/> 686 686 <Loaded Value="True"/> 687 687 </Unit78> 688 688 <Unit79> 689 689 <Filename Value="../Generic/GenericDictionary.inc"/> 690 <EditorIndex Value=" 1"/>690 <EditorIndex Value="3"/> 691 691 <WindowIndex Value="0"/> 692 692 <TopLine Value="1"/> 693 693 <CursorPos X="1" Y="10"/> 694 <UsageCount Value="1 3"/>694 <UsageCount Value="14"/> 695 695 <Loaded Value="True"/> 696 696 </Unit79> 697 697 <Unit80> 698 698 <Filename Value="../Generic/GenericObjectList.inc"/> 699 <EditorIndex Value=" 3"/>699 <EditorIndex Value="5"/> 700 700 <WindowIndex Value="0"/> 701 701 <TopLine Value="34"/> 702 702 <CursorPos X="8" Y="56"/> 703 <UsageCount Value="1 3"/>703 <UsageCount Value="14"/> 704 704 <Loaded Value="True"/> 705 705 </Unit80> 706 706 <Unit81> 707 707 <Filename Value="../Generic/GenericQueue.inc"/> 708 <EditorIndex Value=" 6"/>708 <EditorIndex Value="9"/> 709 709 <WindowIndex Value="0"/> 710 710 <TopLine Value="1"/> 711 711 <CursorPos X="1" Y="3"/> 712 <UsageCount Value="1 3"/>712 <UsageCount Value="14"/> 713 713 <Loaded Value="True"/> 714 714 </Unit81> 715 715 <Unit82> 716 716 <Filename Value="../Generic/GenericSet.inc"/> 717 <EditorIndex Value="1 1"/>717 <EditorIndex Value="14"/> 718 718 <WindowIndex Value="0"/> 719 719 <TopLine Value="1"/> 720 720 <CursorPos X="42" Y="11"/> 721 <UsageCount Value="1 3"/>721 <UsageCount Value="14"/> 722 722 <Loaded Value="True"/> 723 723 </Unit82> 724 724 <Unit83> 725 725 <Filename Value="../Generic/GenericStack.inc"/> 726 <EditorIndex Value="1 0"/>726 <EditorIndex Value="13"/> 727 727 <WindowIndex Value="0"/> 728 728 <TopLine Value="1"/> 729 729 <CursorPos X="1" Y="3"/> 730 <UsageCount Value="1 3"/>730 <UsageCount Value="14"/> 731 731 <Loaded Value="True"/> 732 732 </Unit83> 733 733 <Unit84> 734 734 <Filename Value="../Generic/GenericTree.inc"/> 735 <EditorIndex Value="1 2"/>735 <EditorIndex Value="15"/> 736 736 <WindowIndex Value="0"/> 737 737 <TopLine Value="1"/> 738 738 <CursorPos X="22" Y="30"/> 739 <UsageCount Value="1 3"/>739 <UsageCount Value="14"/> 740 740 <Loaded Value="True"/> 741 741 </Unit84> … … 743 743 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 744 744 <UnitName Value="SpecializedDictionary"/> 745 <EditorIndex Value=" 8"/>745 <EditorIndex Value="11"/> 746 746 <WindowIndex Value="0"/> 747 747 <TopLine Value="1"/> 748 748 <CursorPos X="1" Y="13"/> 749 <UsageCount Value="1 2"/>749 <UsageCount Value="13"/> 750 750 <Loaded Value="True"/> 751 751 </Unit85> … … 753 753 <Filename Value="../Specialized/SpecializedStack.pas"/> 754 754 <UnitName Value="SpecializedStack"/> 755 <EditorIndex Value=" 9"/>755 <EditorIndex Value="12"/> 756 756 <WindowIndex Value="0"/> 757 757 <TopLine Value="1"/> 758 758 <CursorPos X="1" Y="13"/> 759 <UsageCount Value="1 1"/>759 <UsageCount Value="12"/> 760 760 <Loaded Value="True"/> 761 761 </Unit86> … … 763 763 <Filename Value="../Specialized/SpecializedTree.pas"/> 764 764 <UnitName Value="SpecializedTree"/> 765 <EditorIndex Value=" 2"/>765 <EditorIndex Value="4"/> 766 766 <WindowIndex Value="0"/> 767 767 <TopLine Value="1"/> 768 768 <CursorPos X="1" Y="11"/> 769 <UsageCount Value="1 1"/>769 <UsageCount Value="12"/> 770 770 <Loaded Value="True"/> 771 771 </Unit87> 772 772 <Unit88> 773 773 <Filename Value="../Generic/GenericRange.inc"/> 774 <EditorIndex Value=" 7"/>774 <EditorIndex Value="10"/> 775 775 <WindowIndex Value="0"/> 776 776 <TopLine Value="1"/> 777 777 <CursorPos X="1" Y="44"/> 778 <UsageCount Value="1 1"/>778 <UsageCount Value="12"/> 779 779 <Loaded Value="True"/> 780 780 </Unit88> … … 782 782 <Filename Value="../Specialized/SpecializedQueue.pas"/> 783 783 <UnitName Value="SpecializedQueue"/> 784 <EditorIndex Value=" 4"/>784 <EditorIndex Value="6"/> 785 785 <WindowIndex Value="0"/> 786 786 <TopLine Value="1"/> 787 787 <CursorPos X="1" Y="13"/> 788 <UsageCount Value="1 1"/>788 <UsageCount Value="12"/> 789 789 <Loaded Value="True"/> 790 790 </Unit89> … … 792 792 <Filename Value="../Specialized/SpecializedSet.pas"/> 793 793 <UnitName Value="SpecializedSet"/> 794 <EditorIndex Value=" 5"/>794 <EditorIndex Value="8"/> 795 795 <WindowIndex Value="0"/> 796 796 <TopLine Value="1"/> 797 797 <CursorPos X="1" Y="13"/> 798 <UsageCount Value="12"/> 799 <Loaded Value="True"/> 800 </Unit90> 801 <Unit91> 802 <Filename Value="../Generic/GenericPoint.inc"/> 803 <EditorIndex Value="1"/> 804 <WindowIndex Value="0"/> 805 <TopLine Value="1"/> 806 <CursorPos X="33" Y="5"/> 798 807 <UsageCount Value="11"/> 799 808 <Loaded Value="True"/> 800 </Unit90> 809 </Unit91> 810 <Unit92> 811 <Filename Value="../Specialized/SpecializedPoint.pas"/> 812 <UnitName Value="SpecializedPoint"/> 813 <EditorIndex Value="2"/> 814 <WindowIndex Value="0"/> 815 <TopLine Value="1"/> 816 <CursorPos X="1" Y="1"/> 817 <UsageCount Value="11"/> 818 <Loaded Value="True"/> 819 </Unit92> 820 <Unit93> 821 <Filename Value="../Specialized/SpecializedObjectList.pas"/> 822 <UnitName Value="SpecializedObjectList"/> 823 <EditorIndex Value="7"/> 824 <WindowIndex Value="0"/> 825 <TopLine Value="1"/> 826 <CursorPos X="1" Y="1"/> 827 <UsageCount Value="11"/> 828 <Loaded Value="True"/> 829 </Unit93> 801 830 </Units> 802 <JumpHistory Count=" 29" HistoryIndex="28">831 <JumpHistory Count="30" HistoryIndex="29"> 803 832 <Position1> 804 833 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 805 <Caret Line=" 22" Column="23" TopLine="1"/>834 <Caret Line="19" Column="42" TopLine="1"/> 806 835 </Position1> 807 836 <Position2> 808 837 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 809 <Caret Line="1 9" Column="42" TopLine="1"/>838 <Caret Line="18" Column="24" TopLine="1"/> 810 839 </Position2> 811 840 <Position3> 812 841 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 813 <Caret Line="1 8" Column="24" TopLine="1"/>842 <Caret Line="19" Column="43" TopLine="1"/> 814 843 </Position3> 815 844 <Position4> 816 845 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 817 <Caret Line=" 19" Column="43" TopLine="1"/>846 <Caret Line="39" Column="5" TopLine="3"/> 818 847 </Position4> 819 848 <Position5> 820 <Filename Value="../Specialized/Specialized Dictionary.pas"/>821 <Caret Line=" 39" Column="5" TopLine="3"/>849 <Filename Value="../Specialized/SpecializedStack.pas"/> 850 <Caret Line="19" Column="36" TopLine="1"/> 822 851 </Position5> 823 852 <Position6> 824 853 <Filename Value="../Specialized/SpecializedStack.pas"/> 825 <Caret Line=" 19" Column="36" TopLine="1"/>854 <Caret Line="5" Column="1" TopLine="1"/> 826 855 </Position6> 827 856 <Position7> 828 <Filename Value="../ Specialized/SpecializedStack.pas"/>829 <Caret Line=" 5" Column="1" TopLine="1"/>857 <Filename Value="../Generic/GenericStack.inc"/> 858 <Caret Line="28" Column="34" TopLine="13"/> 830 859 </Position7> 831 860 <Position8> 832 <Filename Value=" ../Generic/GenericStack.inc"/>833 <Caret Line=" 28" Column="34" TopLine="13"/>861 <Filename Value="UMainForm.pas"/> 862 <Caret Line="9" Column="7" TopLine="1"/> 834 863 </Position8> 835 864 <Position9> 836 865 <Filename Value="UMainForm.pas"/> 837 <Caret Line=" 9" Column="7" TopLine="1"/>866 <Caret Line="10" Column="20" TopLine="1"/> 838 867 </Position9> 839 868 <Position10> 840 869 <Filename Value="UMainForm.pas"/> 841 <Caret Line=" 10" Column="20" TopLine="1"/>870 <Caret Line="20" Column="49" TopLine="1"/> 842 871 </Position10> 843 872 <Position11> 844 873 <Filename Value="UMainForm.pas"/> 845 <Caret Line="2 0" Column="49" TopLine="1"/>874 <Caret Line="22" Column="35" TopLine="1"/> 846 875 </Position11> 847 876 <Position12> 848 877 <Filename Value="UMainForm.pas"/> 849 <Caret Line=" 22" Column="35" TopLine="1"/>878 <Caret Line="110" Column="12" TopLine="81"/> 850 879 </Position12> 851 880 <Position13> 852 881 <Filename Value="UMainForm.pas"/> 853 <Caret Line="1 10" Column="12" TopLine="81"/>882 <Caret Line="133" Column="9" TopLine="103"/> 854 883 </Position13> 855 884 <Position14> 856 885 <Filename Value="UMainForm.pas"/> 857 <Caret Line="1 33" Column="9" TopLine="103"/>886 <Caret Line="162" Column="7" TopLine="136"/> 858 887 </Position14> 859 888 <Position15> 860 889 <Filename Value="UMainForm.pas"/> 861 <Caret Line="1 62" Column="7" TopLine="136"/>890 <Caret Line="171" Column="1" TopLine="152"/> 862 891 </Position15> 863 892 <Position16> 864 893 <Filename Value="UMainForm.pas"/> 865 <Caret Line="1 71" Column="1" TopLine="152"/>894 <Caret Line="190" Column="7" TopLine="165"/> 866 895 </Position16> 867 896 <Position17> 868 897 <Filename Value="UMainForm.pas"/> 869 <Caret Line="1 90" Column="7" TopLine="165"/>898 <Caret Line="188" Column="5" TopLine="168"/> 870 899 </Position17> 871 900 <Position18> 872 901 <Filename Value="UMainForm.pas"/> 873 <Caret Line=" 188" Column="5" TopLine="168"/>902 <Caret Line="393" Column="5" TopLine="364"/> 874 903 </Position18> 875 904 <Position19> 876 <Filename Value=" UMainForm.pas"/>877 <Caret Line="3 93" Column="5" TopLine="364"/>905 <Filename Value="../Specialized/SpecializedQueue.pas"/> 906 <Caret Line="33" Column="32" TopLine="1"/> 878 907 </Position19> 879 908 <Position20> 880 909 <Filename Value="../Specialized/SpecializedQueue.pas"/> 881 <Caret Line=" 33" Column="32" TopLine="1"/>910 <Caret Line="20" Column="34" TopLine="1"/> 882 911 </Position20> 883 912 <Position21> 884 <Filename Value="../Specialized/Specialized Queue.pas"/>885 <Caret Line="2 0" Column="34" TopLine="1"/>913 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 914 <Caret Line="22" Column="36" TopLine="1"/> 886 915 </Position21> 887 916 <Position22> 917 <Filename Value="UMainForm.pas"/> 918 <Caret Line="469" Column="3" TopLine="439"/> 919 </Position22> 920 <Position23> 921 <Filename Value="../Generic/GenericObjectList.inc"/> 922 <Caret Line="14" Column="55" TopLine="1"/> 923 </Position23> 924 <Position24> 925 <Filename Value="UMainForm.pas"/> 926 <Caret Line="89" Column="20" TopLine="70"/> 927 </Position24> 928 <Position25> 888 929 <Filename Value="../Specialized/SpecializedDictionary.pas"/> 889 930 <Caret Line="22" Column="36" TopLine="1"/> 890 </Position22>891 <Position23>892 <Filename Value="UMainForm.pas"/>893 <Caret Line="469" Column="3" TopLine="439"/>894 </Position23>895 <Position24>896 <Filename Value="../Generic/GenericObjectList.inc"/>897 <Caret Line="14" Column="55" TopLine="1"/>898 </Position24>899 <Position25>900 <Filename Value="UMainForm.pas"/>901 <Caret Line="89" Column="20" TopLine="70"/>902 931 </Position25> 903 932 <Position26> 904 <Filename Value="../ Specialized/SpecializedDictionary.pas"/>905 <Caret Line=" 22" Column="36" TopLine="1"/>933 <Filename Value="../Generic/GenericTree.inc"/> 934 <Caret Line="33" Column="25" TopLine="12"/> 906 935 </Position26> 907 936 <Position27> 908 <Filename Value="../ Generic/GenericTree.inc"/>909 <Caret Line=" 33" Column="25" TopLine="12"/>937 <Filename Value="../Specialized/SpecializedTree.pas"/> 938 <Caret Line="82" Column="5" TopLine="47"/> 910 939 </Position27> 911 940 <Position28> 912 <Filename Value=" ../Specialized/SpecializedTree.pas"/>913 <Caret Line=" 82" Column="5" TopLine="47"/>941 <Filename Value="UMainForm.pas"/> 942 <Caret Line="360" Column="51" TopLine="342"/> 914 943 </Position28> 915 944 <Position29> 916 <Filename Value=" UMainForm.pas"/>917 <Caret Line=" 360" Column="51" TopLine="342"/>945 <Filename Value="../Generic/GenericPoint.inc"/> 946 <Caret Line="6" Column="1" TopLine="1"/> 918 947 </Position29> 948 <Position30> 949 <Filename Value="../Generic/GenericPoint.inc"/> 950 <Caret Line="12" Column="62" TopLine="1"/> 951 </Position30> 919 952 </JumpHistory> 920 953 </ProjectOptions> -
Generics/TemplateGenerics/Demo/UMainForm.lfm
r88 r90 1 1 object MainForm: TMainForm 2 Left = 3 792 Left = 388 3 3 Height = 397 4 Top = 12 94 Top = 121 5 5 Width = 478 6 6 Caption = 'Template generics demo' … … 68 68 Left = 8 69 69 Height = 25 70 Top = 3 5270 Top = 367 71 71 Width = 128 72 72 Caption = 'Benchmark list' … … 86 86 Left = 10 87 87 Height = 25 88 Top = 3 2088 Top = 336 89 89 Width = 126 90 90 Caption = 'Benchmark dictionary' -
Generics/TemplateGenerics/Generic/GenericList.inc
r84 r90 14 14 function Get(Index: TGListIndex): TGListItem; 15 15 function GetCapacity: TGListIndex; 16 function GetLast: TGListItem; 17 function GetFirst: TGListItem; 16 18 procedure SetCapacity(const AValue: TGListIndex); 19 procedure SetLast(AValue: TGListItem); 20 procedure SetFirst(AValue: TGListItem); 17 21 procedure Put(Index: TGListIndex; const AValue: TGListItem); virtual; 18 22 procedure SetCount(const AValue: TGListIndex); 19 23 procedure QuickSort(L, R : TGListIndex; Compare: TGListSortCompare); 20 24 public 21 // All items 22 procedure Reverse; 25 function Add(Item: TGListItem): TGListIndex; 26 procedure AddArray(Values: array of TGListItem); 27 procedure AddList(List: TGList); 28 procedure Assign(List: TGList); 23 29 procedure Clear; virtual; 30 procedure Contract; 31 procedure Delete(Index: TGListIndex); virtual; 32 procedure DeleteItems(Index, Count: TGListIndex); 33 function Equals(List: TGList): Boolean; 24 34 procedure Expand; 25 procedure Contract;26 procedure Sort(Compare: TGListSortCompare);27 function Implode(Separator: string; Converter: TGListStringConverter): string;28 // Many items29 procedure MoveItems(CurIndex, NewIndex, Count: TGListIndex);30 procedure DeleteItems(Index, Count: TGListIndex);31 procedure Fill(Start, Count: TGListIndex; Value: TGListItem);32 // One item33 function Add(Item: TGListItem): TGListIndex;34 procedure Delete(Index: TGListIndex); virtual;35 35 function Extract(Item: TGListItem): TGListItem; 36 36 procedure Exchange(Index1, Index2: TGListIndex); 37 function First: TGListItem; 37 property First: TGListItem read GetFirst write SetFirst; 38 procedure Fill(Start, Count: TGListIndex; Value: TGListItem); 39 function Implode(Separator: string; Converter: TGListStringConverter): string; 38 40 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; 41 function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex; 39 42 procedure Insert(Index: TGListIndex; Item: TGListItem); 40 function Last: TGListItem; 43 procedure InsertList(Index: TGListIndex; List: TGList); 44 procedure InsertArray(Index: TGListIndex; Values: array of TGListItem); 41 45 procedure Move(CurIndex, NewIndex: TGListIndex); 46 procedure MoveItems(CurIndex, NewIndex, Count: TGListIndex); 42 47 function Remove(Item: TGListItem): TGListIndex; 43 property Items[Index: TGListIndex]: TGListItem read Get write Put; default; 44 // List 45 procedure AddList(List: TGList); 46 procedure Assign(List: TGList); 47 function Equals(List: TGList): Boolean; 48 procedure InsertList(Index: TGListIndex; List: TGList); 49 function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex; 50 // Other 48 procedure Reverse; 49 procedure Sort(Compare: TGListSortCompare); 50 procedure SetArray(Values: array of TGListItem); 51 51 property Count: TGListIndex read FCount write SetCount; 52 52 property Capacity: TGListIndex read GetCapacity write SetCapacity; 53 // Array 54 procedure AddArray(Values: array of TGListItem); 55 procedure SetArray(Values: array of TGListItem); 56 procedure InsertArray(Index: TGListIndex; Values: array of TGListItem); 53 property Items[Index: TGListIndex]: TGListItem read Get write Put; default; 54 property Last: TGListItem read GetLast write SetLast; 57 55 end; 58 56 … … 172 170 end; 173 171 174 function TGList.First: TGListItem;175 begin176 if FCount = 0 then177 raise EListError.CreateFmt(SListIndexError, [0])178 else179 Result := Items[0];180 end;181 182 172 function TGList.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex; 183 173 begin … … 230 220 end; 231 221 232 function TGList. Last: TGListItem;222 function TGList.GetLast: TGListItem; 233 223 begin 234 224 if FCount = 0 then … … 236 226 else 237 227 Result := Items[FCount - 1]; 228 end; 229 230 procedure TGList.SetLast(AValue: TGListItem); 231 begin 232 if FCount = 0 then 233 raise EListError.CreateFmt(SListIndexError, [0]) 234 else 235 Items[FCount - 1] := AValue; 236 end; 237 238 function TGList.GetFirst: TGListItem; 239 begin 240 if FCount = 0 then 241 raise EListError.CreateFmt(SListIndexError, [0]) 242 else 243 Result := Items[0]; 244 end; 245 246 procedure TGList.SetFirst(AValue: TGListItem); 247 begin 248 if FCount = 0 then 249 raise EListError.CreateFmt(SListIndexError, [0]) 250 else 251 Items[0] := AValue; 238 252 end; 239 253 -
Generics/TemplateGenerics/TemplateGenerics.lpk
r87 r90 19 19 <Description Value="Generic classes implemented as templates."/> 20 20 <Version Minor="2"/> 21 <Files Count="1 6">21 <Files Count="18"> 22 22 <Item1> 23 23 <Filename Value="ReadMe.txt"/> … … 84 84 <UnitName Value="SpecializedObjectList"/> 85 85 </Item16> 86 <Item17> 87 <Filename Value="Generic\GenericPoint.inc"/> 88 </Item17> 89 <Item18> 90 <Filename Value="Specialized\SpecializedPoint.pas"/> 91 <UnitName Value="SpecializedPoint"/> 92 </Item18> 86 93 </Files> 87 94 <Type Value="RunAndDesignTime"/> -
Generics/TemplateGenerics/TemplateGenerics.pas
r87 r90 9 9 uses 10 10 SpecializedList, SpecializedDictionary, SpecializedStack, SpecializedTree, 11 SpecializedQueue, SpecializedSet, SpecializedObjectList, LazarusPackageIntf; 11 SpecializedQueue, SpecializedSet, SpecializedObjectList, SpecializedPoint, 12 LazarusPackageIntf; 12 13 13 14 implementation
Note:
See TracChangeset
for help on using the changeset viewer.