summaryrefslogtreecommitdiff
path: root/jsonpath.h
diff options
context:
space:
mode:
authorJoey Adams2010-07-23 22:01:36 +0000
committerJoey Adams2010-07-23 22:01:36 +0000
commit8a019e04b817ffca00ec9759f3d12c60c808e67f (patch)
tree59846b7f57946d2b2c9a9208a34435e2ef43a178 /jsonpath.h
parentf5cbbbe875326dbe5d0c43bc3c692f64f77a30bd (diff)
Ran pg_indent and made a few purely cosmetic changes (before running pg_indent again).
Diffstat (limited to 'jsonpath.h')
-rw-r--r--jsonpath.h64
1 files changed, 36 insertions, 28 deletions
diff --git a/jsonpath.h b/jsonpath.h
index 109b785..0f92acd 100644
--- a/jsonpath.h
+++ b/jsonpath.h
@@ -5,56 +5,64 @@
#include "nodes/pg_list.h"
-typedef enum {
+typedef enum
+{
JP_ROOT,
JP_WILDCARD,
JP_INDEX_SUBSCRIPT,
JP_KEY_SUBSCRIPT,
JP_CALL_CHAR
-} jp_element_type;
+} jp_element_type;
-typedef struct {
+typedef struct
+{
jp_element_type type;
- union {
- long index;
- struct {
- char *ptr;
- size_t length;
- } key;
- } data;
+ union
+ {
+ long index;
+ struct
+ {
+ char *ptr;
+ size_t length;
+ } key;
+ } data;
- // If element was preceded by ".." in pattern
- bool recursive_descent;
-} jp_element;
+ /* If element was preceded by ".." in pattern */
+ bool recursive_descent;
+} jp_element;
-typedef enum {
+typedef enum
+{
JP_REF_NODE,
JP_REF_CHAR
-} JPRefType;
+} JPRefType;
-typedef struct {
- JPRefType type;
+typedef struct
+{
+ JPRefType type;
- union {
- json_node *node;
+ union
+ {
+ json_node *node;
- struct {
+ struct
+ {
const char *bytes;
- size_t length;
+ size_t length;
} chr;
- } u;
-} JPRef;
+ } u;
+} JPRef;
typedef List /* jp_element* */ JSONPath;
-JSONPath *jp_parse(const char *pattern);
-char *jp_show(JSONPath *jp);
+JSONPath *jp_parse(const char *pattern);
+char *jp_show(JSONPath * jp);
-List /* JPRef* */ *jp_match(JSONPath *jp, json_node *json);
-void jp_set(JSONPath *jp, json_node *json, json_node *value);
+List /* JPRef* */ *jp_match(JSONPath * jp, json_node * json);
+void jp_set(JSONPath * jp, json_node * json, json_node * value);
/* Returns the JSON encoding of the given reference. */
-char *jpref_encode(JPRef *ref);
+char *jpref_encode(JPRef * ref);
#endif