mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 10:49:19 +02:00
+ variants.pp: implemented FindCustomVariantType(byTypeName overloaded version)
+ also implemented some trivial methods of TCustomVariantType and TInvokeableVariantType git-svn-id: trunk@16320 -
This commit is contained in:
parent
041720e285
commit
58f2faa1db
@ -3548,13 +3548,31 @@ function FindCustomVariantType(const aVarType: TVarType; out CustomVariantType:
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$warnings off}
|
|
||||||
function FindCustomVariantType(const TypeName: string; out CustomVariantType: TCustomVariantType): Boolean; overload;
|
function FindCustomVariantType(const TypeName: string; out CustomVariantType: TCustomVariantType): Boolean; overload;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
tmp: TCustomVariantType;
|
||||||
|
ShortTypeName: shortstring;
|
||||||
begin
|
begin
|
||||||
NotSupported('FindCustomVariantType');
|
ShortTypeName:=TypeName; // avoid conversion in the loop
|
||||||
|
result:=False;
|
||||||
|
EnterCriticalSection(customvarianttypelock);
|
||||||
|
try
|
||||||
|
for i:=low(customvarianttypes) to high(customvarianttypes) do
|
||||||
|
begin
|
||||||
|
tmp:=customvarianttypes[i];
|
||||||
|
result:=Assigned(tmp) and (tmp<>InvalidCustomVariantType) and
|
||||||
|
tmp.ClassNameIs(ShortTypeName);
|
||||||
|
if result then
|
||||||
|
begin
|
||||||
|
CustomVariantType:=tmp;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
LeaveCriticalSection(customvarianttypelock);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
{$warnings on}
|
|
||||||
|
|
||||||
function Unassigned: Variant; // Unassigned standard constant
|
function Unassigned: Variant; // Unassigned standard constant
|
||||||
begin
|
begin
|
||||||
@ -3569,30 +3587,37 @@ function Null: Variant; // Null standard constant
|
|||||||
TVarData(Result).vType := varNull;
|
TVarData(Result).vType := varNull;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure VarDispInvokeError;
|
||||||
|
begin
|
||||||
|
raise EVariantDispatchError(SDispatchError);
|
||||||
|
end;
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
TCustomVariantType Class.
|
TCustomVariantType Class.
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
{$warnings off}
|
{ All TCustomVariantType descendants are singletons, they ignore automatic refcounting. }
|
||||||
function TCustomVariantType.QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
|
function TCustomVariantType.QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType.QueryInterface');
|
if GetInterface(IID, obj) then
|
||||||
|
result := S_OK
|
||||||
|
else
|
||||||
|
result := E_NOINTERFACE;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TCustomVariantType._AddRef: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
|
function TCustomVariantType._AddRef: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType._AddRef');
|
result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TCustomVariantType._Release: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
|
function TCustomVariantType._Release: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType._Release');
|
result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$warnings off}
|
||||||
procedure TCustomVariantType.SimplisticClear(var V: TVarData);
|
procedure TCustomVariantType.SimplisticClear(var V: TVarData);
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType.SimplisticClear');
|
NotSupported('TCustomVariantType.SimplisticClear');
|
||||||
@ -3607,20 +3632,19 @@ end;
|
|||||||
|
|
||||||
procedure TCustomVariantType.RaiseInvalidOp;
|
procedure TCustomVariantType.RaiseInvalidOp;
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType.RaiseInvalidOp');
|
VarInvalidOp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCustomVariantType.RaiseCastError;
|
procedure TCustomVariantType.RaiseCastError;
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType.RaiseCastError');
|
VarCastError;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCustomVariantType.RaiseDispError;
|
procedure TCustomVariantType.RaiseDispError;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType.RaiseDispError');
|
VarDispInvokeError;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -3649,7 +3673,7 @@ end;
|
|||||||
procedure TCustomVariantType.DispInvoke(Dest: PVarData; const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
|
procedure TCustomVariantType.DispInvoke(Dest: PVarData; const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
NotSupported('TCustomVariantType.DispInvoke');
|
RaiseDispError;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -3889,7 +3913,6 @@ end;
|
|||||||
TInvokeableVariantType implementation
|
TInvokeableVariantType implementation
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
{$warnings off}
|
|
||||||
procedure TInvokeableVariantType.DispInvoke(Dest: PVarData; const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
|
procedure TInvokeableVariantType.DispInvoke(Dest: PVarData; const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3899,28 +3922,31 @@ end;
|
|||||||
function TInvokeableVariantType.DoFunction(var Dest: TVarData; const V: TVarData; const Name: string; const Arguments: TVarDataArray): Boolean;
|
function TInvokeableVariantType.DoFunction(var Dest: TVarData; const V: TVarData; const Name: string; const Arguments: TVarDataArray): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
NotSupported('TInvokeableVariantType.DoFunction');
|
result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TInvokeableVariantType.DoProcedure(const V: TVarData; const Name: string; const Arguments: TVarDataArray): Boolean;
|
function TInvokeableVariantType.DoProcedure(const V: TVarData; const Name: string; const Arguments: TVarDataArray): Boolean;
|
||||||
begin
|
begin
|
||||||
NotSupported('TInvokeableVariantType.DoProcedure');
|
result := False
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TInvokeableVariantType.GetProperty(var Dest: TVarData; const V: TVarData; const Name: string): Boolean;
|
function TInvokeableVariantType.GetProperty(var Dest: TVarData; const V: TVarData; const Name: string): Boolean;
|
||||||
begin
|
begin
|
||||||
NotSupported('TInvokeableVariantType.GetProperty');
|
result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TInvokeableVariantType.SetProperty(const V: TVarData; const Name: string; const Value: TVarData): Boolean;
|
function TInvokeableVariantType.SetProperty(const V: TVarData; const Name: string; const Value: TVarData): Boolean;
|
||||||
begin
|
begin
|
||||||
NotSupported('TInvokeableVariantType.SetProperty');
|
result := False;
|
||||||
end;
|
end;
|
||||||
{$warnings on}
|
|
||||||
|
|
||||||
|
|
||||||
|
{ ---------------------------------------------------------------------
|
||||||
|
TPublishableVariantType implementation
|
||||||
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
function TPublishableVariantType.GetProperty(var Dest: TVarData; const V: TVarData; const Name: string): Boolean;
|
function TPublishableVariantType.GetProperty(var Dest: TVarData; const V: TVarData; const Name: string): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user