libpurple/protocols/facebook/json.h

Tue, 18 Aug 2015 00:04:50 -0400

author
James Geboski <jgeboski@gmail.com>
date
Tue, 18 Aug 2015 00:04:50 -0400
branch
facebook
changeset 37355
047c6f5d4392
parent 37347
34d43f8c10d1
child 37359
79374d83fae5
permissions
-rw-r--r--

facebook: display thread URL for videos

37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
1 /* purple
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
2 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
5 * source distribution.
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
6 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
10 * (at your option) any later version.
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
11 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
15 * GNU General Public License for more details.
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
16 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
20 */
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
21
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
22 #ifndef _FACEBOOK_JSON_H_
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
23 #define _FACEBOOK_JSON_H_
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
24
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
25 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
26 * SECTION:json
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
27 * @section_id: facebook-json
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
28 * @short_description: <filename>json.h</filename>
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
29 * @title: JSON Utilities
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
30 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
31 * The JSON utilities.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
32 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
33
37309
556eea7a45da facebook: merged local glibcompat.h into libpurple's
James Geboski <jgeboski@gmail.com>
parents: 37299
diff changeset
34 #include <glib.h>
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
35 #include <json-glib/json-glib.h>
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
36
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
37 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
38 * FB_JSON_ERROR:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
39 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
40 * The #GQuark of the domain of JSON errors.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
41 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
42 #define FB_JSON_ERROR fb_json_error_quark()
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
43
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
44 typedef struct _FbJsonValue FbJsonValue;
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
45 typedef struct _FbJsonValues FbJsonValues;
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
46
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
47 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
48 * FbJsonError:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
49 * @FB_JSON_ERROR_SUCCESS: There is no error.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
50 * @FB_JSON_ERROR_AMBIGUOUS: The node has ambiguous matches.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
51 * @FB_JSON_ERROR_GENERAL: General failure.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
52 * @FB_JSON_ERROR_NOMATCH: The node does not match anything.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
53 * @FB_JSON_ERROR_NULL: The node is of type NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
54 * @FB_JSON_ERROR_TYPE: The node has an unexpected type.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
55 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
56 * The error codes for the #FB_JSON_ERROR domain.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
57 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
58 typedef enum
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
59 {
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
60 FB_JSON_ERROR_SUCCESS = 0,
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
61 FB_JSON_ERROR_AMBIGUOUS,
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
62 FB_JSON_ERROR_GENERAL,
37299
b14336308988 facebook: migrated FQL usage to GraphQL
James Geboski <jgeboski@gmail.com>
parents: 37269
diff changeset
63 FB_JSON_ERROR_NOMATCH,
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
64 FB_JSON_ERROR_NULL,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
65 FB_JSON_ERROR_TYPE
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
66 } FbJsonError;
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
67
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
68 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
69 * FbJsonType:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
70 * @FB_JSON_TYPE_NULL: An unknown value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
71 * @FB_JSON_TYPE_BOOL: A boolean (#TRUE or #FALSE).
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
72 * @FB_JSON_TYPE_DBL: A floating point number.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
73 * @FB_JSON_TYPE_INT: A signed integer.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
74 * @FB_JSON_TYPE_STR: A string.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
75 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
76 * The JSON data types.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
77 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
78 typedef enum
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
79 {
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
80 FB_JSON_TYPE_NULL = 0,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
81 FB_JSON_TYPE_BOOL = G_TYPE_BOOLEAN,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
82 FB_JSON_TYPE_DBL = G_TYPE_DOUBLE,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
83 FB_JSON_TYPE_INT = G_TYPE_INT64,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
84 FB_JSON_TYPE_STR = G_TYPE_STRING
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
85 } FbJsonType;
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
86
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
87 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
88 * FbJsonValue:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
89 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
90 * @type: The #FbJsonType.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
91 * @required: TRUE if the node is required, otherwise FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
92 * @value: The #GValue.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
93 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
94 * Represents a JSON node value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
95 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
96 struct _FbJsonValue
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
97 {
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
98 const gchar *expr;
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
99 FbJsonType type;
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
100 gboolean required;
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
101 GValue value;
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
102 };
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
103
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
104 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
105 * FbJsonValues:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
106 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
107 * @queue: The queue of #FbJsonValue's.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
108 * @next: The next #FbJsonValue.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
109 * @isarray: #TRUE if an array is present, otherwise #FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
110 * @array: The #JsonArray or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
111 * @index: The advancing array index.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
112 * @error: The #GError.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
113 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
114 * Represents a JSON value handler.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
115 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
116 struct _FbJsonValues
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
117 {
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
118 JsonNode *root;
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
119 GQueue *queue;
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
120 GList *next;
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
121
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
122 gboolean isarray;
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
123 JsonArray *array;
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
124 guint index;
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
125
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
126 GError *error;
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
127 };
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
128
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
129 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
130 * fb_json_error_quark:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
131 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
132 * Gets the #GQuark of the domain of JSON errors.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
133 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
134 * Returns: The #GQuark of the domain.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
135 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
136 GQuark
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
137 fb_json_error_quark(void);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
138
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
139 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
140 * fb_json_bldr_new:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
141 * @type: The starting #JsonNodeType.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
142 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
143 * Creates a new #JsonBuilder. The starting #JsonNodeType is likely to
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
144 * be #JSON_NODE_OBJECT. The returned #JsonBuilder should be freed with
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
145 * #g_object_unref() when no longer needed. Optionally, instead of
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
146 * freeing, the returned #JsonBuilder can be closed with
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
147 * #fb_json_bldr_close().
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
148 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
149 * Returns: The new #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
150 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
151 JsonBuilder *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
152 fb_json_bldr_new(JsonNodeType type);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
153
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
154 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
155 * fb_json_bldr_close:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
156 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
157 * @type: The ending #JsonNodeType.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
158 * @size: The return local for the size of the returned string.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
159 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
160 * Closes the #JsonBuilder by returning a string representing the
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
161 * #JsonBuilder. The ending #JsonNodeType is likely to be
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
162 * #JSON_NODE_OBJECT. This calls #g_object_unref(). The returned
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
163 * string should be freed with #g_free() when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
164 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
165 * Returns: The string representation of the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
166 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
167 gchar *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
168 fb_json_bldr_close(JsonBuilder *bldr, JsonNodeType type, gsize *size);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
169
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
170 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
171 * fb_json_bldr_arr_begin:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
172 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
173 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
174 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
175 * Begins an array member in the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
176 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
177 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
178 fb_json_bldr_arr_begin(JsonBuilder *bldr, const gchar *name);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
179
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
180 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
181 * fb_json_bldr_arr_end:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
182 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
183 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
184 * Ends an array member in the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
185 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
186 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
187 fb_json_bldr_arr_end(JsonBuilder *bldr);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
188
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
189 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
190 * fb_json_bldr_obj_begin:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
191 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
192 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
193 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
194 * Begins an object member in the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
195 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
196 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
197 fb_json_bldr_obj_begin(JsonBuilder *bldr, const gchar *name);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
198
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
199 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
200 * fb_json_bldr_obj_end:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
201 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
202 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
203 * Ends an array member in the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
204 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
205 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
206 fb_json_bldr_obj_end(JsonBuilder *bldr);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
207
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
208 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
209 * fb_json_bldr_add_bool:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
210 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
211 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
212 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
213 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
214 * Adds a boolean memeber to the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
215 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
216 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
217 fb_json_bldr_add_bool(JsonBuilder *bldr, const gchar *name, gboolean value);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
218
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
219 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
220 * fb_json_bldr_add_dbl:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
221 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
222 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
223 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
224 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
225 * Adds a floating point memeber to the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
226 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
227 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
228 fb_json_bldr_add_dbl(JsonBuilder *bldr, const gchar *name, gdouble value);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
229
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
230 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
231 * fb_json_bldr_add_int:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
232 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
233 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
234 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
235 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
236 * Adds a integer memeber to the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
237 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
238 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
239 fb_json_bldr_add_int(JsonBuilder *bldr, const gchar *name, gint64 value);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
240
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
241 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
242 * fb_json_bldr_add_str:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
243 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
244 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
245 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
246 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
247 * Adds a string memeber to the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
248 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
249 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
250 fb_json_bldr_add_str(JsonBuilder *bldr, const gchar *name, const gchar *value);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
251
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
252 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
253 * fb_json_bldr_add_strf:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
254 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
255 * @name: The member name, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
256 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
257 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
258 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
259 * Adds a formatted string memeber to the #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
260 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
261 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
262 fb_json_bldr_add_strf(JsonBuilder *bldr, const gchar *name,
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
263 const gchar *format, ...)
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
264 G_GNUC_PRINTF(3, 4);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
265
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
266 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
267 * fb_json_node_new:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
268 * @data: The string JSON.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
269 * @size: The size of @json, or -1 if null-terminated.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
270 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
271 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
272 * Creates a new #JsonNode. The returned #JsonBuilder should be freed
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
273 * wuth #json_node_free() when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
274 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
275 * Returns: The new #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
276 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
277 JsonNode *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
278 fb_json_node_new(const gchar *data, gssize size, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
279
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
280 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
281 * fb_json_node_get:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
282 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
283 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
284 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
285 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
286 * Gets a new #JsonNode value from a parent #JsonNode with a #JsonPath
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
287 * expression. The returned #JsonNode should be freed with
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
288 * #json_node_free() when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
289 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
290 * Returns: The new #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
291 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
292 JsonNode *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
293 fb_json_node_get(JsonNode *root, const gchar *expr, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
294
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
295 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
296 * fb_json_node_get_nth:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
297 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
298 * @n: The index number.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
299 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
300 * Gets a #JsonNode value from a parent #JsonNode by index. The
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
301 * returned #JsonNode should not be freed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
302 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
303 * Return: The #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
304 */
37315
7a7771557143 facebook: implemented handling of message attachments
James Geboski <jgeboski@gmail.com>
parents: 37314
diff changeset
305 JsonNode *
7a7771557143 facebook: implemented handling of message attachments
James Geboski <jgeboski@gmail.com>
parents: 37314
diff changeset
306 fb_json_node_get_nth(JsonNode *root, guint n);
7a7771557143 facebook: implemented handling of message attachments
James Geboski <jgeboski@gmail.com>
parents: 37314
diff changeset
307
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
308 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
309 * fb_json_node_get_arr:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
310 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
311 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
312 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
313 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
314 * Gets a new #JsonArray value from a parent #JsonNode with a #JsonPath
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
315 * expression. The returned #JsonArray should be freed with
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
316 * #json_array_unref() when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
317 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
318 * Returns: The new #JsonArray.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
319 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
320 JsonArray *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
321 fb_json_node_get_arr(JsonNode *root, const gchar *expr, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
322
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
323 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
324 * fb_json_node_get_bool:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
325 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
326 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
327 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
328 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
329 * Gets a boolean value from a parent #JsonNode with a #JsonPath
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
330 * expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
331 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
332 * Returns: The boolean value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
333 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
334 gboolean
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
335 fb_json_node_get_bool(JsonNode *root, const gchar *expr, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
336
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
337 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
338 * fb_json_node_get_dbl:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
339 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
340 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
341 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
342 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
343 * Gets a floating point value from a parent #JsonNode with a #JsonPath
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
344 * expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
345 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
346 * Returns: The floating point value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
347 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
348 gdouble
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
349 fb_json_node_get_dbl(JsonNode *root, const gchar *expr, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
350
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
351 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
352 * fb_json_node_get_int:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
353 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
354 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
355 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
356 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
357 * Gets an integer value from a parent #JsonNode with a #JsonPath
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
358 * expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
359 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
360 * Returns: The integer value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
361 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
362 gint64
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
363 fb_json_node_get_int(JsonNode *root, const gchar *expr, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
364
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
365 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
366 * fb_json_node_get_str:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
367 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
368 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
369 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
370 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
371 * Gets an string value from a parent #JsonNode with a #JsonPath
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
372 * expression. The returned string should be freed with #g_free()
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
373 * when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
374 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
375 * Returns: The string value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
376 */
37269
129e87951cd6 facebook: fixed JSON parsing for older json-glib versions
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
377 gchar *
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
378 fb_json_node_get_str(JsonNode *root, const gchar *expr, GError **error);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
379
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
380 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
381 * fb_json_values_new:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
382 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
383 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
384 * Creates a new #FbJsonValues. The returned #FbJsonValues should be
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
385 * freed with #fb_json_values_free() when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
386 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
387 * Returns: The new #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
388 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
389 FbJsonValues *
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
390 fb_json_values_new(JsonNode *root);
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
391
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
392 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
393 * fb_json_values_free:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
394 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
395 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
396 * Frees all memory used by the #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
397 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
398 void
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
399 fb_json_values_free(FbJsonValues *values);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
400
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
401 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
402 * fb_json_values_add:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
403 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
404 * @type: The #FbJsonType.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
405 * @required: TRUE if the node is required, otherwise FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
406 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
407 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
408 * Adds a new #FbJsonValue to the #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
409 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
410 void
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
411 fb_json_values_add(FbJsonValues *values, FbJsonType type, gboolean required,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
412 const gchar *expr);
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
413
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
414 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
415 * fb_json_values_get_root:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
416 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
417 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
418 * Gets the current working root #JsonNode. This is either the current
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
419 * array #JsonNode, or the root #JsonNode. The returned #JsonNode
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
420 * should not be freed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
421 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
422 JsonNode *
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
423 fb_json_values_get_root(FbJsonValues *values);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
424
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
425 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
426 * fb_json_values_set_array:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
427 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
428 * @required: TRUE if the node is required, otherwise FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
429 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
430 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
431 * Sets the #JsonPath for an array to base all #FbJsonValue's off.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
432 */
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
433 void
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
434 fb_json_values_set_array(FbJsonValues *values, gboolean required,
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
435 const gchar *expr);
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
436
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
437 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
438 * fb_json_values_update:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
439 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
440 * @error: The return location for the #GError, or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
441 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
442 * Updates the current working root. This should be called after all of
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
443 * the #FbJsonValue's have been added with #fb_json_values_add(). If an
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
444 * array was set with #fb_json_values_set_array(), then this should be
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
445 * called in a while loop, until #FALSE is returned.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
446 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
447 * Returns: #TRUE if the values were updated, otherwise #FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
448 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
449 gboolean
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
450 fb_json_values_update(FbJsonValues *values, GError **error);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
451
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
452 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
453 * fb_json_values_next:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
454 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
455 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
456 * Gets the next #GValue from the #FbJsonValues. Before calling this
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
457 * function, #fb_json_values_update() must be called.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
458 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
459 * Returns: The #GValue.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
460 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
461 const GValue *
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
462 fb_json_values_next(FbJsonValues *values);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
463
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
464 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
465 * fb_json_values_next_bool:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
466 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
467 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
468 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
469 * Gets the next boolean value from the #FbJsonValues. Before calling
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
470 * this function, #fb_json_values_update() must be called.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
471 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
472 * Returns: The boolean value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
473 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
474 gboolean
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
475 fb_json_values_next_bool(FbJsonValues *values, gboolean defval);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
476
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
477 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
478 * fb_json_values_next_dbl:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
479 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
480 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
481 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
482 * Gets the next floating point value from the #FbJsonValues. Before
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
483 * calling this function, #fb_json_values_update() must be called.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
484 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
485 * Returns: The floating point value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
486 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
487 gdouble
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
488 fb_json_values_next_dbl(FbJsonValues *values, gdouble defval);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
489
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
490 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
491 * fb_json_values_next_int:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
492 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
493 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
494 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
495 * Gets the next integer value from the #FbJsonValues. Before calling
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
496 * this function, #fb_json_values_update() must be called.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
497 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
498 * Returns: The integer value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
499 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
500 gint64
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
501 fb_json_values_next_int(FbJsonValues *values, gint64 defval);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
502
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
503 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
504 * fb_json_values_next_str:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
505 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
506 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
507 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
508 * Gets the next string value from the #FbJsonValues. Before calling
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
509 * this function, #fb_json_values_update() must be called.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
510 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
511 * Returns: The string value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
512 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
513 const gchar *
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
514 fb_json_values_next_str(FbJsonValues *values, const gchar *defval);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
515
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
516 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
517 * fb_json_values_next_str_dup:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
518 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
519 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
520 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
521 * Gets the next duplicate string value from the #FbJsonValues. Before
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
522 * calling this function, #fb_json_values_update() must be called.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
523 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
524 * Returns: The duplicate string value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
525 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
526 gchar *
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
527 fb_json_values_next_str_dup(FbJsonValues *values, const gchar *defval);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
528
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
529 #endif /* _FACEBOOK_JSON_H_ */

mercurial