Changeset 333


Ignore:
Timestamp:
Feb 20, 2012, 12:48:51 PM (13 years ago)
Author:
chronos
Message:
  • Added: Generic Rectangle class TGRectangle<TDimension>. Introduced specialized classes TRectangleInteger, TRectangleSmallInt, TRectangleSingle, TRectangleDouble.
  • TemplateGenerics version raised to 0.4.
Location:
Generics/TemplateGenerics
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Generic/GenericPoint.inc

    r101 r333  
    11{$IFDEF INTERFACE}
    22
    3 // TGPoint<TPointCoord, TPointType> = class
     3// TGPoint<TPointType> = class
    44TGPoint = 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);
    78end;
    89
     
    1213{$IFDEF IMPLEMENTATION}
    1314
     15procedure TGPoint.Add(Point: TGPoint);
     16begin
     17  X := X + Point.X;
     18  Y := Y + Point.Y;
     19end;
    1420
    1521{$UNDEF IMPLEMENTATION}
  • Generics/TemplateGenerics/Specialized/SpecializedPoint.pas

    r101 r333  
    1111
    1212type
    13   TPoint2DIndex = (piX, piY);
    14 
    15 // TPoint2D<TPoint2DIndex, Integer>
    16 {$DEFINE TGPointIndex := TPoint2DIndex}
     13// TPoint<Integer>
    1714{$DEFINE TGPointType := Integer}
    18 {$DEFINE TGPoint := TPoint2D}
     15{$DEFINE TGPoint := TPoint}
    1916{$DEFINE INTERFACE}
    2017{$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
    2137implementation
    2238
    23 // TPoint2D<TPoint2DIndex, Integer>
    24 {$DEFINE TGPointIndex := T2DPointIndex}
     39// TPoint<Integer>
    2540{$DEFINE TGPointType := Integer}
    26 {$DEFINE TGPoint := TPoint2D}
     41{$DEFINE TGPoint := TPoint}
    2742{$DEFINE IMPLEMENTATION}
    2843{$I 'GenericPoint.inc'}
    2944
     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'}
    3062end.
    3163
  • Generics/TemplateGenerics/TemplateGenerics.lpk

    r312 r333  
    2929    <Description Value="Generic classes implemented as templates."/>
    3030    <Version Minor="3"/>
    31     <Files Count="24">
     31    <Files Count="26">
    3232      <Item1>
    3333        <Filename Value="ReadMe.txt"/>
     
    8787      </Item14>
    8888      <Item15>
     89        <Filename Value="Generic\GenericRectangle.inc"/>
     90      </Item15>
     91      <Item16>
    8992        <Filename Value="Specialized\SpecializedList.pas"/>
    9093        <UnitName Value="SpecializedList"/>
    91       </Item15>
    92       <Item16>
     94      </Item16>
     95      <Item17>
    9396        <Filename Value="Specialized\SpecializedDictionary.pas"/>
    9497        <UnitName Value="SpecializedDictionary"/>
    95       </Item16>
    96       <Item17>
     98      </Item17>
     99      <Item18>
    97100        <Filename Value="Specialized\SpecializedStack.pas"/>
    98101        <UnitName Value="SpecializedStack"/>
    99       </Item17>
    100       <Item18>
     102      </Item18>
     103      <Item19>
    101104        <Filename Value="Specialized\SpecializedTree.pas"/>
    102105        <UnitName Value="SpecializedTree"/>
    103       </Item18>
    104       <Item19>
     106      </Item19>
     107      <Item20>
    105108        <Filename Value="Specialized\SpecializedQueue.pas"/>
    106109        <UnitName Value="SpecializedQueue"/>
    107       </Item19>
    108       <Item20>
     110      </Item20>
     111      <Item21>
    109112        <Filename Value="Specialized\SpecializedSet.pas"/>
    110113        <UnitName Value="SpecializedSet"/>
    111       </Item20>
    112       <Item21>
     114      </Item21>
     115      <Item22>
    113116        <Filename Value="Specialized\SpecializedPoint.pas"/>
    114117        <UnitName Value="SpecializedPoint"/>
    115       </Item21>
    116       <Item22>
     118      </Item22>
     119      <Item23>
    117120        <Filename Value="Specialized\SpecializedMatrix.pas"/>
    118121        <UnitName Value="SpecializedMatrix"/>
    119       </Item22>
    120       <Item23>
     122      </Item23>
     123      <Item24>
    121124        <Filename Value="Specialized\SpecializedBitmap.pas"/>
    122125        <UnitName Value="SpecializedBitmap"/>
    123       </Item23>
    124       <Item24>
     126      </Item24>
     127      <Item25>
    125128        <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>
    128135    </Files>
    129136    <Type Value="RunAndDesignTime"/>
  • Generics/TemplateGenerics/TemplateGenerics.pas

    r312 r333  
    33 }
    44
    5 unit TemplateGenerics; 
     5unit TemplateGenerics;
    66
    77interface
     
    1010  SpecializedList, SpecializedDictionary, SpecializedStack, SpecializedTree,
    1111  SpecializedQueue, SpecializedSet, SpecializedPoint, SpecializedMatrix,
    12   SpecializedBitmap, SpecializedStream, LazarusPackageIntf;
     12  SpecializedBitmap, SpecializedStream, SpecializedRectangle,
     13  LazarusPackageIntf;
    1314
    1415implementation
    1516
    16 procedure Register; 
     17procedure Register;
    1718begin
    18 end; 
     19end;
    1920
    2021initialization
    21   RegisterPackage('TemplateGenerics', @Register); 
     22  RegisterPackage('TemplateGenerics', @Register);
    2223end.
Note: See TracChangeset for help on using the changeset viewer.