Browse Source

[linq] fixed fpc compatibility

Exilon 5 years ago
parent
commit
0c8e104d43
1 changed files with 10 additions and 0 deletions
  1. 10 0
      Quick.Linq.pas

+ 10 - 0
Quick.Linq.pas

@@ -51,6 +51,7 @@ type
 
 
   TOrderDirection = (odAscending, odDescending);
   TOrderDirection = (odAscending, odDescending);
 
 
+  {$IFNDEF FPC}
   TLinqExpression<T : class> = class(TExpression)
   TLinqExpression<T : class> = class(TExpression)
   private
   private
     fPredicate : TPredicate<T>;
     fPredicate : TPredicate<T>;
@@ -58,12 +59,15 @@ type
     constructor Create(aPredicate : TPredicate<T>);
     constructor Create(aPredicate : TPredicate<T>);
     function Validate(aValue : TObject) : Boolean; override;
     function Validate(aValue : TObject) : Boolean; override;
   end;
   end;
+  {$ENDIF}
 
 
   ILinqQuery<T> = interface
   ILinqQuery<T> = interface
   ['{16B68C0B-EA38-488A-99D9-BAD1E8560E8E}']
   ['{16B68C0B-EA38-488A-99D9-BAD1E8560E8E}']
     function Where(const aWhereClause : string; aWhereValues : array of const) : ILinqQuery<T>; overload;
     function Where(const aWhereClause : string; aWhereValues : array of const) : ILinqQuery<T>; overload;
     function Where(const aWhereClause: string): ILinqQuery<T>; overload;
     function Where(const aWhereClause: string): ILinqQuery<T>; overload;
+    {$IFNDEF FPC}
     function Where(aPredicate : TPredicate<T>) : ILinqQuery<T>; overload;
     function Where(aPredicate : TPredicate<T>) : ILinqQuery<T>; overload;
+    {$ENDIF}
     function OrderBy(const aFieldNames : string) : ILinqQuery<T>;
     function OrderBy(const aFieldNames : string) : ILinqQuery<T>;
     function OrderByDescending(const aFieldNames : string) : ILinqQuery<T>;
     function OrderByDescending(const aFieldNames : string) : ILinqQuery<T>;
     function SelectFirst : T;
     function SelectFirst : T;
@@ -99,7 +103,9 @@ type
     destructor Destroy; override;
     destructor Destroy; override;
     function Where(const aWhereClause : string; aWhereParams : array of const) : ILinqQuery<T>; overload;
     function Where(const aWhereClause : string; aWhereParams : array of const) : ILinqQuery<T>; overload;
     function Where(const aWhereClause: string): ILinqQuery<T>; overload;
     function Where(const aWhereClause: string): ILinqQuery<T>; overload;
+    {$IFNDEF FPC}
     function Where(aPredicate : TPredicate<T>) : ILinqQuery<T>; overload;
     function Where(aPredicate : TPredicate<T>) : ILinqQuery<T>; overload;
+    {$ENDIF}
     function OrderBy(const aFieldNames : string) : ILinqQuery<T>;
     function OrderBy(const aFieldNames : string) : ILinqQuery<T>;
     function OrderByDescending(const aFieldNames : string) : ILinqQuery<T>;
     function OrderByDescending(const aFieldNames : string) : ILinqQuery<T>;
     function SelectFirst : T;
     function SelectFirst : T;
@@ -445,11 +451,13 @@ begin
   end;
   end;
 end;
 end;
 
 
+{$IFNDEF FPC}
 function TLinqQuery<T>.Where(aPredicate: TPredicate<T>): ILinqQuery<T>;
 function TLinqQuery<T>.Where(aPredicate: TPredicate<T>): ILinqQuery<T>;
 begin
 begin
   Result := Self;
   Result := Self;
   fWhereClause := TLinqExpression<T>.Create(aPredicate);
   fWhereClause := TLinqExpression<T>.Create(aPredicate);
 end;
 end;
+{$ENDIF}
 
 
 { TLinq }
 { TLinq }
 
 
@@ -473,6 +481,7 @@ end;
 
 
 { TLinqExpression<T> }
 { TLinqExpression<T> }
 
 
+{$IFNDEF FPC}
 constructor TLinqExpression<T>.Create(aPredicate: TPredicate<T>);
 constructor TLinqExpression<T>.Create(aPredicate: TPredicate<T>);
 begin
 begin
   fPredicate := aPredicate;
   fPredicate := aPredicate;
@@ -482,5 +491,6 @@ function TLinqExpression<T>.Validate(aValue : TObject) : Boolean;
 begin
 begin
   Result := fPredicate(aValue as T);
   Result := fPredicate(aValue as T);
 end;
 end;
+{$ENDIF}
 
 
 end.
 end.