MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
json_object_iterator.c
Go to the documentation of this file.
1 
18 #include <stddef.h>
19 
20 #include "json.h"
21 #include "json_object_private.h"
22 
23 #include "json_object_iterator.h"
24 
58 static const void* kObjectEndIterValue = NULL;
62 
68 {
69  struct json_object_iterator iter;
70  struct lh_table* pTable;
71 
74  pTable = json_object_get_object(obj);
75  JASSERT(NULL != pTable);
76 
79  iter.opaque_ = pTable->head;
80  return iter;
81 }
82 
88 {
89  struct json_object_iterator iter;
90 
91  JASSERT(NULL != obj);
93 
95 
96  return iter;
97 }
98 
102 void
104 {
105  JASSERT(NULL != iter);
107 
108  iter->opaque_ = ((struct lh_entry *)iter->opaque_)->next;
109 }
110 
111 
115 const char*
117 {
118  JASSERT(NULL != iter);
120 
121  return (const char*)(((struct lh_entry *)iter->opaque_)->k);
122 }
123 
124 
128 struct json_object*
130 {
131  JASSERT(NULL != iter);
133 
134  return (struct json_object*)(((struct lh_entry *)iter->opaque_)->v);
135 }
136 
137 
141 json_bool
143  const struct json_object_iterator* iter2)
144 {
145  JASSERT(NULL != iter1);
146  JASSERT(NULL != iter2);
147 
148  return (iter1->opaque_ == iter2->opaque_);
149 }
150 
151 
157 {
158  struct json_object_iterator iter;
159 
165  iter.opaque_ = NULL;
166 
167  return iter;
168 }
struct json_object_iterator json_object_iter_begin(struct json_object *obj)
static const void * kObjectEndIterValue
json_bool json_object_iter_equal(const struct json_object_iterator *iter1, const struct json_object_iterator *iter2)
struct json_object_iterator json_object_iter_init_default(void)
struct json_object * json_object_iter_peek_value(const struct json_object_iterator *iter)
#define JASSERT(cond)
Definition: debug.h:37
Definition: linkhash.h:62
struct lh_table * json_object_get_object(struct json_object *obj)
Definition: json_object.c:380
int json_object_is_type(struct json_object *obj, enum json_type type)
Definition: json_object.c:204
struct lh_entry * head
Definition: linkhash.h:128
int json_bool
Definition: json_object.h:80
const char * json_object_iter_peek_name(const struct json_object_iterator *iter)
void json_object_iter_next(struct json_object_iterator *iter)
struct json_object_iterator json_object_iter_end(const struct json_object *obj)