IdeDebugger: add SupportedDataKinds to Valueformatter for quicker filter

This commit is contained in:
Martin 2024-04-18 15:59:44 +02:00
parent a31c9b11d7
commit e1a58d379a
6 changed files with 27 additions and 1 deletions

View File

@ -45,6 +45,7 @@ type
): boolean; experimental; deprecated 'For values from older backends only - to be removed as backends are upgraded';
function SupportedFeatures: TLazDbgIdeValFormatterFeatures;
function SupportedDataKinds: TWatchResultDataKinds;
// Config
function GetObject: TObject; // for TXmlConfig.WriteObject / must have all config in published fields
@ -115,6 +116,7 @@ type
): boolean; virtual; experimental; deprecated 'For values from older backends only - to be removed as backends are upgraded';
function SupportedFeatures: TLazDbgIdeValFormatterFeatures; virtual;
function SupportedDataKinds: TWatchResultDataKinds; virtual;
end;
{ TLazDbgIdeValueFormatterRegistryEntryGeneric }
@ -232,6 +234,11 @@ begin
Result := [vffValueData];
end;
function TLazDbgIdeValueFormatterGeneric.SupportedDataKinds: TWatchResultDataKinds;
begin
Result := [low(TWatchResultDataKind)..high(TWatchResultDataKind)];
end;
{ TLazDbgIdeValueFormatterRegistryEntryGeneric }
class function TLazDbgIdeValueFormatterRegistryEntryGeneric.CreateValueFormatter: ILazDbgIdeValueFormatterIntf;

View File

@ -273,6 +273,7 @@ type
rdkFunction, rdkProcedure,
rdkFunctionRef, rdkProcedureRef
);
TWatchResultDataKinds = set of TWatchResultDataKind;
IWatchResultDataIntf = interface;

View File

@ -209,11 +209,11 @@ begin
Result := False;
if (ValFormatter = nil) or
(not (vffFormatValue in ValFormatter.SupportedFeatures)) or
(not (AWatchValue.ValueKind in ValFormatter.SupportedDataKinds)) or
( ADisplayFormat.MemDump and (not(vffValueMemDump in ValFormatter.SupportedFeatures)) ) or
( (not ADisplayFormat.MemDump) and (not(vffValueData in ValFormatter.SupportedFeatures)) )
then
exit;
//AWatchValue.ValueKind;
if not IsMatchingTypeName(AWatchValue.TypeName) then begin
if not MatchInherited then

View File

@ -46,6 +46,7 @@ type
procedure Assign(AnOther: TObject); override;
public
function SupportedFeatures: TLazDbgIdeValFormatterFeatures; override;
function SupportedDataKinds: TWatchResultDataKinds; override;
published
property ShowName: Boolean read FShowName write FShowName;
property ShowRgb: Boolean read FShowRgb write FShowRgb;
@ -178,6 +179,11 @@ begin
Result := [vffFormatValue, vffFormatOldValue, vffValueData];
end;
function TIdeDbgValueFormatterColorBase.SupportedDataKinds: TWatchResultDataKinds;
begin
Result := [rdkSignedNumVal, rdkUnsignedNumVal];
end;
class function TIdeDbgValueFormatterColor.GetRegisteredDisplayName: String;
begin
Result := ValFormatterColorName;

View File

@ -33,6 +33,7 @@ type
): boolean; override; deprecated 'For values from older backends only - to be removed as backends are upgraded';
function SupportedFeatures: TLazDbgIdeValFormatterFeatures; override;
function SupportedDataKinds: TWatchResultDataKinds; override;
end;
TIdeDbgValueFormatterRegistryCurrency =
specialize TLazDbgIdeValueFormatterRegistryEntryGeneric<TIdeDbgValueFormatterCurrency>;
@ -101,6 +102,11 @@ begin
Result := [vffFormatValue, vffFormatOldValue, vffValueData];
end;
function TIdeDbgValueFormatterCurrency.SupportedDataKinds: TWatchResultDataKinds;
begin
Result := [rdkSignedNumVal, rdkUnsignedNumVal];
end;
initialization
ValueFormatterRegistry.Add(TIdeDbgValueFormatterRegistryCurrency);

View File

@ -57,6 +57,7 @@ type
): boolean; override; deprecated 'For values from older backends only - to be removed as backends are upgraded';
function SupportedFeatures: TLazDbgIdeValFormatterFeatures; override;
function SupportedDataKinds: TWatchResultDataKinds; override;
published
property DateTimeFormat: String read FDateTimeFormat write FDateTimeFormat;
property DateFormat: String read FDateFormat write FDateFormat;
@ -195,6 +196,11 @@ begin
Result := [vffFormatValue, vffFormatOldValue, vffValueData];
end;
function TIdeDbgValueFormatterDateTime.SupportedDataKinds: TWatchResultDataKinds;
begin
Result := [rdkFloatVal];
end;
initialization
ValueFormatterRegistry.Add(TIdeDbgValueFormatterRegistryDateTime);