File: json-format.h

package info (click to toggle)
lastpass-cli 1.6.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 912 kB
  • sloc: ansic: 10,203; sh: 683; makefile: 45
file content (36 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (4)
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
#ifndef JSON_FORMAT_H
#define JSON_FORMAT_H

enum json_field_type {
	JSON_STRING,
	JSON_ARRAY,
	JSON_OBJECT
};

/*
 * Stores a JSON record to be formatted.
 *
 * Type field dictates which union is used for primitive types.
 * For both objects and arrays, children holds the items that are
 * assigned to the container, and those fields are linked via
 * siblings pointer.  The only difference between an array and an
 * object is that the children will not have names in the case of
 * an array.
 */
struct json_field
{
	const char *name;
	enum json_field_type type;

	/* list of properties */
	struct list_head children;
	struct list_head siblings;

	union {
		const char *string_value;
	} u;
};

void json_format_account_list(struct list_head *accounts);

#endif /* JSON_FORMAT_H */