Freeciv-3.3
Loading...
Searching...
No Matches
dataio_json.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__DATAIO_JSON_H
14#define FC__DATAIO_JSON_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#include <jansson.h>
21
22/* utility */
23#include "bitvector.h"
24#include "support.h" /* bool type */
25
26/* common/networking */
27#include "connection.h"
28
29struct cm_parameter;
30struct unit_order;
31struct worklist;
32struct requirement;
33
38
39/* gets */
42
44 const struct plocation *location, int *dest)
47 const struct plocation *location, int *dest)
50 const struct plocation *location, int *dest)
52
54 const struct plocation *location, int *dest)
57 const struct plocation *location, int *dest)
60 const struct plocation *location, int *dest)
62
64 const struct plocation *location, bool *dest)
67 const struct plocation *location, bool *dest)
70 const struct plocation *location,
71 float *dest, int float_factor)
74 const struct plocation *location,
75 float *dest, int float_factor)
78 struct plocation *location,
79 void *dest, size_t dest_size)
82 const struct plocation *location,
83 char *dest, size_t max_dest_size)
86 const struct plocation *location,
87 char *dest, size_t max_dest_size)
90 struct plocation *location,
91 struct cm_parameter *param)
94 struct plocation *location,
95 struct worklist *pwl)
98 struct plocation *location,
99 struct unit_order *order)
100 fc__attribute((nonnull (4)));
102 const struct plocation *location,
103 struct requirement *preq)
104 fc__attribute((nonnull (4)));
106 const struct plocation *location,
107 struct act_prob *prob)
108 fc__attribute((nonnull (4)));
109
111 const struct plocation *location, int *dest)
112 fc__attribute((nonnull (4)));
114 const struct plocation *location,
115 int **values, int stop_value)
116 fc__attribute((nonnull (4)));
118 const struct plocation *location,
119 int **values, int stop_value)
120 fc__attribute((nonnull (4)));
121
122/* Should be a function but we need some macro magic. */
123#define DIO_BV_GET(pdin, location, bv) \
124 dio_get_memory_json(pc, pdin, location, \
125 (bv).vec, sizeof((bv).vec))
126
127#define DIO_GET(f, d, l, ...) \
128 dio_get_##f##_json(pc, d, l, ## __VA_ARGS__)
129
130/* puts */
132 const struct plocation *location, int size);
134 const struct plocation *location);
135
137 const struct plocation *location,
138 int value);
139
141 const struct plocation *location, int value);
143 const struct plocation *location, int value);
145 const struct plocation *location, int value);
147 const struct plocation *location, int value);
149 const struct plocation *location, int value);
151 const struct plocation *location, int value);
153 const struct plocation *location, bool value);
155 const struct plocation *location, bool value);
157 const struct plocation *location,
158 float value, int float_factor);
160 const struct plocation *location,
161 float value, int float_factor);
162
164 struct plocation *location,
165 const void *value, size_t size);
167 const struct plocation *location,
168 const char *value);
170 const struct plocation *location,
171 const char *value);
173 struct plocation *location,
174 const struct cm_parameter *order);
176 struct plocation *location,
177 const struct unit_order *order);
179 struct plocation *location,
180 const struct worklist *pwl);
182 const struct plocation *location,
183 const struct requirement *preq);
185 const struct plocation *location,
186 const struct act_prob *prob);
187
189 const struct plocation *location, int size);
191 const struct plocation *location,
192 int *values, int stop_value);
194 const struct plocation *location,
195 int *values, int stop_value);
196
197/* Should be a function but we need some macro magic. */
198#define DIO_BV_PUT(pdout, location, bv) \
199 dio_put_memory_json((pdout), location, (bv).vec, sizeof((bv).vec))
200
201#define DIO_PUT(f, d, l, ...) \
202 dio_put_##f##_json(d, l, ## __VA_ARGS__)
203
204#ifdef __cplusplus
205}
206#endif /* __cplusplus */
207
208#endif /* FC__DATAIO_JSON_H */
char * incite_cost
Definition comments.c:76
int dio_put_unit_order_json(struct json_data_out *dout, struct plocation *location, const struct unit_order *order)
bool dio_get_uint8_vec8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int **values, int stop_value) fc__attribute((nonnull(4)))
bool dio_get_type_json(struct data_in *din, enum data_type type, int *dest) fc__attribute((nonnull(3)))
bool dio_get_uint8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
int dio_put_type_json(struct json_data_out *dout, enum data_type type, const struct plocation *location, int value)
int dio_put_uint8_vec8_json(struct json_data_out *dout, const struct plocation *location, int *values, int stop_value)
bool dio_get_cm_parameter_json(struct connection *pc, struct data_in *din, struct plocation *location, struct cm_parameter *param) fc__attribute((nonnull(4)))
bool dio_get_requirement_json(struct connection *pc, struct data_in *din, const struct plocation *location, struct requirement *preq) fc__attribute((nonnull(4)))
int dio_put_worklist_json(struct json_data_out *dout, struct plocation *location, const struct worklist *pwl)
int dio_put_uint32_json(struct json_data_out *dout, const struct plocation *location, int value)
int dio_put_object_json(struct json_data_out *dout, const struct plocation *location)
bool dio_get_estring_json(struct connection *pc, struct data_in *din, const struct plocation *location, char *dest, size_t max_dest_size) fc__attribute((nonnull(4)))
int dio_put_uint16_vec8_json(struct json_data_out *dout, const struct plocation *location, int *values, int stop_value)
bool dio_get_uint32_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
bool dio_get_memory_json(struct connection *pc, struct data_in *din, struct plocation *location, void *dest, size_t dest_size) fc__attribute((nonnull(4)))
bool dio_get_uint16_vec8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int **values, int stop_value) fc__attribute((nonnull(4)))
int dio_put_uint16_json(struct json_data_out *dout, const struct plocation *location, int value)
bool dio_get_sint8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
int dio_put_memory_json(struct json_data_out *dout, struct plocation *location, const void *value, size_t size)
bool dio_get_sint32_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
int dio_put_arraylen_json(struct json_data_out *dout, const struct plocation *location, int size)
int dio_put_uint8_json(struct json_data_out *dout, const struct plocation *location, int value)
int dio_put_farray_json(struct json_data_out *dout, const struct plocation *location, int size)
int dio_put_bool8_json(struct json_data_out *dout, const struct plocation *location, bool value)
int dio_put_sint32_json(struct json_data_out *dout, const struct plocation *location, int value)
int dio_put_estring_json(struct json_data_out *dout, const struct plocation *location, const char *value)
int dio_put_action_probability_json(struct json_data_out *dout, const struct plocation *location, const struct act_prob *prob)
bool dio_get_arraylen_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
bool dio_get_worklist_json(struct connection *pc, struct data_in *din, struct plocation *location, struct worklist *pwl) fc__attribute((nonnull(4)))
bool dio_get_sfloat_json(struct connection *pc, struct data_in *din, const struct plocation *location, float *dest, int float_factor) fc__attribute((nonnull(4)))
int dio_put_bool32_json(struct json_data_out *dout, const struct plocation *location, bool value)
bool dio_get_bool32_json(struct connection *pc, struct data_in *din, const struct plocation *location, bool *dest) fc__attribute((nonnull(4)))
bool dio_get_ufloat_json(struct connection *pc, struct data_in *din, const struct plocation *location, float *dest, int float_factor) fc__attribute((nonnull(4)))
bool dio_get_bool8_json(struct connection *pc, struct data_in *din, const struct plocation *location, bool *dest) fc__attribute((nonnull(4)))
bool dio_get_unit_order_json(struct connection *pc, struct data_in *din, struct plocation *location, struct unit_order *order) fc__attribute((nonnull(4)))
int dio_put_sfloat_json(struct json_data_out *dout, const struct plocation *location, float value, int float_factor)
int dio_put_requirement_json(struct json_data_out *dout, const struct plocation *location, const struct requirement *preq)
int dio_put_sint8_json(struct json_data_out *dout, const struct plocation *location, int value)
int dio_put_sint16_json(struct json_data_out *dout, const struct plocation *location, int value)
int dio_put_ufloat_json(struct json_data_out *dout, const struct plocation *location, float value, int float_factor)
bool dio_get_sint16_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
int dio_put_string_json(struct json_data_out *dout, const struct plocation *location, const char *value)
bool dio_get_action_probability_json(struct connection *pc, struct data_in *din, const struct plocation *location, struct act_prob *prob) fc__attribute((nonnull(4)))
bool dio_get_uint16_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest) fc__attribute((nonnull(4)))
int dio_put_cm_parameter_json(struct json_data_out *dout, struct plocation *location, const struct cm_parameter *order)
bool dio_get_string_json(struct connection *pc, struct data_in *din, const struct plocation *location, char *dest, size_t max_dest_size) fc__attribute((nonnull(4)))
data_type
Definition dataio_raw.h:43
GType type
Definition repodlgs.c:1313
size_t size
Definition specvec.h:72
json_t * json
Definition dataio_json.h:36
struct raw_data_out raw
Definition dataio_json.h:35
void * dest
Definition dataio_raw.h:36
size_t dest_size
Definition dataio_raw.h:37
#define fc__attribute(x)
Definition support.h:99