Vcl.ImgList, JSON, Vcl.Menus, Vcl.StdActns, System.Actions, Vcl.ActnList;
type
+ TIndxChar = (chMul, chPlus, chMin, chEqu);
+
TForm1 = class(TForm)
Memo1: TMemo;
ToolBar1: TToolBar;
procedure Memo1Change(Sender: TObject);
private
{ Private \90é\8c¾ }
+ id: TIndxChar;
procedure loop(item: TTreeNode; JSON: TJSONObject);
procedure arrloop(item: TTreeNode; arr: TJSONArray);
+ function returnChar(c: TIndxChar): Char;
public
{ Public \90é\8c¾ }
end;
val: TJSONValue;
i: integer;
begin
- item := TreeView1.Items.AddChild(item, '_array');
for i := 0 to arr.count - 1 do
begin
val := arr.Items[i];
arrloop(item, val as TJSONArray)
else
begin
- s := arr.Items[i].ToString;
+ s := '_' + arr.Items[i].ToString;
TreeView1.Items.AddChild(item, s);
end;
end;
pair: TJSONPair;
s: string;
val: TJSONValue;
+ c: Char;
begin
+ c := returnChar(id);
+ if id = High(id) then
+ id := Low(id)
+ else
+ id := Succ(id);
for i := 0 to JSON.count - 1 do
begin
pair := JSON.Pairs[i];
begin
TreeView1.Items.AddChild(item, 'error');
Showmessage('\93à\95\94\83G\83\89\81[\82É\82æ\82è\92\86\92f\82µ\82Ü\82µ\82½');
- TabControl1.TabIndex:=2;
+ TabControl1.TabIndex := 2;
TabControl1Change(nil);
TabControl1.Show;
Exit;
val := pair.JsonValue;
if val is TJSONObject then
begin
- s := pair.JsonString.ToString + ':';
+ s := c + pair.JsonString.ToString + ':';
JSON := pair.JsonValue as TJSONObject;
loop(TreeView1.Items.AddChild(item, s), JSON);
end
else if val is TJSONArray then
begin
- s := pair.JsonString.ToString + ':';
+ s := c + pair.JsonString.ToString + ':';
arrloop(TreeView1.Items.AddChild(item, s), pair.JsonValue as TJSONArray);
end
else
begin
- s := pair.JsonString.ToString + ':' + pair.JsonValue.ToString;
+ s := c + pair.JsonString.ToString + ':' + pair.JsonValue.ToString;
TreeView1.Items.AddChild(item, s);
end;
end;
end;
end;
+function TForm1.returnChar(c: TIndxChar): Char;
+begin
+ result := ' ';
+ case c of
+ chMul:
+ result := '*';
+ chPlus:
+ result := '+';
+ chMin:
+ result := '-';
+ chEqu:
+ result := '=';
+ end;
+end;
+
procedure TForm1.TabControl1Change(Sender: TObject);
begin
case TabControl1.TabIndex of
- 0:
- Memo2.Text := Memo3.Text;
- 1:
- Memo2.Text := Memo4.Text;
- 2:
- Memo2.Text:=Memo5.Text;
+ 0:
+ Memo2.Text := Memo3.Text;
+ 1:
+ Memo2.Text := Memo4.Text;
+ 2:
+ Memo2.Text := Memo5.Text;
end;
end;
i: integer;
j: TJSONObject;
begin
+ id := Low(id);
TreeView1.Items.Clear;
if Memo1.Text = '' then
Memo1.Text := Clipboard.AsText;