mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:29:24 +02:00
+ add and document a way to hide the generic methods from Lazarus' CodeTools as they don't support them yet
git-svn-id: trunk@37082 -
This commit is contained in:
parent
92caf587f5
commit
ce958cacc4
@ -17,6 +17,22 @@ unit Rtti experimental;
|
|||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
{$modeswitch advancedrecords}
|
{$modeswitch advancedrecords}
|
||||||
|
|
||||||
|
{ Note: since the Lazarus IDE is not yet capable of correctly handling generic
|
||||||
|
functions it is best to define a InLazIDE define inside the IDE that disables
|
||||||
|
the generic code for CodeTools. To do this do this:
|
||||||
|
|
||||||
|
- go to Tools -> Codetools Defines Editor
|
||||||
|
- go to Edit -> Insert Node Below -> Define Recurse
|
||||||
|
- enter the following values:
|
||||||
|
Name: InLazIDE
|
||||||
|
Description: Define InLazIDE everywhere
|
||||||
|
Variable: InLazIDE
|
||||||
|
Value from text: 1
|
||||||
|
}
|
||||||
|
{$ifdef InLazIDE}
|
||||||
|
{$define NoGenericMethods}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -73,7 +89,9 @@ type
|
|||||||
public
|
public
|
||||||
class function Empty: TValue; static;
|
class function Empty: TValue; static;
|
||||||
class procedure Make(ABuffer: pointer; ATypeInfo: PTypeInfo; out result: TValue); static;
|
class procedure Make(ABuffer: pointer; ATypeInfo: PTypeInfo; out result: TValue); static;
|
||||||
|
{$ifndef NoGenericMethods}
|
||||||
generic class function From<T>(constref aValue: T): TValue; static; inline;
|
generic class function From<T>(constref aValue: T): TValue; static; inline;
|
||||||
|
{$endif}
|
||||||
function IsArray: boolean; inline;
|
function IsArray: boolean; inline;
|
||||||
function AsString: string;
|
function AsString: string;
|
||||||
function AsExtended: Extended;
|
function AsExtended: Extended;
|
||||||
@ -699,10 +717,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifndef NoGenericMethods}
|
||||||
generic class function TValue.From<T>(constref aValue: T): TValue;
|
generic class function TValue.From<T>(constref aValue: T): TValue;
|
||||||
begin
|
begin
|
||||||
TValue.Make(@aValue, System.TypeInfo(T), Result);
|
TValue.Make(@aValue, System.TypeInfo(T), Result);
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
function TValue.GetTypeDataProp: PTypeData;
|
function TValue.GetTypeDataProp: PTypeData;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user