libpurple/protocols/facebook/json.h

Mon, 12 Sep 2016 08:55:35 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Mon, 12 Sep 2016 08:55:35 -0500
changeset 38142
1dff6e343f9f
parent 37473
9fd3018c170f
child 39550
808e0a11eb9f
permissions
-rw-r--r--

gg: Protect against issues when closing while connecting

Since the GIOStream is cancelled when data is freed, any cancelled
callbacks are called after such data is freed. This patch guards against
cancelled calls by safely returning without accessing any freed data if
the connection has been cancelled (aka closed).

Futhermore, if GG tries to connect and is quickly disconnected,
ggp_tcpsocket_close() is never called. As far as I can tell, it's an
existing bug, but PurpleSockets both work differently when closing and
are closed by the connection if any leak. So the issue wasn't a major
problem. This patch lessens the issue by guarding against it, but it
should be fixed at some point.

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
37373
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
37 #define FB_TYPE_JSON_VALUES (fb_json_values_get_type())
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
38 #define FB_JSON_VALUES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FB_TYPE_JSON_VALUES, FbJsonValues))
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
39 #define FB_JSON_VALUES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), FB_TYPE_JSON_VALUES, FbJsonValuesClass))
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
40 #define FB_IS_JSON_VALUES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), FB_TYPE_JSON_VALUES))
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
41 #define FB_IS_JSON_VALUES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), FB_TYPE_JSON_VALUES))
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
42 #define FB_JSON_VALUES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FB_TYPE_JSON_VALUES, FbJsonValuesClass))
d6291cb2e46a facebook: fixed inconsistent type declaration
James Geboski <jgeboski@gmail.com>
parents: 37363
diff changeset
43
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
44 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
45 * FB_JSON_ERROR:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
46 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
47 * 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
48 */
37471
32c1e77d0474 facebook: coding style consistencies
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
49 #define FB_JSON_ERROR fb_json_error_quark()
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
50
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
51 typedef struct _FbJsonValues FbJsonValues;
37363
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
52 typedef struct _FbJsonValuesClass FbJsonValuesClass;
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
53 typedef struct _FbJsonValuesPrivate FbJsonValuesPrivate;
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
54
37347
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 * FbJsonError:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
57 * @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
58 * @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
59 * @FB_JSON_ERROR_GENERAL: General failure.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
60 * @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
61 * @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
62 * @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
63 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
64 * 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
65 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
66 typedef enum
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
67 {
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
68 FB_JSON_ERROR_SUCCESS = 0,
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
69 FB_JSON_ERROR_AMBIGUOUS,
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
70 FB_JSON_ERROR_GENERAL,
37299
b14336308988 facebook: migrated FQL usage to GraphQL
James Geboski <jgeboski@gmail.com>
parents: 37269
diff changeset
71 FB_JSON_ERROR_NOMATCH,
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
72 FB_JSON_ERROR_NULL,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
73 FB_JSON_ERROR_TYPE
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
74 } FbJsonError;
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
75
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
76 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
77 * FbJsonType:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
78 * @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
79 * @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
80 * @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
81 * @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
82 * @FB_JSON_TYPE_STR: A string.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
83 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
84 * The JSON data types.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
85 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
86 typedef enum
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
87 {
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
88 FB_JSON_TYPE_NULL = 0,
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
89 FB_JSON_TYPE_BOOL = G_TYPE_BOOLEAN,
37359
79374d83fae5 facebook: removed alignment whitespace
James Geboski <jgeboski@gmail.com>
parents: 37347
diff changeset
90 FB_JSON_TYPE_DBL = G_TYPE_DOUBLE,
79374d83fae5 facebook: removed alignment whitespace
James Geboski <jgeboski@gmail.com>
parents: 37347
diff changeset
91 FB_JSON_TYPE_INT = G_TYPE_INT64,
79374d83fae5 facebook: removed alignment whitespace
James Geboski <jgeboski@gmail.com>
parents: 37347
diff changeset
92 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
93 } FbJsonType;
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
94
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
95 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
96 * FbJsonValues:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
97 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
98 * Represents a JSON value handler.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
99 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
100 struct _FbJsonValues
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
101 {
37363
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
102 /*< private >*/
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
103 GObject parent;
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
104 FbJsonValuesPrivate *priv;
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
105 };
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
106
37363
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
107 /**
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
108 * FbJsonValuesClass:
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
109 *
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
110 * The base class for all #FbJsonValues's.
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
111 */
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
112 struct _FbJsonValuesClass
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
113 {
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
114 /*< private >*/
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
115 GObjectClass parent_class;
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
116 };
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
117
37363
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
118 /**
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
119 * fb_json_values_get_type:
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
120 *
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
121 * Returns: The #GType for an #FbJsonValues.
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
122 */
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
123 GType
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
124 fb_json_values_get_type(void);
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
125
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
126 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
127 * fb_json_error_quark:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
128 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
129 * 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
130 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
131 * Returns: The #GQuark of the domain.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
132 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
133 GQuark
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
134 fb_json_error_quark(void);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
135
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
136 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
137 * fb_json_bldr_new:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
138 * @type: The starting #JsonNodeType.
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 * 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
141 * 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
142 * #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
143 * 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
144 * #fb_json_bldr_close().
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
145 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
146 * Returns: The new #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
147 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
148 JsonBuilder *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
149 fb_json_bldr_new(JsonNodeType type);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
150
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
151 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
152 * fb_json_bldr_close:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
153 * @bldr: The #JsonBuilder.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
154 * @type: The ending #JsonNodeType.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
155 * @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
156 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
157 * 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
158 * #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
159 * #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
160 * 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
161 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
162 * 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
163 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
164 gchar *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
165 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
166
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
167 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
168 * fb_json_bldr_arr_begin:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
169 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
170 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
171 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
172 * 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
173 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
174 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
175 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
176
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
177 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
178 * fb_json_bldr_arr_end:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
179 * @bldr: The #JsonBuilder.
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 * 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
182 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
183 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
184 fb_json_bldr_arr_end(JsonBuilder *bldr);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
185
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
186 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
187 * fb_json_bldr_obj_begin:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
188 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
189 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
190 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
191 * 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
192 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
193 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
194 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
195
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
196 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
197 * fb_json_bldr_obj_end:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
198 * @bldr: The #JsonBuilder.
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 * 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
201 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
202 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
203 fb_json_bldr_obj_end(JsonBuilder *bldr);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
204
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
205 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
206 * fb_json_bldr_add_bool:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
207 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
208 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
209 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
210 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
211 * 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
212 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
213 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
214 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
215
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
216 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
217 * fb_json_bldr_add_dbl:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
218 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
219 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
220 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
221 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
222 * 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
223 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
224 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
225 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
226
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
227 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
228 * fb_json_bldr_add_int:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
229 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
230 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
231 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
232 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
233 * 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
234 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
235 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
236 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
237
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
238 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
239 * fb_json_bldr_add_str:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
240 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
241 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
242 * @value: The value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
243 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
244 * 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
245 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
246 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
247 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
248
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
249 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
250 * fb_json_bldr_add_strf:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
251 * @bldr: The #JsonBuilder.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
252 * @name: The member name or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
253 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
254 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
255 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
256 * 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
257 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
258 void
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
259 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
260 const gchar *format, ...)
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
261 G_GNUC_PRINTF(3, 4);
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
262
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
263 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
264 * fb_json_node_new:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
265 * @data: The string JSON.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
266 * @size: The size of @json or -1 if null-terminated.
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
267 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
268 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
269 * 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
270 * 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
271 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
272 * Returns: The new #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
273 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
274 JsonNode *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
275 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
276
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
277 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
278 * fb_json_node_get:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
279 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
280 * @expr: The #JsonPath expression.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
281 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
282 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
283 * 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
284 * 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
285 * #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
286 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
287 * Returns: The new #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
288 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
289 JsonNode *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
290 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
291
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
292 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
293 * fb_json_node_get_nth:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
294 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
295 * @n: The index number.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
296 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
297 * 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
298 * returned #JsonNode should not be freed.
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 * Return: The #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
301 */
37315
7a7771557143 facebook: implemented handling of message attachments
James Geboski <jgeboski@gmail.com>
parents: 37314
diff changeset
302 JsonNode *
7a7771557143 facebook: implemented handling of message attachments
James Geboski <jgeboski@gmail.com>
parents: 37314
diff changeset
303 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
304
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
305 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
306 * fb_json_node_get_arr:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
307 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
308 * @expr: The #JsonPath expression.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
309 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
310 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
311 * 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
312 * 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
313 * #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
314 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
315 * Returns: The new #JsonArray.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
316 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
317 JsonArray *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
318 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
319
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
320 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
321 * fb_json_node_get_bool:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
322 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
323 * @expr: The #JsonPath expression.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
324 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
325 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
326 * 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
327 * expression.
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 * Returns: The boolean value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
330 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
331 gboolean
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
332 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
333
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
334 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
335 * fb_json_node_get_dbl:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
336 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
337 * @expr: The #JsonPath expression.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
338 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
339 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
340 * 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
341 * expression.
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 * Returns: The floating point value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
344 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
345 gdouble
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
346 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
347
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
348 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
349 * fb_json_node_get_int:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
350 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
351 * @expr: The #JsonPath expression.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
352 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
353 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
354 * 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
355 * expression.
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 * Returns: The integer value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
358 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
359 gint64
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
360 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
361
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
362 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
363 * fb_json_node_get_str:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
364 * @root: The root #JsonNode.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
365 * @expr: The #JsonPath expression.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
366 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
367 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
368 * 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
369 * 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
370 * when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
371 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
372 * Returns: The string value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
373 */
37269
129e87951cd6 facebook: fixed JSON parsing for older json-glib versions
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
374 gchar *
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
375 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
376
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
377 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
378 * fb_json_values_new:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
379 * @root: The root #JsonNode.
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 * Creates a new #FbJsonValues. The returned #FbJsonValues should be
37363
7201f07fe8f7 facebook: gobjectified the FbJsonValues interface
James Geboski <jgeboski@gmail.com>
parents: 37359
diff changeset
382 * freed with #g_object_unref when no longer needed.
37347
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 * Returns: The new #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
385 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
386 FbJsonValues *
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
387 fb_json_values_new(JsonNode *root);
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
388
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
389 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
390 * fb_json_values_add:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
391 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
392 * @type: The #FbJsonType.
37473
9fd3018c170f facebook: trivial GTK-Doc fixes
James Geboski <jgeboski@gmail.com>
parents: 37471
diff changeset
393 * @required: #TRUE if the node is required, otherwise #FALSE.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
394 * @expr: The #JsonPath expression.
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 * 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
397 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
398 void
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
399 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
400 const gchar *expr);
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
401
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
402 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
403 * fb_json_values_get_root:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
404 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
405 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
406 * Gets the current working root #JsonNode. This is either the current
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
407 * array #JsonNode or the root #JsonNode. The returned #JsonNode should
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
408 * not be freed.
37347
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 JsonNode *
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
411 fb_json_values_get_root(FbJsonValues *values);
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
412
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
413 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
414 * fb_json_values_set_array:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
415 * @values: The #FbJsonValues.
37473
9fd3018c170f facebook: trivial GTK-Doc fixes
James Geboski <jgeboski@gmail.com>
parents: 37471
diff changeset
416 * @required: #TRUE if the node is required, otherwise #FALSE.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
417 * @expr: The #JsonPath expression.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
418 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
419 * 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
420 */
37334
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
421 void
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
diff changeset
422 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
423 const gchar *expr);
860ee76f5f58 facebook: fixed all JSON arrays being required
James Geboski <jgeboski@gmail.com>
parents: 37316
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_update:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
427 * @values: The #FbJsonValues.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37373
diff changeset
428 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
429 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
430 * 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
431 * 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
432 * 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
433 * 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
434 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
435 * 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
436 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
437 gboolean
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
438 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
439
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
440 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
441 * fb_json_values_next:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
442 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
443 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
444 * 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
445 * 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
446 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
447 * Returns: The #GValue.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
448 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
449 const GValue *
37316
9e3520d6ec49 facebook: refactored and improved JSON error handling
James Geboski <jgeboski@gmail.com>
parents: 37315
diff changeset
450 fb_json_values_next(FbJsonValues *values);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
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_bool:
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 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
456 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
457 * 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
458 * 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
459 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
460 * Returns: The boolean value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
461 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
462 gboolean
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
463 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
464
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
465 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
466 * fb_json_values_next_dbl:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
467 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
468 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
469 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
470 * 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
471 * 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
472 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
473 * Returns: The floating point value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
474 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
475 gdouble
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
476 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
477
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
478 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
479 * fb_json_values_next_int:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
480 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
481 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
482 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
483 * 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
484 * 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
485 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
486 * Returns: The integer value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
487 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
488 gint64
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
489 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
490
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
491 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
492 * fb_json_values_next_str:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
493 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
494 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
495 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
496 * 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
497 * 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
498 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
499 * Returns: The string value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
500 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
501 const gchar *
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
502 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
503
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
504 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
505 * fb_json_values_next_str_dup:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
506 * @values: The #FbJsonValues.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
507 * @defval: The default value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
508 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
509 * 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
510 * 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
511 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
512 * Returns: The duplicate string value.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37334
diff changeset
513 */
37314
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
514 gchar *
1fedb5e19577 facebook: refactored the parsing of JSON values
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
515 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
516
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
517 #endif /* _FACEBOOK_JSON_H_ */

mercurial