• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/json-c/doc/html/json__visit_8h.html

  1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 <html xmlns="http://www.w3.org/1999/xhtml">
  3 <head>
  4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6 <title>json-c: /home/erh/json-c-0.15/json_visit.h File Reference</title>
  7 <link href="tabs.css" rel="stylesheet" type="text/css"/>
  8 <script type="text/javascript" src="jquery.js"></script>
  9 <script type="text/javascript" src="dynsections.js"></script>
 10 <link href="doxygen.css" rel="stylesheet" type="text/css" />
 11 </head>
 12 <body>
 13 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
 14 <div id="titlearea">
 15 <table cellspacing="0" cellpadding="0">
 16  <tbody>
 17  <tr style="height: 56px;">
 18   <td style="padding-left: 0.5em;">
 19    <div id="projectname">json-c
 20    &#160;<span id="projectnumber">0.15</span>
 21    </div>
 22   </td>
 23  </tr>
 24  </tbody>
 25 </table>
 26 </div>
 27 <!-- end header part -->
 28 <!-- Generated by Doxygen 1.8.2 -->
 29   <div id="navrow1" class="tabs">
 30     <ul class="tablist">
 31       <li><a href="index.html"><span>Main&#160;Page</span></a></li>
 32       <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
 33       <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
 34       <li class="current"><a href="files.html"><span>Files</span></a></li>
 35     </ul>
 36   </div>
 37   <div id="navrow2" class="tabs2">
 38     <ul class="tablist">
 39       <li><a href="files.html"><span>File&#160;List</span></a></li>
 40       <li><a href="globals.html"><span>Globals</span></a></li>
 41     </ul>
 42   </div>
 43 <div id="nav-path" class="navpath">
 44   <ul>
 45 <li class="navelem"><a class="el" href="dir_71f13e590eb9d766c31051438785ada5.html">json-c-0.15</a></li>  </ul>
 46 </div>
 47 </div><!-- top -->
 48 <div class="header">
 49   <div class="summary">
 50 <a href="#define-members">Macros</a> &#124;
 51 <a href="#typedef-members">Typedefs</a> &#124;
 52 <a href="#func-members">Functions</a>  </div>
 53   <div class="headertitle">
 54 <div class="title">json_visit.h File Reference</div>  </div>
 55 </div><!--header-->
 56 <div class="contents">
 57 
 58 <p>Methods for walking a tree of objects.  
 59 <a href="#details">More...</a></p>
 60 <table class="memberdecls">
 61 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
 62 Macros</h2></td></tr>
 63 <tr class="memitem:ac5be4a96b99b724833943003715dfc1c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#ac5be4a96b99b724833943003715dfc1c">JSON_C_VISIT_SECOND</a>&#160;&#160;&#160;0x02</td></tr>
 64 <tr class="separator:ac5be4a96b99b724833943003715dfc1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
 65 <tr class="memitem:a98b35e1ba1d52d41799dccbfd2c170a1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#a98b35e1ba1d52d41799dccbfd2c170a1">JSON_C_VISIT_RETURN_CONTINUE</a>&#160;&#160;&#160;0</td></tr>
 66 <tr class="separator:a98b35e1ba1d52d41799dccbfd2c170a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
 67 <tr class="memitem:adc7ca60a79c4ae870d9463e41527c2a1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#adc7ca60a79c4ae870d9463e41527c2a1">JSON_C_VISIT_RETURN_SKIP</a>&#160;&#160;&#160;7547</td></tr>
 68 <tr class="separator:adc7ca60a79c4ae870d9463e41527c2a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
 69 <tr class="memitem:a327a21f1f1c6f84e7a13fbaaf4a51b13"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#a327a21f1f1c6f84e7a13fbaaf4a51b13">JSON_C_VISIT_RETURN_POP</a>&#160;&#160;&#160;767</td></tr>
 70 <tr class="separator:a327a21f1f1c6f84e7a13fbaaf4a51b13"><td class="memSeparator" colspan="2">&#160;</td></tr>
 71 <tr class="memitem:a5956f41bed48f90a127f9b37fad7ea97"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#a5956f41bed48f90a127f9b37fad7ea97">JSON_C_VISIT_RETURN_STOP</a>&#160;&#160;&#160;7867</td></tr>
 72 <tr class="separator:a5956f41bed48f90a127f9b37fad7ea97"><td class="memSeparator" colspan="2">&#160;</td></tr>
 73 <tr class="memitem:abfacb0713b81c897a8ce5f37ff6ffb9c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#abfacb0713b81c897a8ce5f37ff6ffb9c">JSON_C_VISIT_RETURN_ERROR</a>&#160;&#160;&#160;-1</td></tr>
 74 <tr class="separator:abfacb0713b81c897a8ce5f37ff6ffb9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
 75 </table><table class="memberdecls">
 76 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
 77 Typedefs</h2></td></tr>
 78 <tr class="memitem:a0fadec4abb2befcacfaff7df822f3f8d"><td class="memItemLeft" align="right" valign="top">typedef int(&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#a0fadec4abb2befcacfaff7df822f3f8d">json_c_visit_userfunc</a> )(<a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *jso, int flags, <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *parent_jso, const char *jso_key, size_t *jso_index, void *userarg)</td></tr>
 79 <tr class="separator:a0fadec4abb2befcacfaff7df822f3f8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
 80 </table><table class="memberdecls">
 81 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
 82 Functions</h2></td></tr>
 83 <tr class="memitem:a0f585e56a5d417381cdf6c28538dbb20"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="json__visit_8h.html#a0f585e56a5d417381cdf6c28538dbb20">json_c_visit</a> (<a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *jso, int future_flags, <a class="el" href="json__visit_8h.html#a0fadec4abb2befcacfaff7df822f3f8d">json_c_visit_userfunc</a> *userfunc, void *userarg)</td></tr>
 84 <tr class="separator:a0f585e56a5d417381cdf6c28538dbb20"><td class="memSeparator" colspan="2">&#160;</td></tr>
 85 </table>
 86 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
 87 <div class="textblock"><p>Methods for walking a tree of objects. </p>
 88 </div><h2 class="groupheader">Macro Definition Documentation</h2>
 89 <a class="anchor" id="a98b35e1ba1d52d41799dccbfd2c170a1"></a>
 90 <div class="memitem">
 91 <div class="memproto">
 92       <table class="memname">
 93         <tr>
 94           <td class="memname">#define JSON_C_VISIT_RETURN_CONTINUE&#160;&#160;&#160;0</td>
 95         </tr>
 96       </table>
 97 </div><div class="memdoc">
 98 <p>This json_c_visit_userfunc return value indicates that iteration should proceed normally. </p>
 99 
100 </div>
101 </div>
102 <a class="anchor" id="abfacb0713b81c897a8ce5f37ff6ffb9c"></a>
103 <div class="memitem">
104 <div class="memproto">
105       <table class="memname">
106         <tr>
107           <td class="memname">#define JSON_C_VISIT_RETURN_ERROR&#160;&#160;&#160;-1</td>
108         </tr>
109       </table>
110 </div><div class="memdoc">
111 <p>This json_c_visit_userfunc return value indicates that iteration should stop immediately, and cause json_c_visit to return an error. </p>
112 
113 </div>
114 </div>
115 <a class="anchor" id="a327a21f1f1c6f84e7a13fbaaf4a51b13"></a>
116 <div class="memitem">
117 <div class="memproto">
118       <table class="memname">
119         <tr>
120           <td class="memname">#define JSON_C_VISIT_RETURN_POP&#160;&#160;&#160;767</td>
121         </tr>
122       </table>
123 </div><div class="memdoc">
124 <p>This json_c_visit_userfunc return value indicates that iteration of the fields/elements of the <b>containing</b> object should stop and continue "popped up" a level of the object hierarchy. For example, returning this when handling arg will result in arg3 and any other fields being skipped. The next call to userfunc will be the JSON_C_VISIT_SECOND call on "foo", followed by a userfunc call on "bar". </p>
125 <pre>
126 {
127   "foo": {
128     "arg1": 1,
129     "arg2": 2,
130     "arg3": 3,
131     ...
132   },
133   "bar": {
134     ...
135   }
136 }
137 </pre> 
138 </div>
139 </div>
140 <a class="anchor" id="adc7ca60a79c4ae870d9463e41527c2a1"></a>
141 <div class="memitem">
142 <div class="memproto">
143       <table class="memname">
144         <tr>
145           <td class="memname">#define JSON_C_VISIT_RETURN_SKIP&#160;&#160;&#160;7547</td>
146         </tr>
147       </table>
148 </div><div class="memdoc">
149 <p>This json_c_visit_userfunc return value indicates that iteration over the members of the current object should be skipped. If the current object isn't a container (array or object), this is no different than JSON_C_VISIT_RETURN_CONTINUE. </p>
150 
151 </div>
152 </div>
153 <a class="anchor" id="a5956f41bed48f90a127f9b37fad7ea97"></a>
154 <div class="memitem">
155 <div class="memproto">
156       <table class="memname">
157         <tr>
158           <td class="memname">#define JSON_C_VISIT_RETURN_STOP&#160;&#160;&#160;7867</td>
159         </tr>
160       </table>
161 </div><div class="memdoc">
162 <p>This json_c_visit_userfunc return value indicates that iteration should stop immediately, and cause json_c_visit to return success. </p>
163 
164 </div>
165 </div>
166 <a class="anchor" id="ac5be4a96b99b724833943003715dfc1c"></a>
167 <div class="memitem">
168 <div class="memproto">
169       <table class="memname">
170         <tr>
171           <td class="memname">#define JSON_C_VISIT_SECOND&#160;&#160;&#160;0x02</td>
172         </tr>
173       </table>
174 </div><div class="memdoc">
175 <p>Passed to json_c_visit_userfunc as one of the flags values to indicate that this is the second time a container (array or object) is being called, after all of it's members have been iterated over. </p>
176 
177 </div>
178 </div>
179 <h2 class="groupheader">Typedef Documentation</h2>
180 <a class="anchor" id="a0fadec4abb2befcacfaff7df822f3f8d"></a>
181 <div class="memitem">
182 <div class="memproto">
183       <table class="memname">
184         <tr>
185           <td class="memname">typedef int( json_c_visit_userfunc)(<a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *jso, int flags, <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *parent_jso, const char *jso_key, size_t *jso_index, void *userarg)</td>
186         </tr>
187       </table>
188 </div><div class="memdoc">
189 
190 </div>
191 </div>
192 <h2 class="groupheader">Function Documentation</h2>
193 <a class="anchor" id="a0f585e56a5d417381cdf6c28538dbb20"></a>
194 <div class="memitem">
195 <div class="memproto">
196       <table class="memname">
197         <tr>
198           <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> int json_c_visit </td>
199           <td>(</td>
200           <td class="paramtype"><a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *&#160;</td>
201           <td class="paramname"><em>jso</em>, </td>
202         </tr>
203         <tr>
204           <td class="paramkey"></td>
205           <td></td>
206           <td class="paramtype">int&#160;</td>
207           <td class="paramname"><em>future_flags</em>, </td>
208         </tr>
209         <tr>
210           <td class="paramkey"></td>
211           <td></td>
212           <td class="paramtype"><a class="el" href="json__visit_8h.html#a0fadec4abb2befcacfaff7df822f3f8d">json_c_visit_userfunc</a> *&#160;</td>
213           <td class="paramname"><em>userfunc</em>, </td>
214         </tr>
215         <tr>
216           <td class="paramkey"></td>
217           <td></td>
218           <td class="paramtype">void *&#160;</td>
219           <td class="paramname"><em>userarg</em>&#160;</td>
220         </tr>
221         <tr>
222           <td></td>
223           <td>)</td>
224           <td></td><td></td>
225         </tr>
226       </table>
227 </div><div class="memdoc">
228 <p>Visit each object in the JSON hierarchy starting at jso. For each object, userfunc is called, passing the object and userarg. If the object has a parent (i.e. anything other than jso itself) its parent will be passed as parent_jso, and either jso_key or jso_index will be set, depending on whether the parent is an object or an array.</p>
229 <p>Nodes will be visited depth first, but containers (arrays and objects) will be visited twice, the second time with JSON_C_VISIT_SECOND set in flags.</p>
230 <p>userfunc must return one of the defined return values, to indicate whether and how to continue visiting nodes, or one of various ways to stop.</p>
231 <p>Returns 0 if nodes were visited successfully, even if some were intentionally skipped due to what userfunc returned. Returns &lt;0 if an error occurred during iteration, including if userfunc returned JSON_C_VISIT_RETURN_ERROR. </p>
232 
233 </div>
234 </div>
235 </div><!-- contents -->
236 <!-- start footer part -->
237 <hr class="footer"/><address class="footer"><small>
238 Generated on Sun Jul 26 2020 15:11:19 for json-c by &#160;<a href="http://www.doxygen.org/index.html">
239 <img class="footer" src="doxygen.png" alt="doxygen"/>
240 </a> 1.8.2
241 </small></address>
242 </body>
243 </html>

This page was automatically generated by LXR 0.3.1.  •  OpenWrt