Changeset 333
- Timestamp:
- Feb 20, 2012, 12:48:51 PM (13 years ago)
- Location:
- Generics/TemplateGenerics
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Generic/GenericPoint.inc
r101 r333 1 1 {$IFDEF INTERFACE} 2 2 3 // TGPoint<TPoint Coord, TPointType> = class3 // TGPoint<TPointType> = class 4 4 TGPoint = class 5 Coordinate: array[TGPointIndex] of TGPointType; 6 //procedure SetArray(Items: array[TGPointIndex] of TGPointType); 5 X: TGPointType; 6 Y: TGPointType; 7 procedure Add(Point: TGPoint); 7 8 end; 8 9 … … 12 13 {$IFDEF IMPLEMENTATION} 13 14 15 procedure TGPoint.Add(Point: TGPoint); 16 begin 17 X := X + Point.X; 18 Y := Y + Point.Y; 19 end; 14 20 15 21 {$UNDEF IMPLEMENTATION} -
Generics/TemplateGenerics/Specialized/SpecializedPoint.pas
r101 r333 11 11 12 12 type 13 TPoint2DIndex = (piX, piY); 14 15 // TPoint2D<TPoint2DIndex, Integer> 16 {$DEFINE TGPointIndex := TPoint2DIndex} 13 // TPoint<Integer> 17 14 {$DEFINE TGPointType := Integer} 18 {$DEFINE TGPoint := TPoint 2D}15 {$DEFINE TGPoint := TPoint} 19 16 {$DEFINE INTERFACE} 20 17 {$I 'GenericPoint.inc'} 18 19 // TSmallPoint<SmallInt> 20 {$DEFINE TGPointType := SmallInt} 21 {$DEFINE TGPoint := TSmallPoint} 22 {$DEFINE INTERFACE} 23 {$I 'GenericPoint.inc'} 24 25 // TPointSingle<Single> 26 {$DEFINE TGPointType := Single} 27 {$DEFINE TGPoint := TPointSingle} 28 {$DEFINE INTERFACE} 29 {$I 'GenericPoint.inc'} 30 31 // TPointDouble<Double> 32 {$DEFINE TGPointType := Double} 33 {$DEFINE TGPoint := TPointDouble} 34 {$DEFINE INTERFACE} 35 {$I 'GenericPoint.inc'} 36 21 37 implementation 22 38 23 // TPoint2D<TPoint2DIndex, Integer> 24 {$DEFINE TGPointIndex := T2DPointIndex} 39 // TPoint<Integer> 25 40 {$DEFINE TGPointType := Integer} 26 {$DEFINE TGPoint := TPoint 2D}41 {$DEFINE TGPoint := TPoint} 27 42 {$DEFINE IMPLEMENTATION} 28 43 {$I 'GenericPoint.inc'} 29 44 45 // TSmallPoint<SmallInt> 46 {$DEFINE TGPointType := SmallInt} 47 {$DEFINE TGPoint := TSmallPoint} 48 {$DEFINE IMPLEMENTATION} 49 {$I 'GenericPoint.inc'} 50 51 // TPointSingle<Single> 52 {$DEFINE TGPointType := Single} 53 {$DEFINE TGPoint := TPointSingle} 54 {$DEFINE IMPLEMENTATION} 55 {$I 'GenericPoint.inc'} 56 57 // TPointDouble<Double> 58 {$DEFINE TGPointType := Double} 59 {$DEFINE TGPoint := TPointDouble} 60 {$DEFINE IMPLEMENTATION} 61 {$I 'GenericPoint.inc'} 30 62 end. 31 63 -
Generics/TemplateGenerics/TemplateGenerics.lpk
r312 r333 29 29 <Description Value="Generic classes implemented as templates."/> 30 30 <Version Minor="3"/> 31 <Files Count="2 4">31 <Files Count="26"> 32 32 <Item1> 33 33 <Filename Value="ReadMe.txt"/> … … 87 87 </Item14> 88 88 <Item15> 89 <Filename Value="Generic\GenericRectangle.inc"/> 90 </Item15> 91 <Item16> 89 92 <Filename Value="Specialized\SpecializedList.pas"/> 90 93 <UnitName Value="SpecializedList"/> 91 </Item1 5>92 <Item1 6>94 </Item16> 95 <Item17> 93 96 <Filename Value="Specialized\SpecializedDictionary.pas"/> 94 97 <UnitName Value="SpecializedDictionary"/> 95 </Item1 6>96 <Item1 7>98 </Item17> 99 <Item18> 97 100 <Filename Value="Specialized\SpecializedStack.pas"/> 98 101 <UnitName Value="SpecializedStack"/> 99 </Item1 7>100 <Item1 8>102 </Item18> 103 <Item19> 101 104 <Filename Value="Specialized\SpecializedTree.pas"/> 102 105 <UnitName Value="SpecializedTree"/> 103 </Item1 8>104 <Item 19>106 </Item19> 107 <Item20> 105 108 <Filename Value="Specialized\SpecializedQueue.pas"/> 106 109 <UnitName Value="SpecializedQueue"/> 107 </Item 19>108 <Item2 0>110 </Item20> 111 <Item21> 109 112 <Filename Value="Specialized\SpecializedSet.pas"/> 110 113 <UnitName Value="SpecializedSet"/> 111 </Item2 0>112 <Item2 1>114 </Item21> 115 <Item22> 113 116 <Filename Value="Specialized\SpecializedPoint.pas"/> 114 117 <UnitName Value="SpecializedPoint"/> 115 </Item2 1>116 <Item2 2>118 </Item22> 119 <Item23> 117 120 <Filename Value="Specialized\SpecializedMatrix.pas"/> 118 121 <UnitName Value="SpecializedMatrix"/> 119 </Item2 2>120 <Item2 3>122 </Item23> 123 <Item24> 121 124 <Filename Value="Specialized\SpecializedBitmap.pas"/> 122 125 <UnitName Value="SpecializedBitmap"/> 123 </Item2 3>124 <Item2 4>126 </Item24> 127 <Item25> 125 128 <Filename Value="Specialized\SpecializedStream.pas"/> 126 <UnitName Value="SpecializedStack"/> 127 </Item24> 129 <UnitName Value="SpecializedStream"/> 130 </Item25> 131 <Item26> 132 <Filename Value="Specialized\SpecializedRectangle.pas"/> 133 <UnitName Value="SpecializedRectangle"/> 134 </Item26> 128 135 </Files> 129 136 <Type Value="RunAndDesignTime"/> -
Generics/TemplateGenerics/TemplateGenerics.pas
r312 r333 3 3 } 4 4 5 unit TemplateGenerics; 5 unit TemplateGenerics; 6 6 7 7 interface … … 10 10 SpecializedList, SpecializedDictionary, SpecializedStack, SpecializedTree, 11 11 SpecializedQueue, SpecializedSet, SpecializedPoint, SpecializedMatrix, 12 SpecializedBitmap, SpecializedStream, LazarusPackageIntf; 12 SpecializedBitmap, SpecializedStream, SpecializedRectangle, 13 LazarusPackageIntf; 13 14 14 15 implementation 15 16 16 procedure Register; 17 procedure Register; 17 18 begin 18 end; 19 end; 19 20 20 21 initialization 21 RegisterPackage('TemplateGenerics', @Register); 22 RegisterPackage('TemplateGenerics', @Register); 22 23 end.
Note:
See TracChangeset
for help on using the changeset viewer.