zoukankan      html  css  js  c++  java
  • TJSONTableObject跨平台解析JSON

    TJSONTableObject跨平台解析JSON

    USES SynCrossPlatformJSON

    TSQLRecordPeoplePersistent = class(TPersistent)
    private
    fRowID: integer;
    fData: TByteDynArray;
    fFirstName: string;
    fLastName: string;
    fYearOfBirth: integer;
    fYearOfDeath: word;
    published
    property RowID: integer read fRowID write fRowID;
    property FirstName: string read fFirstName write fFirstName;
    property LastName: string read fLastName write fLastName;
    property Data: TByteDynArray read fData write fData;
    property YearOfBirth: integer read fYearOfBirth write fYearOfBirth;
    property YearOfDeath: word read fYearOfDeath write fYearOfDeath;
    end;

    procedure TTestTableContent.SynopseCrossORM; // by cxg
    var json: string;
    table: TJSONTableObject;
    people: TSQLRecordPeoplePersistent;
    begin
    json := AnyTextFileToString(fFileName,true);
    people := TSQLRecordPeoplePersistent.Create;
    Owner.TestTimer.Start;
    table := TJSONTableObject.Create(json);
    fRunConsoleOccurenceNumber := 0;
    while table.StepObject(people) do begin
    Check(people.FirstName<>'');
    Check(people.LastName<>'');
    Check(people.YearOfBirth<10000);
    Check((people.YearOfDeath>1400)and(people.YearOfDeath<2000));
    Check((people.RowID>11011) or (people.Data<>nil));
    inc(fRunConsoleOccurenceNumber);
    end;
    fRunConsoleMemoryUsed := MemoryUsed-fMemoryAtStart;
    table.Free;
    people.Free;
    end;

  • 相关阅读:
    ANSI、UNICODE、UTF8、GB2312、GBK、DBCS、UCS
    javascript实用脚本收藏
    野指针(转载)
    C#将byte[]转换为string (oracle)
    程序员从初级到中级10个秘诀
    js 中 时间戳转换为时间
    prependTo 移动元素内到最前段
    统计json数组元素个数的函数
    setTimeout和setInterval的使用
    js 过滤html
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/8047179.html
Copyright © 2011-2022 走看看