Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#6 int64 support

open
nobody
None
5
2009-11-17
2009-11-17
SergeyNikitin
No

1. add to

TlkJSONcustomlist = class(TlkJSONbase)
protected

function getInt64(idx: Integer): Int64; virtual; //added by Lucefer

2. add to

TlkJSONobject = class(TlkJSONcustomlist)
protected

//[START] Added by Lucefer 20090602
function getInt64(idx: Integer): Int64; overload; override;
function {$ifdef TCB_EXT}getInt64FromName{$else}getInt64{$endif}
(nm: string): Int64; overload;
//[END] Added by Lucefer 20090602

3. add somewhere below

//[START] Added by Lucefer 20090602
function TlkJSONcustomlist.getInt64(idx: Integer): Int64;
var
jn: TlkJSONnumber;
begin
jn := Child[idx] as TlkJSONnumber;
if not assigned(jn) then result := 0
else result := round(int(jn.Value));
end;
//[END] Added by Lucefer 20090602

4. and one more:

//[START] Added by Lucefer 20090602
function TlkJSONobject.getInt64(idx: Integer): Int64;
var
jn: TlkJSONnumber;
begin
jn := FieldByIndex[idx] as TlkJSONnumber;
if not assigned(jn) then result := 0
else result := round(int(jn.Value));
end;

{$ifdef TCB_EXT}
function TlkJSONobject.getInt64FromName(nm: string): Int64;
{$else}
function TlkJSONobject.getInt64(nm: string): Int64;
{$endif}
begin
result := getInt64(IndexOfName(nm));
end;
//[END] Added by Lucefer 20090602

Discussion