not sure if it applies, but have you considered to use variants?
not sure if it applies, but have you considered to use variants?
I guess you could try using includes and macros. Divide the thing into two files: one include file, which will contain the map code, and one (or more) files defining macros and including the map code.
For example:
map.incmap_blocks.pasCode:Type TMap = class { snip } Procedure Insert(Key: KEYTYPE ; Val : VALUETYPE ); Function Search(Key: KEYTYPE ): VALUETYPE ; { snip }Code:unit map_blocks; {$MACRO ON} {$DEFINE KEYTYPE:=TMyCoord} {$DEFINE VALUETYPE:=TMyBlock} {$INCLUDE map.inc}
Macros are only in FPC it seems, sadly no such thing in D7.
In FPC, i will try this of course..
I once found even some IDE plugin or addon or something, that kinda tried to make things generic in old Delphi. D5 or something.
You specified type you wanted and it generated another unit with this type and it used it..
I must find it, it was interesting. Probably from archives, the website is gone.
Can the "records" work with variants, i mean can they work together?
Last edited by hwnd; 17-12-2013 at 10:29 PM.
Bookmarks