+ added methods AsInt64, AsQWord and AsLongWord to TGDBMI_Value

git-svn-id: trunk@30173 -
This commit is contained in:
nickysn 2015-03-12 22:46:46 +00:00
parent c45d3a2d96
commit f4c0c92628

View File

@ -37,7 +37,10 @@ type
TGDBMI_ListValue = class; TGDBMI_ListValue = class;
TGDBMI_Value = class TGDBMI_Value = class
function AsString: string; function AsString: string;
function AsInt64: Int64;
function AsQWord: QWord;
function AsLongInt: LongInt; function AsLongInt: LongInt;
function AsLongWord: LongWord;
function AsCoreAddr: CORE_ADDR; function AsCoreAddr: CORE_ADDR;
function AsTuple: TGDBMI_TupleValue; function AsTuple: TGDBMI_TupleValue;
function AsList: TGDBMI_ListValue; function AsList: TGDBMI_ListValue;
@ -173,11 +176,34 @@ begin
Result := (self as TGDBMI_StringValue).StringValue; Result := (self as TGDBMI_StringValue).StringValue;
end; end;
function TGDBMI_Value.AsInt64: Int64;
begin
Result := StrToInt64(C2PascalNumberPrefix(AsString));
end;
function TGDBMI_Value.AsQWord: QWord;
begin
Result := StrToQWord(C2PascalNumberPrefix(AsString));
end;
function TGDBMI_Value.AsLongInt: LongInt; function TGDBMI_Value.AsLongInt: LongInt;
begin begin
Result := StrToInt(C2PascalNumberPrefix(AsString)); Result := StrToInt(C2PascalNumberPrefix(AsString));
end; end;
function TGDBMI_Value.AsLongWord: LongWord;
const
SInvalidInteger = '"%s" is an invalid integer';
var
S: string;
Error: LongInt;
begin
S := C2PascalNumberPrefix(AsString);
Val(S, Result, Error);
if Error <> 0 then
raise EConvertError.CreateFmt(SInvalidInteger,[S]);
end;
function TGDBMI_Value.AsCoreAddr: CORE_ADDR; function TGDBMI_Value.AsCoreAddr: CORE_ADDR;
begin begin
{$if defined(TARGET_IS_64BIT)} {$if defined(TARGET_IS_64BIT)}