You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

json__patch_8h.html 7.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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: json_patch.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.17</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><!-- top -->
  44. <div class="header">
  45. <div class="summary">
  46. <a href="#nested-classes">Data Structures</a> &#124;
  47. <a href="#func-members">Functions</a> </div>
  48. <div class="headertitle">
  49. <div class="title">json_patch.h File Reference</div> </div>
  50. </div><!--header-->
  51. <div class="contents">
  52. <p>JSON Patch (RFC 6902) implementation for manipulating JSON objects.
  53. <a href="#details">More...</a></p>
  54. <table class="memberdecls">
  55. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
  56. Data Structures</h2></td></tr>
  57. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structjson__patch__error.html">json_patch_error</a></td></tr>
  58. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  59. </table><table class="memberdecls">
  60. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  61. Functions</h2></td></tr>
  62. <tr class="memitem:a134aaed1e732d029d34ce2d605f9ac8d"><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__patch_8h.html#a134aaed1e732d029d34ce2d605f9ac8d">json_patch_apply</a> (struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *copy_from, struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *patch, struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> **base, struct <a class="el" href="structjson__patch__error.html">json_patch_error</a> *patch_error)</td></tr>
  63. <tr class="separator:a134aaed1e732d029d34ce2d605f9ac8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  64. </table>
  65. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  66. <div class="textblock"><p>JSON Patch (RFC 6902) implementation for manipulating JSON objects. </p>
  67. </div><h2 class="groupheader">Function Documentation</h2>
  68. <a class="anchor" id="a134aaed1e732d029d34ce2d605f9ac8d"></a>
  69. <div class="memitem">
  70. <div class="memproto">
  71. <table class="memname">
  72. <tr>
  73. <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> int json_patch_apply </td>
  74. <td>(</td>
  75. <td class="paramtype">struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *&#160;</td>
  76. <td class="paramname"><em>copy_from</em>, </td>
  77. </tr>
  78. <tr>
  79. <td class="paramkey"></td>
  80. <td></td>
  81. <td class="paramtype">struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> *&#160;</td>
  82. <td class="paramname"><em>patch</em>, </td>
  83. </tr>
  84. <tr>
  85. <td class="paramkey"></td>
  86. <td></td>
  87. <td class="paramtype">struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> **&#160;</td>
  88. <td class="paramname"><em>base</em>, </td>
  89. </tr>
  90. <tr>
  91. <td class="paramkey"></td>
  92. <td></td>
  93. <td class="paramtype">struct <a class="el" href="structjson__patch__error.html">json_patch_error</a> *&#160;</td>
  94. <td class="paramname"><em>patch_error</em>&#160;</td>
  95. </tr>
  96. <tr>
  97. <td></td>
  98. <td>)</td>
  99. <td></td><td></td>
  100. </tr>
  101. </table>
  102. </div><div class="memdoc">
  103. <p>Apply the JSON patch to the base object. The patch object must be formatted as per RFC 6902, i.e. a json_type_array containing patch operations. If the patch is not correctly formatted, an error will be returned.</p>
  104. <p>The json_object at *base will be modified in place. Exactly one of *base or copy_from must be non-NULL. If *base is NULL, a new copy of copy_from will allocated and populated using <a class="el" href="json__object_8h.html#aaac16505f13bc56accfad82604d8bcdc">json_object_deep_copy()</a>. In this case <a class="el" href="json__object_8h.html#afabf61f932cd64a4122ca8092452eed5">json_object_put()</a> <em>must</em> be used to free *base even if the overall patching operation fails.</p>
  105. <p>If anything fails during patching a negative value will be returned, and patch_error (if non-NULL) will be populated with error details.</p>
  106. <dl class="params"><dt>Parameters</dt><dd>
  107. <table class="params">
  108. <tr><td class="paramname">base</td><td>a pointer to the JSON object which to patch </td></tr>
  109. <tr><td class="paramname">patch</td><td>the JSON object that describes the patch to be applied </td></tr>
  110. <tr><td class="paramname">copy_from</td><td>a JSON object to copy to *base </td></tr>
  111. <tr><td class="paramname">patch_error</td><td>optional, details about errors</td></tr>
  112. </table>
  113. </dd>
  114. </dl>
  115. <dl class="section return"><dt>Returns</dt><dd>negative if an error (or not found), or 0 if patch completely applied </dd></dl>
  116. </div>
  117. </div>
  118. </div><!-- contents -->
  119. <!-- start footer part -->
  120. <hr class="footer"/><address class="footer"><small>
  121. Generated on Sat Aug 12 2023 18:59:55 for json-c by &#160;<a href="http://www.doxygen.org/index.html">
  122. <img class="footer" src="doxygen.png" alt="doxygen"/>
  123. </a> 1.8.2
  124. </small></address>
  125. </body>
  126. </html>

No Description