summaryrefslogtreecommitdiff
path: root/include/delphi/m_json.inc
blob: bdb48bac9f859816ba5103faf1ac3901ce3f8064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
Miranda IM: the free IM client for Microsoft* Windows*

Copyright 2000-2008 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
}

{$IFNDEF MIM_LIBJSON}
{$DEFINE MIM_LIBJSON}

type
  PJSONNODE = ^JSONNODE;
  JSONNODE = pointer;

procedure json_free(str:pointer); stdcall;
          external CoreDLL name 'json_free';
procedure json_delete(node:PJSONNODE); stdcall;
          external CoreDLL name 'json_delete';

function json_parse(json:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_parse';
function json_strip_white_space(json:pAnsiChar):pWideChar; stdcall;
          external CoreDLL name 'json_strip_white_space';

function json_validate(json:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_validate';

{
	stuff that's in class JSONNode
}
//ctors
function json_new_a(name:pAnsiChar; value:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_new_a';
function json_new_i(name:pAnsiChar; value:long):PJSONNODE; stdcall;
          external CoreDLL name 'json_new_i';
function json_new_f(name:pAnsiChar; value:double):PJSONNODE; stdcall;
          external CoreDLL name 'json_new_f';
function json_new_b(name:pAnsiChar; value:int):PJSONNODE; stdcall;
          external CoreDLL name 'json_new_b';
function json_new(typ:AnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_new';
function json_copy(const orig:PJSONNODE):PJSONNODE; stdcall;
          external CoreDLL name 'json_copy';
function json_duplicate(const orig:PJSONNODE):PJSONNODE; stdcall;
          external CoreDLL name 'json_duplicate';

//assignment
procedure json_set_a(node:PJSONNODE; value:pAnsiChar); stdcall;
          external CoreDLL name 'json_set_a';
procedure json_set_i(node:PJSONNODE; value:long); stdcall;
          external CoreDLL name 'json_set_i';
procedure json_set_f(node:PJSONNODE; value:double); stdcall;
          external CoreDLL name 'json_set_f';
procedure json_set_b(node:PJSONNODE; value:int); stdcall;
          external CoreDLL name 'json_set_b';
procedure json_set_n(node:PJSONNODE; const orig: PJSONNODE); stdcall;
          external CoreDLL name 'json_set_n';

//inspectors
function json_type(const node:PJSONNODE):AnsiChar; stdcall;
          external CoreDLL name 'json_type';
function json_size(const node:PJSONNODE):size_t; stdcall;
          external CoreDLL name 'json_size';
function json_empty(const node:PJSONNODE):int; stdcall;
          external CoreDLL name 'json_empty';
function json_name(const node:PJSONNODE):pAnsiChar; stdcall;
          external CoreDLL name 'json_name';

function json_get_comment(const node:PJSONNODE):pAnsiChar; stdcall;
          external CoreDLL name 'json_get_comment';

function json_as_string(const node:PJSONNODE):pWideChar; stdcall;
          external CoreDLL name 'json_as_string';
function json_as_int(const node:PJSONNODE):long; stdcall;
          external CoreDLL name 'json_as_int';
function json_as_float(const node:PJSONNODE):double; stdcall;
          external CoreDLL name 'json_as_float';
function json_as_bool(const node:PJSONNODE):int; stdcall;
          external CoreDLL name 'json_as_bool';
function json_as_node(const node:PJSONNODE):PJSONNODE; stdcall;
          external CoreDLL name 'json_as_node';
function json_as_array(const node:PJSONNODE):PJSONNODE; stdcall;
          external CoreDLL name 'json_as_array';

function json_write(const node:PJSONNODE):pWideChar; stdcall;
          external CoreDLL name 'json_write';
function json_write_formatted(const node:PJSONNODE):pWideChar; stdcall;
          external CoreDLL name 'json_write_formatted';

//modifiers
procedure json_set_name(node:PJSONNODE; name:pAnsiChar); stdcall;
          external CoreDLL name 'json_set_name';

procedure json_set_comment(node:PJSONNODE; comment:pAnsiChar); stdcall;
          external CoreDLL name 'json_set_comment';

procedure json_clear(node:PJSONNODE); stdcall;
          external CoreDLL name 'json_clear';
procedure json_nullify(node:PJSONNODE); stdcall;
          external CoreDLL name 'json_nullify';
procedure json_swap(node:PJSONNODE; node2:PJSONNODE); stdcall;
          external CoreDLL name 'json_swap';
procedure json_merge(node:PJSONNODE; node2:PJSONNODE); stdcall;
          external CoreDLL name 'json_merge';

procedure json_preparse(node:PJSONNODE); stdcall;
          external CoreDLL name 'json_preparse';

procedure json_set_binary(node:PJSONNODE; data:pointer; length:ulong); stdcall;
          external CoreDLL name 'json_set_binary';

procedure json_cast(node:PJSONNODE; typ:AnsiChar); stdcall;
          external CoreDLL name 'json_cast';

//children access
procedure json_reserve(node:PJSONNODE; siz:size_t); stdcall;
          external CoreDLL name 'json_reserve';
function  json_at(node:PJSONNODE; pos:size_t):PJSONNODE; stdcall;
          external CoreDLL name 'json_at';
function  json_get(node:PJSONNODE; name:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_get';

function json_get_nocase(node:PJSONNODE; name:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_get_nocase';
function json_pop_back_nocase(node:PJSONNODE; name:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_pop_back_nocase';

procedure json_push_back(node:PJSONNODE; node2:PJSONNODE); stdcall;
          external CoreDLL name 'json_push_back';
function  json_pop_back_at(node:PJSONNODE; pos:size_t):PJSONNODE; stdcall;
          external CoreDLL name 'json_pop_back_at';
function  json_pop_back(node:PJSONNODE; name:pAnsiChar):PJSONNODE; stdcall;
          external CoreDLL name 'json_pop_back';

//comparsion
function json_equal(node:PJSONNODE; node2:PJSONNODE):int; stdcall;
          external CoreDLL name 'json_equal';

{$ENDIF}