mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:29:25 +02:00
IdeDebugger: add Valueformatter CharArrayToString / display an array of char as a string / StopAtNull
This commit is contained in:
parent
bbdfea8977
commit
3ae19dfa25
@ -412,6 +412,8 @@ resourcestring
|
||||
ValFormatterCurrencyName = 'Currency';
|
||||
ValFormatterCharArrayToStringName = 'CharArray as String';
|
||||
|
||||
ValFormatterCharArrayToStringStopNull = 'Stop at #0';
|
||||
|
||||
DispFormatDlgBtnCurrent = 'Current';
|
||||
DispFormatDlgBtnAll = 'All';
|
||||
DispFormatDlgBtnNumber = 'Number';
|
||||
|
@ -6,6 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
StdCtrls, Forms,
|
||||
// IdeIntf
|
||||
IdeDebuggerValueFormatterIntf, IdeDebuggerWatchValueIntf,
|
||||
// IdeDebugger
|
||||
@ -13,9 +14,25 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{ TIdeDebuggerValueFormatterCharArrayToStringFrame }
|
||||
|
||||
TIdeDebuggerValueFormatterCharArrayToStringFrame = class(TFrame, ILazDbgIdeValueFormatterSettingsFrameIntf)
|
||||
cbStopAtNull: TCheckBox;
|
||||
protected
|
||||
procedure ReadFrom(AFormatter: ILazDbgIdeValueFormatterIntf);
|
||||
function WriteTo(AFormatter: ILazDbgIdeValueFormatterIntf): Boolean;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
{ TIdeDbgValueFormatterCharArrayToString }
|
||||
|
||||
TIdeDbgValueFormatterCharArrayToString = class(specialize TLazDbgIdeValueFormatterGeneric<TObject>)
|
||||
private
|
||||
FStopAtNull: Boolean;
|
||||
protected
|
||||
procedure Init; override;
|
||||
procedure Assign(AnOther: TObject); override;
|
||||
public
|
||||
class function GetRegisteredDisplayName: String;
|
||||
function FormatValue(AWatchValue: IWatchResultDataIntf;
|
||||
@ -24,16 +41,67 @@ type
|
||||
): Boolean; override;
|
||||
function SupportedFeatures: TLazDbgIdeValFormatterFeatures; override;
|
||||
function SupportedDataKinds: TWatchResultDataKinds; override;
|
||||
published
|
||||
property StopAtNull: Boolean read FStopAtNull write FStopAtNull;
|
||||
end;
|
||||
|
||||
TIdeDbgValueFormatterRegistryCharArrayToString =
|
||||
specialize TLazDbgIdeValueFormatterRegistryEntryGeneric<TIdeDbgValueFormatterCharArrayToString>;
|
||||
specialize TLazDbgIdeValueFormatterFrameRegistryEntryGeneric<TIdeDbgValueFormatterCharArrayToString, TIdeDebuggerValueFormatterCharArrayToStringFrame>;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TIdeDebuggerValueFormatterCharArrayToStringFrame }
|
||||
|
||||
procedure TIdeDebuggerValueFormatterCharArrayToStringFrame.ReadFrom(
|
||||
AFormatter: ILazDbgIdeValueFormatterIntf);
|
||||
var
|
||||
f: TIdeDbgValueFormatterCharArrayToString;
|
||||
begin
|
||||
f := AFormatter.GetObject as TIdeDbgValueFormatterCharArrayToString;
|
||||
cbStopAtNull.Checked := f.StopAtNull;
|
||||
end;
|
||||
|
||||
function TIdeDebuggerValueFormatterCharArrayToStringFrame.WriteTo(
|
||||
AFormatter: ILazDbgIdeValueFormatterIntf): Boolean;
|
||||
var
|
||||
f: TIdeDbgValueFormatterCharArrayToString;
|
||||
begin
|
||||
f := AFormatter.GetObject as TIdeDbgValueFormatterCharArrayToString;
|
||||
|
||||
Result := (f.StopAtNull <> cbStopAtNull.Checked);
|
||||
f.StopAtNull := cbStopAtNull.Checked;
|
||||
end;
|
||||
|
||||
constructor TIdeDebuggerValueFormatterCharArrayToStringFrame.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
cbStopAtNull.Caption := ValFormatterCharArrayToStringStopNull;
|
||||
end;
|
||||
|
||||
{ TIdeDbgValueFormatterCharArrayToString }
|
||||
|
||||
procedure TIdeDbgValueFormatterCharArrayToString.Init;
|
||||
begin
|
||||
inherited Init;
|
||||
FStopAtNull := False;
|
||||
end;
|
||||
|
||||
procedure TIdeDbgValueFormatterCharArrayToString.Assign(AnOther: TObject);
|
||||
var
|
||||
f: TIdeDbgValueFormatterCharArrayToString;
|
||||
begin
|
||||
inherited Assign(AnOther);
|
||||
|
||||
if AnOther is TIdeDbgValueFormatterCharArrayToString then begin
|
||||
f := AnOther as TIdeDbgValueFormatterCharArrayToString;
|
||||
|
||||
FStopAtNull := f.FStopAtNull;
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TIdeDbgValueFormatterCharArrayToString.GetRegisteredDisplayName: String;
|
||||
begin
|
||||
Result := ValFormatterCharArrayToStringName;
|
||||
@ -68,32 +136,36 @@ begin
|
||||
1: begin
|
||||
SetLength(APrintedValue, Cnt);
|
||||
p := @APrintedValue[1];
|
||||
p^ := AElem.AsString[1];
|
||||
|
||||
i := 1;
|
||||
i := 0;
|
||||
while i < Cnt do begin
|
||||
AWatchValue.SetSelectedIndex(i);
|
||||
AElem := AWatchValue.SelectedEntry;
|
||||
inc(p);
|
||||
p^ := AElem.AsString[1];
|
||||
if StopAtNull and (p^ = #0) then
|
||||
break;
|
||||
inc(p);
|
||||
inc(i);
|
||||
end;
|
||||
if i < Cnt then
|
||||
SetLength(APrintedValue, i);
|
||||
|
||||
APrintedValue := QuoteText(APrintedValue);
|
||||
end;
|
||||
2: begin
|
||||
SetLength(AWideValue, Cnt);
|
||||
pw := @AWideValue[1];
|
||||
pw^ := AElem.AsWideString[1];
|
||||
|
||||
i := 1;
|
||||
i := 0;
|
||||
while i < Cnt do begin
|
||||
AWatchValue.SetSelectedIndex(i);
|
||||
AElem := AWatchValue.SelectedEntry;
|
||||
pw^ := AElem.AsWideString[1];
|
||||
if StopAtNull and (pw^ = #0) then
|
||||
break;
|
||||
inc(pw);
|
||||
pw^ := AElem.AsString[1];
|
||||
inc(i);
|
||||
end;
|
||||
if i < Cnt then
|
||||
SetLength(AWideValue, i);
|
||||
|
||||
APrintedValue := QuoteWideText(AWideValue);
|
||||
end;
|
||||
|
@ -1708,6 +1708,10 @@ msgstr ""
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1703,6 +1703,10 @@ msgstr ""
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1725,6 +1725,10 @@ msgstr ""
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1755,6 +1755,10 @@ msgstr "Přepnout záložku"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1750,6 +1750,10 @@ msgstr "Haltepunkt umschal&ten"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1760,6 +1760,10 @@ msgstr "Ac&tivar/desactivar Punto de Interrupción"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1748,6 +1748,10 @@ msgstr "&Keskeytyskohta päälle/pois"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1755,6 +1755,10 @@ msgstr "&Inverser le point d'arrêt"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1789,6 +1789,10 @@ msgstr "החלף נקודת עצירה"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1755,6 +1755,10 @@ msgstr "Töréspont ki-/&bekapcsolása"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1732,6 +1732,10 @@ msgstr ""
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1760,6 +1760,10 @@ msgstr "&Inverti breakpoint"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1758,6 +1758,10 @@ msgstr "ブレークポイントの切り替え(&B)"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1758,6 +1758,10 @@ msgstr "Įjungti ar išjungti stabd&os tašką"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1728,6 +1728,10 @@ msgstr ""
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1771,6 +1771,10 @@ msgstr "&Przełącz pułapkę"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1727,6 +1727,10 @@ msgstr ""
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1770,6 +1770,10 @@ msgstr "&Alternar pontos de parada"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1740,6 +1740,10 @@ msgstr "П&ереключить точку останова"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr "TColor"
|
||||
|
@ -1744,6 +1744,10 @@ msgstr "Prepnúť &bod prerušenia"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1750,6 +1750,10 @@ msgstr "Kesme &noktası değiştir"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1748,6 +1748,10 @@ msgstr "Перемкнути &точку зупинки"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
@ -1746,6 +1746,10 @@ msgstr "切换断点(&B)"
|
||||
msgid "CharArray as String"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformatterchararraytostringstopnull
|
||||
msgid "Stop at #0"
|
||||
msgstr ""
|
||||
|
||||
#: idedebuggerstringconstants.valformattercolorname
|
||||
msgid "TColor"
|
||||
msgstr ""
|
||||
|
Loading…
Reference in New Issue
Block a user