[fpc-pascal] Generics problem/question
Aleksa Todorovic
alexione at gmail.com
Sun Jan 24 18:44:55 CET 2010
On Tue, Jan 19, 2010 at 18:35, Aleksa Todorovic <alexione at gmail.com> wrote:
> On Mon, Jan 18, 2010 at 04:07, Aleksa Todorovic <alexione at gmail.com> wrote:
>
> One (not very nice) way to have generic list of records is using
> macros. I've extracted definition of TFPGList, made it ordinary type,
> and did some search/replace, so I get:
>
> [SNIP]
>
Just to report how I managed to (ab)use FPC and Lazarus to have both
generics of records and full code-completition (note I turned C-style
macros on for the whole project):
in interface:
TMessageParameter = record
...
end;
TMessageParameters = TList; // this makes Lazarus code completition
actually work; maybe better to use TFPSList
operator = (const A, B: TMessageParameter): Boolean;
{$DEFINE _TFPGList_Type_ := TMessageParametersFPGList}
{$DEFINE _TFPGList_ItemType_ := TMessageParameter}
{$INCLUDE fpglist_h.inc} // copied and adapted interface from FGL
{$DEFINE TMessageParameters := TMessageParametersFPGList}
// last line is used to make it all actually work
in implementation:
operator = (const A, B: TMessageParameter): Boolean;
begin
Result := ...;
end;
{$DEFINE _TFPGList_Type_ := TMessageParametersFPGList}
{$DEFINE _TFPGList_ItemType_ := TMessageParameter}
{$INCLUDE fpglist.inc} // copied and adapted implementation from FGL
More information about the fpc-pascal
mailing list