Freeciv-3.2
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);
46 const struct plocation *location, int *dest);
48 const struct plocation *location, int *dest);
49
51 const struct plocation *location, int *dest);
53 const struct plocation *location, int *dest);
55 const struct plocation *location, int *dest);
56
58 const struct plocation *location, bool *dest);
60 const struct plocation *location, bool *dest);
62 const struct plocation *location,
63 float *dest, int float_factor);
65 const struct plocation *location,
66 float *dest, int float_factor);
68 struct plocation *location,
69 void *dest, size_t dest_size);
71 const struct plocation *location,
72 char *dest, size_t max_dest_size);
74 const struct plocation *location,
75 char *dest, size_t max_dest_size);
77 struct plocation *location,
78 struct cm_parameter *param);
80 struct plocation *location,
81 struct worklist *pwl);
83 struct plocation *location,
84 struct unit_order *order);
86 const struct plocation *location,
87 struct requirement *preq);
89 const struct plocation *location,
90 struct act_prob *prob);
91
93 const struct plocation *location,
94 int **values, int stop_value);
96 const struct plocation *location,
97 int **values, int stop_value);
98
99/* Should be a function but we need some macro magic. */
100#define DIO_BV_GET(pdin, location, bv) \
101 dio_get_memory_json(pc, pdin, location, \
102 (bv).vec, sizeof((bv).vec))
103
104#define DIO_GET(f, d, l, ...) \
105 dio_get_##f##_json(pc, d, l, ## __VA_ARGS__)
106
107/* puts */
109 const struct plocation *location, int size);
110
112 const struct plocation *location,
113 int value);
114
116 const struct plocation *location, int value);
118 const struct plocation *location, int value);
120 const struct plocation *location, int value);
122 const struct plocation *location, int value);
124 const struct plocation *location, int value);
126 const struct plocation *location, int value);
128 const struct plocation *location, bool value);
130 const struct plocation *location, bool value);
132 const struct plocation *location,
133 float value, int float_factor);
135 const struct plocation *location,
136 float value, int float_factor);
137
139 struct plocation *location,
140 const void *value, size_t size);
142 const struct plocation *location,
143 const char *value);
145 const struct plocation *location,
146 const char *value);
148 struct plocation *location,
149 const struct cm_parameter *order);
151 struct plocation *location,
152 const struct unit_order *order);
154 struct plocation *location,
155 const struct worklist *pwl);
157 const struct plocation *location,
158 const struct requirement *preq);
160 const struct plocation *location,
161 const struct act_prob *prob);
162
164 const struct plocation *location,
165 int *values, int stop_value);
167 const struct plocation *location,
168 int *values, int stop_value);
169
170/* Should be a function but we need some macro magic. */
171#define DIO_BV_PUT(pdout, location, bv) \
172 dio_put_memory_json((pdout), location, (bv).vec, sizeof((bv).vec))
173
174#define DIO_PUT(f, d, l, ...) \
175 dio_put_##f##_json(d, l, ## __VA_ARGS__)
176
177#ifdef __cplusplus
178}
179#endif /* __cplusplus */
180
181#endif /* FC__DATAIO_JSON_H */
char * incite_cost
Definition comments.c:75
int dio_put_unit_order_json(struct json_data_out *dout, struct plocation *location, const struct unit_order *order)
bool dio_get_type_json(struct data_in *din, enum data_type type, int *dest) fc__attribute((nonnull(3)))
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_uint16_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest)
bool dio_get_estring_json(struct connection *pc, struct data_in *din, const struct plocation *location, char *dest, size_t max_dest_size)
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)
bool dio_get_worklist_json(struct connection *pc, struct data_in *din, struct plocation *location, struct worklist *pwl)
int dio_put_uint16_vec8_json(struct json_data_out *dout, const struct plocation *location, int *values, int stop_value)
bool dio_get_sint16_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest)
bool dio_get_sint32_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest)
bool dio_get_sint8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest)
int dio_put_uint16_json(struct json_data_out *dout, const struct plocation *location, int value)
bool dio_get_bool32_json(struct connection *pc, struct data_in *din, const struct plocation *location, bool *dest)
int dio_put_memory_json(struct json_data_out *dout, struct plocation *location, const void *value, size_t size)
bool dio_get_uint32_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest)
bool dio_get_string_json(struct connection *pc, struct data_in *din, const struct plocation *location, char *dest, size_t max_dest_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)
bool dio_get_requirement_json(struct connection *pc, struct data_in *din, const struct plocation *location, struct requirement *preq)
int dio_put_bool8_json(struct json_data_out *dout, const struct plocation *location, bool value)
bool dio_get_uint8_vec8_json(struct connection *pc, struct data_in *din, 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)
bool dio_get_sfloat_json(struct connection *pc, struct data_in *din, const struct plocation *location, float *dest, int float_factor)
bool dio_get_uint8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int *dest)
int dio_put_sint32_json(struct json_data_out *dout, const struct plocation *location, int value)
bool dio_get_memory_json(struct connection *pc, struct data_in *din, struct plocation *location, void *dest, size_t dest_size)
bool dio_get_unit_order_json(struct connection *pc, struct data_in *din, struct plocation *location, struct unit_order *order)
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_ufloat_json(struct connection *pc, struct data_in *din, const struct plocation *location, float *dest, int float_factor)
int dio_put_bool32_json(struct json_data_out *dout, const struct plocation *location, bool value)
bool dio_get_action_probability_json(struct connection *pc, struct data_in *din, const struct plocation *location, struct act_prob *prob)
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_bool8_json(struct connection *pc, struct data_in *din, const struct plocation *location, bool *dest)
int dio_put_string_json(struct json_data_out *dout, const struct plocation *location, const char *value)
int dio_put_cm_parameter_json(struct json_data_out *dout, struct plocation *location, const struct cm_parameter *order)
bool dio_get_uint16_vec8_json(struct connection *pc, struct data_in *din, const struct plocation *location, int **values, int stop_value)
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