Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,463 changes: 1,463 additions & 0 deletions jcl/source/common/JclContainerIntf.pas

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions jcl/source/common/JclPreProcessorContainerIntfTemplates.pas
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ TJclContainerIntfAncestorParams = class(TJclContainerIntf1DParams)
property AncestorName: string read GetAncestorName write FAncestorName stored IsAncestorNameStored;
end;

TJclContainerIntfAncestor2DParams = class(TJclContainerIntf2DParams)
protected
FAncestorName: string;
function GetAncestorName: string; virtual;
function IsAncestorNameStored: Boolean;
public
property AncestorName: string read GetAncestorName write FAncestorName stored IsAncestorNameStored;
end;

TJclContainerIntfFlatAncestorParams = class(TJclContainerIntfAncestorParams)
protected
function GetAncestorName: string; override;
Expand Down Expand Up @@ -237,6 +246,19 @@ TJclBinaryTreeIteratorParams = class(TJclContainerIntf1DParams)
property TypeName: string index taTypeName read GetTypeAttribute write SetTypeAttribute stored False;
end;

(* SORTEDMAPENTRYITERATOR(INTERFACENAME, ANCESTORNAME, GUID, TYPENAME) *)
TJclSortedMapEntryIteratorParams = class(TJclContainerIntfAncestor2DParams)
protected
function GetAncestorName: string; override;
public
function AliasAttributeIDs: TAllTypeAttributeIDs; override;
published
property InterfaceName: string index maSortedMapEntryIteratorInterfaceName read GetMapAttribute write SetMapAttribute stored IsMapAttributeStored;
property AncestorName;
property GUID: string index maSortedMapEntryIteratorInterfaceGUID read GetMapAttribute write SetMapAttribute stored IsMapAttributeStored;
property TypeName: string index maSortedMapEntryTypeName read GetMapAttribute write SetMapAttribute stored False;
end;

(* COLLECTION(INTERFACENAME, ANCESTORNAME, GUID, CONSTKEYWORD, PARAMETERNAME, TYPENAME, ITRNAME) *)
TJclCollectionParams = class(TJclContainerIntfFlatAncestorParams)
public
Expand Down Expand Up @@ -412,6 +434,7 @@ procedure RegisterJclContainers;
RegisterContainerParams('ITERATOR', TJclIteratorParams);
RegisterContainerParams('TREEITERATOR', TJclTreeIteratorParams);
RegisterContainerParams('BINTREEITERATOR', TJclBinaryTreeIteratorParams);
RegisterContainerParams('SORTEDMAPENTRYITERATOR', TJclSortedMapEntryIteratorParams);
RegisterContainerParams('COLLECTION', TJclCollectionParams);
RegisterContainerParams('LIST', TJclListParams);
RegisterContainerParams('ARRAY', TJclArrayParams);
Expand Down Expand Up @@ -440,6 +463,22 @@ function TJclContainerIntfAncestorParams.IsAncestorNameStored: Boolean;
Result := FAncestorName <> '';
end;

//=== { TJclContainerIntfAncestor2DParams } ==================================

function TJclContainerIntfAncestor2DParams.GetAncestorName: string;
begin
Result := FAncestorName;
if Result = '' then
Result := MapInfo.MapAttributes[maMapInterfaceAncestorName];
if Result = '' then
Result := 'IJclBaseContainer';
end;

function TJclContainerIntfAncestor2DParams.IsAncestorNameStored: Boolean;
begin
Result := FAncestorName <> '';
end;

//=== { TJclIteratorParams } =================================================

function TJclIteratorParams.AliasAttributeIDs: TAllTypeAttributeIDs;
Expand Down Expand Up @@ -574,6 +613,20 @@ function TJclBinaryTreeIteratorParams.AliasAttributeIDs: TAllTypeAttributeIDs;
Result := [taBinaryTreeIteratorInterfaceName];
end;

//=== { TJclSortedMapEntryIteratorParams } ===================================

function TJclSortedMapEntryIteratorParams.AliasAttributeIDs: TAllTypeAttributeIDs;
begin
Result := [maSortedMapEntryIteratorInterfaceName];
end;

function TJclSortedMapEntryIteratorParams.GetAncestorName: string;
begin
Result := FAncestorName;
if Result = '' then
Result := 'IJclAbstractIterator';
end;

//=== { TJclCollectionParams } ===============================================

function TJclCollectionParams.AliasAttributeIDs: TAllTypeAttributeIDs;
Expand Down
357 changes: 255 additions & 102 deletions jcl/source/common/JclPreProcessorContainerKnownMaps.pas

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions jcl/source/common/JclPreProcessorContainerTypes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ interface
maHashMapClassName,
maSortedMapEntryTypeName,
maSortedMapEntryArrayTypeName,
maSortedMapEntryIteratorInterfaceName,
maSortedMapEntryIteratorInterfaceGUID,
maSortedMapEntryIteratorClassName,
maSortedMapClassName);
TAllTypeAttributeIDs = set of TAllTypeAttributeID;

Expand Down Expand Up @@ -353,8 +356,11 @@ TTypeAttributeInfo = record
{HashMapEntryArrayTypeName} (IsGUID: False; DefaultValue: 'TJcl%s%sHashEntryArray'),
{HashMapBucketTypeName} (IsGUID: False; DefaultValue: 'TJcl%s%sHashBucket'),
{HashMapClassName} (IsGUID: False; DefaultValue: 'TJcl%s%sHashMap'),
{SortedMapEntryTypeName} (IsGUID: False; DefaultValue: 'TJcl%s%sSortedEntry'),
{SortedMapEntryArrayTypeName} (IsGUID: False; DefaultValue: 'TJcl%s%sSortedEntryArray'),
{SortedMapEntryTypeName} (IsGUID: False; DefaultValue: 'TJcl%s%sMapEntry'),
{SortedMapEntryArrayTypeName} (IsGUID: False; DefaultValue: 'TJcl%s%sMapEntryArray'),
{SortedMapEntryIteratorInterfaceName} (IsGUID: False; DefaultValue: 'IJcl%s%sSortedMapIterator'),
{SortedMapEntryIteratorInterfaceGUID} (IsGUID: True; DefaultValue: ''),
{SortedMapEntryIteratorClassName} (IsGUID: False; DefaultValue: 'TJcl%s%sSortedMapIterator'),
{SortedMapClassName} (IsGUID: False; DefaultValue: 'TJcl%s%sSortedMap') );

type
Expand Down
40 changes: 39 additions & 1 deletion jcl/source/common/JclPreProcessorSortedMapsTemplates.pas
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TJclSortedMapTypeIntParams = class(TJclMapInterfaceParams)
end;

(* JCLSORTEDMAPINT(ENTRYTYPENAME, ENTRYARRAYTYPENAME, SELFCLASSNAME, ANCESTORNAME,
STDMAPINTERFACENAME, SORTEDMAPINTERFACENAME,
STDMAPINTERFACENAME, SORTEDMAPINTERFACENAME, ITRINTERFACENAME,
KEYSETINTERFACENAME, VALUECOLLECTIONINTERFACENAME,
INTERFACEADDITIONAL, SECTIONADDITIONAL, KEYOWNERSHIPDECLARATION,
VALUEOWNERSHIPDECLARATION, KEYCONSTKEYWORD, KEYTYPENAME,
Expand All @@ -72,6 +72,7 @@ TJclSortedMapIntParams = class(TJclMapClassInterfaceParams)
property AncestorName: string index maMapAncestorClassName read GetMapAttribute write SetMapAttribute stored False;
property StdMapInterfaceName: string index maMapInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property SortedMapInterfaceName: string index maSortedMapInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property ItrInterfaceName: string index maSortedMapEntryIteratorInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property KeySetInterfaceName: string index kaKeySetInterfaceName read GetKeyAttribute write SetKeyAttribute stored False;
property ValueCollectionInterfaceName: string index vaValueCollectionInterfaceName read GetValueAttribute write SetValueAttribute stored False;
property InterfaceAdditional;
Expand All @@ -84,8 +85,23 @@ TJclSortedMapIntParams = class(TJclMapClassInterfaceParams)
property ValueTypeName;
end;

(* JCLSORTEDMAPITRINT(SELFCLASSNAME, ITRINTERFACENAME, MAPCLASSNAME, TYPENAME) *)
TJclSortedMapItrIntParams = class(TJclMapInterfaceParams)
protected
// function CodeUnit: string; override;
public
function AliasAttributeIDs: TAllTypeAttributeIDs; override;
published
property SelfClassName: string index maSortedMapEntryIteratorClassName read GetMapAttribute write SetMapAttribute stored IsMapAttributeStored;
property ItrInterfaceName: string index maSortedMapEntryIteratorInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property GUID: string index maSortedMapEntryIteratorInterfaceGUID read GetMapAttribute write SetMapAttribute stored False;
property MapClassName: string index maSortedMapClassName read GetMapAttribute write SetMapAttribute stored False;
property TypeName: string index maSortedMapEntryTypeName read GetMapAttribute write SetMapAttribute stored False;
end;

(* JCLSORTEDMAPIMP(ENTRYTYPENAME, ENTRYARRAYTYPENAME, SELFCLASSNAME,
STDMAPINTERFACENAME, SORTEDMAPINTERFACENAME,
ENTRYITRINTERFACENAME, ENTRYITRCLASSNAME,
KEYSETINTERFACENAME, KEYITRINTERFACENAME,
VALUECOLLECTIONINTERFACENAME,
KEYOWNERSHIPDECLARATION, VALUEOWNERSHIPDECLARATION,
Expand All @@ -106,6 +122,8 @@ TJclSortedMapImpParams = class(TJclMapClassImplementationParams)
property AncestorClassName: string index maMapAncestorClassName read GetMapAttribute write SetMapAttribute stored False;
property StdMapInterfaceName: string index maMapInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property SortedMapInterfaceName: string index maSortedMapInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property EntryItrInterfaceName: string index maSortedMapEntryIteratorInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property EntryItrClassName: string index maSortedMapEntryIteratorClassName read GetMapAttribute write SetMapAttribute stored False;
property KeySetInterfaceName: string index kaKeySetInterfaceName read GetKeyAttribute write SetKeyAttribute stored False;
property KeyItrInterfaceName: string index kaKeyIteratorInterfaceName read GetKeyAttribute write SetKeyAttribute stored False;
property ValueCollectionInterfaceName: string index vaValueCollectionInterfaceName read GetValueAttribute write SetValueAttribute stored False;
Expand All @@ -127,6 +145,17 @@ TJclSortedMapImpParams = class(TJclMapClassImplementationParams)
property MacroFooter;
end;

(* JCLSORTEDMAPITRIMP(SELFCLASSNAME, ITRINTERFACENAME, MAPCLASSNAME, TYPENAME) *)
TJclSortedMapItrImpParams = class(TJclMapImplementationParams)
protected
// function CodeUnit: string; override;
published
property SelfClassName: string index maSortedMapEntryIteratorClassName read GetMapAttribute write SetMapAttribute stored False;
property ItrInterfaceName: string index maSortedMapEntryIteratorInterfaceName read GetMapAttribute write SetMapAttribute stored False;
property MapClassName: string index maSortedMapClassName read GetMapAttribute write SetMapAttribute stored False;
property TypeName: string index maSortedMapEntryTypeName read GetMapAttribute write SetMapAttribute stored False;
end;

{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
Expand All @@ -153,7 +182,9 @@ procedure RegisterJclContainers;
begin
RegisterContainerParams('JCLSORTEDMAPTYPESINT', TJclSortedMapTypeIntParams);
RegisterContainerParams('JCLSORTEDMAPINT', TJclSortedMapIntParams);
RegisterContainerParams('JCLSORTEDMAPITRINT', TJclSortedMapItrIntParams);
RegisterContainerParams('JCLSORTEDMAPIMP', TJclSortedMapImpParams, TJclSortedMapIntParams);
RegisterContainerParams('JCLSORTEDMAPITRIMP', TJclSortedMapItrImpParams, TJclSortedMapItrIntParams);
end;

//=== { TJclSortedMapTypeIntParams } =========================================
Expand All @@ -177,6 +208,13 @@ function TJclSortedMapIntParams.GetComparisonSectionAdditional: string;
[KeyConstKeyword, KeyTypeName, ValueConstKeyword, ValueTypeName]);
end;

//=== { TJclSortedMapItrIntParams } ==========================================

function TJclSortedMapItrIntParams.AliasAttributeIDs: TAllTypeAttributeIDs;
begin
Result := [maSortedMapEntryIteratorClassName];
end;

//=== { TJclSortedMapImpParams } =============================================

function TJclSortedMapImpParams.GetConstructorParameters: string;
Expand Down
Loading