1*5dd36a3bSchristos<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2*5dd36a3bSchristos<html xmlns="http://www.w3.org/1999/xhtml"> 3*5dd36a3bSchristos<head> 4*5dd36a3bSchristos<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5*5dd36a3bSchristos<meta http-equiv="X-UA-Compatible" content="IE=9"/> 6*5dd36a3bSchristos<meta name="generator" content="Doxygen 1.8.12"/> 7*5dd36a3bSchristos<meta name="viewport" content="width=device-width, initial-scale=1"/> 8*5dd36a3bSchristos<title>libcbor: src/cbor/strings.c File Reference</title> 9*5dd36a3bSchristos<link href="tabs.css" rel="stylesheet" type="text/css"/> 10*5dd36a3bSchristos<script type="text/javascript" src="jquery.js"></script> 11*5dd36a3bSchristos<script type="text/javascript" src="dynsections.js"></script> 12*5dd36a3bSchristos<link href="search/search.css" rel="stylesheet" type="text/css"/> 13*5dd36a3bSchristos<script type="text/javascript" src="search/searchdata.js"></script> 14*5dd36a3bSchristos<script type="text/javascript" src="search/search.js"></script> 15*5dd36a3bSchristos<link href="doxygen.css" rel="stylesheet" type="text/css" /> 16*5dd36a3bSchristos<link href="customdoxygen.css" rel="stylesheet" type="text/css"/> 17*5dd36a3bSchristos</head> 18*5dd36a3bSchristos<body> 19*5dd36a3bSchristos<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 20*5dd36a3bSchristos<div id="titlearea"> 21*5dd36a3bSchristos<table cellspacing="0" cellpadding="0"> 22*5dd36a3bSchristos <tbody> 23*5dd36a3bSchristos <tr style="height: 56px;"> 24*5dd36a3bSchristos <td id="projectalign" style="padding-left: 0.5em;"> 25*5dd36a3bSchristos <div id="projectname">libcbor 26*5dd36a3bSchristos  <span id="projectnumber">0.5.0</span> 27*5dd36a3bSchristos </div> 28*5dd36a3bSchristos <div id="projectbrief">libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.</div> 29*5dd36a3bSchristos </td> 30*5dd36a3bSchristos </tr> 31*5dd36a3bSchristos </tbody> 32*5dd36a3bSchristos</table> 33*5dd36a3bSchristos</div> 34*5dd36a3bSchristos<!-- end header part --> 35*5dd36a3bSchristos<!-- Generated by Doxygen 1.8.12 --> 36*5dd36a3bSchristos<script type="text/javascript"> 37*5dd36a3bSchristosvar searchBox = new SearchBox("searchBox", "search",false,'Search'); 38*5dd36a3bSchristos</script> 39*5dd36a3bSchristos<script type="text/javascript" src="menudata.js"></script> 40*5dd36a3bSchristos<script type="text/javascript" src="menu.js"></script> 41*5dd36a3bSchristos<script type="text/javascript"> 42*5dd36a3bSchristos$(function() { 43*5dd36a3bSchristos initMenu('',true,false,'search.php','Search'); 44*5dd36a3bSchristos $(document).ready(function() { init_search(); }); 45*5dd36a3bSchristos}); 46*5dd36a3bSchristos</script> 47*5dd36a3bSchristos<div id="main-nav"></div> 48*5dd36a3bSchristos<!-- window showing the filter options --> 49*5dd36a3bSchristos<div id="MSearchSelectWindow" 50*5dd36a3bSchristos onmouseover="return searchBox.OnSearchSelectShow()" 51*5dd36a3bSchristos onmouseout="return searchBox.OnSearchSelectHide()" 52*5dd36a3bSchristos onkeydown="return searchBox.OnSearchSelectKey(event)"> 53*5dd36a3bSchristos</div> 54*5dd36a3bSchristos 55*5dd36a3bSchristos<!-- iframe showing the search results (closed by default) --> 56*5dd36a3bSchristos<div id="MSearchResultsWindow"> 57*5dd36a3bSchristos<iframe src="javascript:void(0)" frameborder="0" 58*5dd36a3bSchristos name="MSearchResults" id="MSearchResults"> 59*5dd36a3bSchristos</iframe> 60*5dd36a3bSchristos</div> 61*5dd36a3bSchristos 62*5dd36a3bSchristos<div id="nav-path" class="navpath"> 63*5dd36a3bSchristos <ul> 64*5dd36a3bSchristos<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_cb565ba51d82ea933604984cbab6233d.html">cbor</a></li> </ul> 65*5dd36a3bSchristos</div> 66*5dd36a3bSchristos</div><!-- top --> 67*5dd36a3bSchristos<div class="header"> 68*5dd36a3bSchristos <div class="summary"> 69*5dd36a3bSchristos<a href="#func-members">Functions</a> </div> 70*5dd36a3bSchristos <div class="headertitle"> 71*5dd36a3bSchristos<div class="title">strings.c File Reference</div> </div> 72*5dd36a3bSchristos</div><!--header--> 73*5dd36a3bSchristos<div class="contents"> 74*5dd36a3bSchristos<div class="textblock"><code>#include <string.h></code><br /> 75*5dd36a3bSchristos<code>#include "<a class="el" href="strings_8h_source.html">strings.h</a>"</code><br /> 76*5dd36a3bSchristos<code>#include "<a class="el" href="memory__utils_8h_source.html">internal/memory_utils.h</a>"</code><br /> 77*5dd36a3bSchristos</div> 78*5dd36a3bSchristos<p><a href="strings_8c_source.html">Go to the source code of this file.</a></p> 79*5dd36a3bSchristos<table class="memberdecls"> 80*5dd36a3bSchristos<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 81*5dd36a3bSchristosFunctions</h2></td></tr> 82*5dd36a3bSchristos<tr class="memitem:a6e2516983e412b9d22fd1fccbeded632"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a6e2516983e412b9d22fd1fccbeded632">cbor_new_definite_string</a> ()</td></tr> 83*5dd36a3bSchristos<tr class="memdesc:a6e2516983e412b9d22fd1fccbeded632"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new definite string. <a href="#a6e2516983e412b9d22fd1fccbeded632">More...</a><br /></td></tr> 84*5dd36a3bSchristos<tr class="separator:a6e2516983e412b9d22fd1fccbeded632"><td class="memSeparator" colspan="2"> </td></tr> 85*5dd36a3bSchristos<tr class="memitem:a226f91c7bfd6be9b0a52cdc6f0b17741"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a226f91c7bfd6be9b0a52cdc6f0b17741">cbor_new_indefinite_string</a> ()</td></tr> 86*5dd36a3bSchristos<tr class="memdesc:a226f91c7bfd6be9b0a52cdc6f0b17741"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new indefinite string. <a href="#a226f91c7bfd6be9b0a52cdc6f0b17741">More...</a><br /></td></tr> 87*5dd36a3bSchristos<tr class="separator:a226f91c7bfd6be9b0a52cdc6f0b17741"><td class="memSeparator" colspan="2"> </td></tr> 88*5dd36a3bSchristos<tr class="memitem:a61a9388aca4fc7ee5355eb92a6d56536"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a61a9388aca4fc7ee5355eb92a6d56536">cbor_build_string</a> (const char *val)</td></tr> 89*5dd36a3bSchristos<tr class="memdesc:a61a9388aca4fc7ee5355eb92a6d56536"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new string and initializes it. <a href="#a61a9388aca4fc7ee5355eb92a6d56536">More...</a><br /></td></tr> 90*5dd36a3bSchristos<tr class="separator:a61a9388aca4fc7ee5355eb92a6d56536"><td class="memSeparator" colspan="2"> </td></tr> 91*5dd36a3bSchristos<tr class="memitem:a26f8c53bb33641408921c388bf539b0c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a26f8c53bb33641408921c388bf539b0c">cbor_build_stringn</a> (const char *val, size_t length)</td></tr> 92*5dd36a3bSchristos<tr class="memdesc:a26f8c53bb33641408921c388bf539b0c"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new string and initializes it. <a href="#a26f8c53bb33641408921c388bf539b0c">More...</a><br /></td></tr> 93*5dd36a3bSchristos<tr class="separator:a26f8c53bb33641408921c388bf539b0c"><td class="memSeparator" colspan="2"> </td></tr> 94*5dd36a3bSchristos<tr class="memitem:a5e9292c04df380f2c775fe599511a7ab"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a5e9292c04df380f2c775fe599511a7ab">cbor_string_set_handle</a> (<a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item, <a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> <a class="el" href="common_8h.html#a9ac79315ed2dcf2c9587e8e3a9a6bc97">CBOR_RESTRICT_POINTER</a> data, size_t length)</td></tr> 95*5dd36a3bSchristos<tr class="memdesc:a5e9292c04df380f2c775fe599511a7ab"><td class="mdescLeft"> </td><td class="mdescRight">Set the handle to the underlying string. <a href="#a5e9292c04df380f2c775fe599511a7ab">More...</a><br /></td></tr> 96*5dd36a3bSchristos<tr class="separator:a5e9292c04df380f2c775fe599511a7ab"><td class="memSeparator" colspan="2"> </td></tr> 97*5dd36a3bSchristos<tr class="memitem:a81d1160eed81b2a29b6c5e9ff6b9e02a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> ** </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a81d1160eed81b2a29b6c5e9ff6b9e02a">cbor_string_chunks_handle</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 98*5dd36a3bSchristos<tr class="memdesc:a81d1160eed81b2a29b6c5e9ff6b9e02a"><td class="mdescLeft"> </td><td class="mdescRight">Get the handle to the array of chunks. <a href="#a81d1160eed81b2a29b6c5e9ff6b9e02a">More...</a><br /></td></tr> 99*5dd36a3bSchristos<tr class="separator:a81d1160eed81b2a29b6c5e9ff6b9e02a"><td class="memSeparator" colspan="2"> </td></tr> 100*5dd36a3bSchristos<tr class="memitem:ad8062db21711a51ae520cc1e4f5fe5ab"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#ad8062db21711a51ae520cc1e4f5fe5ab">cbor_string_chunk_count</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 101*5dd36a3bSchristos<tr class="memdesc:ad8062db21711a51ae520cc1e4f5fe5ab"><td class="mdescLeft"> </td><td class="mdescRight">Get the number of chunks this string consist of. <a href="#ad8062db21711a51ae520cc1e4f5fe5ab">More...</a><br /></td></tr> 102*5dd36a3bSchristos<tr class="separator:ad8062db21711a51ae520cc1e4f5fe5ab"><td class="memSeparator" colspan="2"> </td></tr> 103*5dd36a3bSchristos<tr class="memitem:a634462c7237298a196413cd62d7d1877"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a634462c7237298a196413cd62d7d1877">cbor_string_add_chunk</a> (<a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item, <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *chunk)</td></tr> 104*5dd36a3bSchristos<tr class="memdesc:a634462c7237298a196413cd62d7d1877"><td class="mdescLeft"> </td><td class="mdescRight">Appends a chunk to the string. <a href="#a634462c7237298a196413cd62d7d1877">More...</a><br /></td></tr> 105*5dd36a3bSchristos<tr class="separator:a634462c7237298a196413cd62d7d1877"><td class="memSeparator" colspan="2"> </td></tr> 106*5dd36a3bSchristos<tr class="memitem:aa0c17825f920ebf122bd7b9abede919f"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#aa0c17825f920ebf122bd7b9abede919f">cbor_string_length</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 107*5dd36a3bSchristos<tr class="memdesc:aa0c17825f920ebf122bd7b9abede919f"><td class="mdescLeft"> </td><td class="mdescRight">Returns the length of the underlying string. <a href="#aa0c17825f920ebf122bd7b9abede919f">More...</a><br /></td></tr> 108*5dd36a3bSchristos<tr class="separator:aa0c17825f920ebf122bd7b9abede919f"><td class="memSeparator" colspan="2"> </td></tr> 109*5dd36a3bSchristos<tr class="memitem:ae9e5da7bdf2a79fab7965caeff49d5bb"><td class="memItemLeft" align="right" valign="top">unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#ae9e5da7bdf2a79fab7965caeff49d5bb">cbor_string_handle</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 110*5dd36a3bSchristos<tr class="memdesc:ae9e5da7bdf2a79fab7965caeff49d5bb"><td class="mdescLeft"> </td><td class="mdescRight">Get the handle to the underlying string. <a href="#ae9e5da7bdf2a79fab7965caeff49d5bb">More...</a><br /></td></tr> 111*5dd36a3bSchristos<tr class="separator:ae9e5da7bdf2a79fab7965caeff49d5bb"><td class="memSeparator" colspan="2"> </td></tr> 112*5dd36a3bSchristos<tr class="memitem:a90c1cf7781f7ef1f3549f497abd259ef"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#a90c1cf7781f7ef1f3549f497abd259ef">cbor_string_codepoint_count</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 113*5dd36a3bSchristos<tr class="memdesc:a90c1cf7781f7ef1f3549f497abd259ef"><td class="mdescLeft"> </td><td class="mdescRight">The number of codepoints in this string. <a href="#a90c1cf7781f7ef1f3549f497abd259ef">More...</a><br /></td></tr> 114*5dd36a3bSchristos<tr class="separator:a90c1cf7781f7ef1f3549f497abd259ef"><td class="memSeparator" colspan="2"> </td></tr> 115*5dd36a3bSchristos<tr class="memitem:aa2778891e70dec4cd59c9a969294d4aa"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#aa2778891e70dec4cd59c9a969294d4aa">cbor_string_is_definite</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 116*5dd36a3bSchristos<tr class="memdesc:aa2778891e70dec4cd59c9a969294d4aa"><td class="mdescLeft"> </td><td class="mdescRight">Is the string definite? <a href="#aa2778891e70dec4cd59c9a969294d4aa">More...</a><br /></td></tr> 117*5dd36a3bSchristos<tr class="separator:aa2778891e70dec4cd59c9a969294d4aa"><td class="memSeparator" colspan="2"> </td></tr> 118*5dd36a3bSchristos<tr class="memitem:aa1a92438a04ae77beea9a17910805530"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8c.html#aa1a92438a04ae77beea9a17910805530">cbor_string_is_indefinite</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 119*5dd36a3bSchristos<tr class="memdesc:aa1a92438a04ae77beea9a17910805530"><td class="mdescLeft"> </td><td class="mdescRight">Is the string indefinite? <a href="#aa1a92438a04ae77beea9a17910805530">More...</a><br /></td></tr> 120*5dd36a3bSchristos<tr class="separator:aa1a92438a04ae77beea9a17910805530"><td class="memSeparator" colspan="2"> </td></tr> 121*5dd36a3bSchristos</table> 122*5dd36a3bSchristos<h2 class="groupheader">Function Documentation</h2> 123*5dd36a3bSchristos<a id="a61a9388aca4fc7ee5355eb92a6d56536"></a> 124*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a61a9388aca4fc7ee5355eb92a6d56536">§ </a></span>cbor_build_string()</h2> 125*5dd36a3bSchristos 126*5dd36a3bSchristos<div class="memitem"> 127*5dd36a3bSchristos<div class="memproto"> 128*5dd36a3bSchristos <table class="memname"> 129*5dd36a3bSchristos <tr> 130*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_string </td> 131*5dd36a3bSchristos <td>(</td> 132*5dd36a3bSchristos <td class="paramtype">const char * </td> 133*5dd36a3bSchristos <td class="paramname"><em>val</em></td><td>)</td> 134*5dd36a3bSchristos <td></td> 135*5dd36a3bSchristos </tr> 136*5dd36a3bSchristos </table> 137*5dd36a3bSchristos</div><div class="memdoc"> 138*5dd36a3bSchristos 139*5dd36a3bSchristos<p>Creates a new string and initializes it. </p> 140*5dd36a3bSchristos<p>The <code>val</code> will be copied to a newly allocated block</p> 141*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 142*5dd36a3bSchristos <table class="params"> 143*5dd36a3bSchristos <tr><td class="paramname">val</td><td>A null-terminated UTF-8 string </td></tr> 144*5dd36a3bSchristos </table> 145*5dd36a3bSchristos </dd> 146*5dd36a3bSchristos</dl> 147*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>A <b>new</b> string with content <code>handle</code>. <code>NULL</code> on malloc failure. </dd></dl> 148*5dd36a3bSchristos 149*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00040">40</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 150*5dd36a3bSchristos 151*5dd36a3bSchristos</div> 152*5dd36a3bSchristos</div> 153*5dd36a3bSchristos<a id="a26f8c53bb33641408921c388bf539b0c"></a> 154*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a26f8c53bb33641408921c388bf539b0c">§ </a></span>cbor_build_stringn()</h2> 155*5dd36a3bSchristos 156*5dd36a3bSchristos<div class="memitem"> 157*5dd36a3bSchristos<div class="memproto"> 158*5dd36a3bSchristos <table class="memname"> 159*5dd36a3bSchristos <tr> 160*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_stringn </td> 161*5dd36a3bSchristos <td>(</td> 162*5dd36a3bSchristos <td class="paramtype">const char * </td> 163*5dd36a3bSchristos <td class="paramname"><em>val</em>, </td> 164*5dd36a3bSchristos </tr> 165*5dd36a3bSchristos <tr> 166*5dd36a3bSchristos <td class="paramkey"></td> 167*5dd36a3bSchristos <td></td> 168*5dd36a3bSchristos <td class="paramtype">size_t </td> 169*5dd36a3bSchristos <td class="paramname"><em>length</em> </td> 170*5dd36a3bSchristos </tr> 171*5dd36a3bSchristos <tr> 172*5dd36a3bSchristos <td></td> 173*5dd36a3bSchristos <td>)</td> 174*5dd36a3bSchristos <td></td><td></td> 175*5dd36a3bSchristos </tr> 176*5dd36a3bSchristos </table> 177*5dd36a3bSchristos</div><div class="memdoc"> 178*5dd36a3bSchristos 179*5dd36a3bSchristos<p>Creates a new string and initializes it. </p> 180*5dd36a3bSchristos<p>The <code>handle</code> will be copied to a newly allocated block</p> 181*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 182*5dd36a3bSchristos <table class="params"> 183*5dd36a3bSchristos <tr><td class="paramname">val</td><td>A UTF-8 string, at least <code>length</code> long (excluding the null byte) </td></tr> 184*5dd36a3bSchristos </table> 185*5dd36a3bSchristos </dd> 186*5dd36a3bSchristos</dl> 187*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>A <b>new</b> string with content <code>handle</code>. <code>NULL</code> on malloc failure. </dd></dl> 188*5dd36a3bSchristos 189*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00050">50</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 190*5dd36a3bSchristos 191*5dd36a3bSchristos</div> 192*5dd36a3bSchristos</div> 193*5dd36a3bSchristos<a id="a6e2516983e412b9d22fd1fccbeded632"></a> 194*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a6e2516983e412b9d22fd1fccbeded632">§ </a></span>cbor_new_definite_string()</h2> 195*5dd36a3bSchristos 196*5dd36a3bSchristos<div class="memitem"> 197*5dd36a3bSchristos<div class="memproto"> 198*5dd36a3bSchristos <table class="memname"> 199*5dd36a3bSchristos <tr> 200*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_definite_string </td> 201*5dd36a3bSchristos <td>(</td> 202*5dd36a3bSchristos <td class="paramname"></td><td>)</td> 203*5dd36a3bSchristos <td></td> 204*5dd36a3bSchristos </tr> 205*5dd36a3bSchristos </table> 206*5dd36a3bSchristos</div><div class="memdoc"> 207*5dd36a3bSchristos 208*5dd36a3bSchristos<p>Creates a new definite string. </p> 209*5dd36a3bSchristos<p>The handle is initialized to <code>NULL</code> and length to 0</p> 210*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd><b>new</b> definite string. <code>NULL</code> on malloc failure. </dd></dl> 211*5dd36a3bSchristos 212*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00012">12</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 213*5dd36a3bSchristos 214*5dd36a3bSchristos</div> 215*5dd36a3bSchristos</div> 216*5dd36a3bSchristos<a id="a226f91c7bfd6be9b0a52cdc6f0b17741"></a> 217*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a226f91c7bfd6be9b0a52cdc6f0b17741">§ </a></span>cbor_new_indefinite_string()</h2> 218*5dd36a3bSchristos 219*5dd36a3bSchristos<div class="memitem"> 220*5dd36a3bSchristos<div class="memproto"> 221*5dd36a3bSchristos <table class="memname"> 222*5dd36a3bSchristos <tr> 223*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_indefinite_string </td> 224*5dd36a3bSchristos <td>(</td> 225*5dd36a3bSchristos <td class="paramname"></td><td>)</td> 226*5dd36a3bSchristos <td></td> 227*5dd36a3bSchristos </tr> 228*5dd36a3bSchristos </table> 229*5dd36a3bSchristos</div><div class="memdoc"> 230*5dd36a3bSchristos 231*5dd36a3bSchristos<p>Creates a new indefinite string. </p> 232*5dd36a3bSchristos<p>The chunks array is initialized to <code>NULL</code> and chunkcount to 0</p> 233*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd><b>new</b> indefinite string. <code>NULL</code> on malloc failure. </dd></dl> 234*5dd36a3bSchristos 235*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00023">23</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 236*5dd36a3bSchristos 237*5dd36a3bSchristos</div> 238*5dd36a3bSchristos</div> 239*5dd36a3bSchristos<a id="a634462c7237298a196413cd62d7d1877"></a> 240*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a634462c7237298a196413cd62d7d1877">§ </a></span>cbor_string_add_chunk()</h2> 241*5dd36a3bSchristos 242*5dd36a3bSchristos<div class="memitem"> 243*5dd36a3bSchristos<div class="memproto"> 244*5dd36a3bSchristos <table class="memname"> 245*5dd36a3bSchristos <tr> 246*5dd36a3bSchristos <td class="memname">bool cbor_string_add_chunk </td> 247*5dd36a3bSchristos <td>(</td> 248*5dd36a3bSchristos <td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 249*5dd36a3bSchristos <td class="paramname"><em>item</em>, </td> 250*5dd36a3bSchristos </tr> 251*5dd36a3bSchristos <tr> 252*5dd36a3bSchristos <td class="paramkey"></td> 253*5dd36a3bSchristos <td></td> 254*5dd36a3bSchristos <td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 255*5dd36a3bSchristos <td class="paramname"><em>chunk</em> </td> 256*5dd36a3bSchristos </tr> 257*5dd36a3bSchristos <tr> 258*5dd36a3bSchristos <td></td> 259*5dd36a3bSchristos <td>)</td> 260*5dd36a3bSchristos <td></td><td></td> 261*5dd36a3bSchristos </tr> 262*5dd36a3bSchristos </table> 263*5dd36a3bSchristos</div><div class="memdoc"> 264*5dd36a3bSchristos 265*5dd36a3bSchristos<p>Appends a chunk to the string. </p> 266*5dd36a3bSchristos<p>Indefinite strings only.</p> 267*5dd36a3bSchristos<p>May realloc the chunk storage.</p> 268*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 269*5dd36a3bSchristos <table class="params"> 270*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>An indefinite string </td></tr> 271*5dd36a3bSchristos <tr><td class="paramname">item[incref]</td><td>A definite string </td></tr> 272*5dd36a3bSchristos </table> 273*5dd36a3bSchristos </dd> 274*5dd36a3bSchristos</dl> 275*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>true on success. false on realloc failure. In that case, the refcount of <code>chunk</code> is not increased and the <code>item</code> is left intact. </dd></dl> 276*5dd36a3bSchristos 277*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00082">82</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 278*5dd36a3bSchristos 279*5dd36a3bSchristos</div> 280*5dd36a3bSchristos</div> 281*5dd36a3bSchristos<a id="ad8062db21711a51ae520cc1e4f5fe5ab"></a> 282*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#ad8062db21711a51ae520cc1e4f5fe5ab">§ </a></span>cbor_string_chunk_count()</h2> 283*5dd36a3bSchristos 284*5dd36a3bSchristos<div class="memitem"> 285*5dd36a3bSchristos<div class="memproto"> 286*5dd36a3bSchristos <table class="memname"> 287*5dd36a3bSchristos <tr> 288*5dd36a3bSchristos <td class="memname">size_t cbor_string_chunk_count </td> 289*5dd36a3bSchristos <td>(</td> 290*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 291*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 292*5dd36a3bSchristos <td></td> 293*5dd36a3bSchristos </tr> 294*5dd36a3bSchristos </table> 295*5dd36a3bSchristos</div><div class="memdoc"> 296*5dd36a3bSchristos 297*5dd36a3bSchristos<p>Get the number of chunks this string consist of. </p> 298*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 299*5dd36a3bSchristos <table class="params"> 300*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A indefinite string </td></tr> 301*5dd36a3bSchristos </table> 302*5dd36a3bSchristos </dd> 303*5dd36a3bSchristos</dl> 304*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>The chunk count. 0 for freshly created items. </dd></dl> 305*5dd36a3bSchristos 306*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00074">74</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 307*5dd36a3bSchristos 308*5dd36a3bSchristos</div> 309*5dd36a3bSchristos</div> 310*5dd36a3bSchristos<a id="a81d1160eed81b2a29b6c5e9ff6b9e02a"></a> 311*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a81d1160eed81b2a29b6c5e9ff6b9e02a">§ </a></span>cbor_string_chunks_handle()</h2> 312*5dd36a3bSchristos 313*5dd36a3bSchristos<div class="memitem"> 314*5dd36a3bSchristos<div class="memproto"> 315*5dd36a3bSchristos <table class="memname"> 316*5dd36a3bSchristos <tr> 317*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>** cbor_string_chunks_handle </td> 318*5dd36a3bSchristos <td>(</td> 319*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 320*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 321*5dd36a3bSchristos <td></td> 322*5dd36a3bSchristos </tr> 323*5dd36a3bSchristos </table> 324*5dd36a3bSchristos</div><div class="memdoc"> 325*5dd36a3bSchristos 326*5dd36a3bSchristos<p>Get the handle to the array of chunks. </p> 327*5dd36a3bSchristos<p>Manipulations with the memory block (e.g. sorting it) are allowed, but the validity and the number of chunks must be retained.</p> 328*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 329*5dd36a3bSchristos <table class="params"> 330*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A indefinite string </td></tr> 331*5dd36a3bSchristos </table> 332*5dd36a3bSchristos </dd> 333*5dd36a3bSchristos</dl> 334*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>array of <a class="el" href="strings_8h.html#ad8062db21711a51ae520cc1e4f5fe5ab" title="Get the number of chunks this string consist of. ">cbor_string_chunk_count</a> definite strings </dd></dl> 335*5dd36a3bSchristos 336*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00067">67</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 337*5dd36a3bSchristos 338*5dd36a3bSchristos</div> 339*5dd36a3bSchristos</div> 340*5dd36a3bSchristos<a id="a90c1cf7781f7ef1f3549f497abd259ef"></a> 341*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a90c1cf7781f7ef1f3549f497abd259ef">§ </a></span>cbor_string_codepoint_count()</h2> 342*5dd36a3bSchristos 343*5dd36a3bSchristos<div class="memitem"> 344*5dd36a3bSchristos<div class="memproto"> 345*5dd36a3bSchristos <table class="memname"> 346*5dd36a3bSchristos <tr> 347*5dd36a3bSchristos <td class="memname">size_t cbor_string_codepoint_count </td> 348*5dd36a3bSchristos <td>(</td> 349*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 350*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 351*5dd36a3bSchristos <td></td> 352*5dd36a3bSchristos </tr> 353*5dd36a3bSchristos </table> 354*5dd36a3bSchristos</div><div class="memdoc"> 355*5dd36a3bSchristos 356*5dd36a3bSchristos<p>The number of codepoints in this string. </p> 357*5dd36a3bSchristos<p>Might differ from length if there are multibyte ones</p> 358*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 359*5dd36a3bSchristos <table class="params"> 360*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A string </td></tr> 361*5dd36a3bSchristos </table> 362*5dd36a3bSchristos </dd> 363*5dd36a3bSchristos</dl> 364*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>The number of codepoints in this string </dd></dl> 365*5dd36a3bSchristos 366*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00118">118</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 367*5dd36a3bSchristos 368*5dd36a3bSchristos</div> 369*5dd36a3bSchristos</div> 370*5dd36a3bSchristos<a id="ae9e5da7bdf2a79fab7965caeff49d5bb"></a> 371*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#ae9e5da7bdf2a79fab7965caeff49d5bb">§ </a></span>cbor_string_handle()</h2> 372*5dd36a3bSchristos 373*5dd36a3bSchristos<div class="memitem"> 374*5dd36a3bSchristos<div class="memproto"> 375*5dd36a3bSchristos <table class="memname"> 376*5dd36a3bSchristos <tr> 377*5dd36a3bSchristos <td class="memname">unsigned char* cbor_string_handle </td> 378*5dd36a3bSchristos <td>(</td> 379*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 380*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 381*5dd36a3bSchristos <td></td> 382*5dd36a3bSchristos </tr> 383*5dd36a3bSchristos </table> 384*5dd36a3bSchristos</div><div class="memdoc"> 385*5dd36a3bSchristos 386*5dd36a3bSchristos<p>Get the handle to the underlying string. </p> 387*5dd36a3bSchristos<p>Definite items only. Modifying the data is allowed. In that case, the caller takes responsibility for the effect on items this item might be a part of</p> 388*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 389*5dd36a3bSchristos <table class="params"> 390*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A definite string </td></tr> 391*5dd36a3bSchristos </table> 392*5dd36a3bSchristos </dd> 393*5dd36a3bSchristos</dl> 394*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>The address of the underlying string. <code>NULL</code> if no data have been assigned yet. </dd></dl> 395*5dd36a3bSchristos 396*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00112">112</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 397*5dd36a3bSchristos 398*5dd36a3bSchristos</div> 399*5dd36a3bSchristos</div> 400*5dd36a3bSchristos<a id="aa2778891e70dec4cd59c9a969294d4aa"></a> 401*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#aa2778891e70dec4cd59c9a969294d4aa">§ </a></span>cbor_string_is_definite()</h2> 402*5dd36a3bSchristos 403*5dd36a3bSchristos<div class="memitem"> 404*5dd36a3bSchristos<div class="memproto"> 405*5dd36a3bSchristos <table class="memname"> 406*5dd36a3bSchristos <tr> 407*5dd36a3bSchristos <td class="memname">bool cbor_string_is_definite </td> 408*5dd36a3bSchristos <td>(</td> 409*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 410*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 411*5dd36a3bSchristos <td></td> 412*5dd36a3bSchristos </tr> 413*5dd36a3bSchristos </table> 414*5dd36a3bSchristos</div><div class="memdoc"> 415*5dd36a3bSchristos 416*5dd36a3bSchristos<p>Is the string definite? </p> 417*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 418*5dd36a3bSchristos <table class="params"> 419*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>a string </td></tr> 420*5dd36a3bSchristos </table> 421*5dd36a3bSchristos </dd> 422*5dd36a3bSchristos</dl> 423*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>Is the string definite? </dd></dl> 424*5dd36a3bSchristos 425*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00124">124</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 426*5dd36a3bSchristos 427*5dd36a3bSchristos</div> 428*5dd36a3bSchristos</div> 429*5dd36a3bSchristos<a id="aa1a92438a04ae77beea9a17910805530"></a> 430*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#aa1a92438a04ae77beea9a17910805530">§ </a></span>cbor_string_is_indefinite()</h2> 431*5dd36a3bSchristos 432*5dd36a3bSchristos<div class="memitem"> 433*5dd36a3bSchristos<div class="memproto"> 434*5dd36a3bSchristos <table class="memname"> 435*5dd36a3bSchristos <tr> 436*5dd36a3bSchristos <td class="memname">bool cbor_string_is_indefinite </td> 437*5dd36a3bSchristos <td>(</td> 438*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 439*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 440*5dd36a3bSchristos <td></td> 441*5dd36a3bSchristos </tr> 442*5dd36a3bSchristos </table> 443*5dd36a3bSchristos</div><div class="memdoc"> 444*5dd36a3bSchristos 445*5dd36a3bSchristos<p>Is the string indefinite? </p> 446*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 447*5dd36a3bSchristos <table class="params"> 448*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>a string </td></tr> 449*5dd36a3bSchristos </table> 450*5dd36a3bSchristos </dd> 451*5dd36a3bSchristos</dl> 452*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>Is the string indefinite? </dd></dl> 453*5dd36a3bSchristos 454*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00130">130</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 455*5dd36a3bSchristos 456*5dd36a3bSchristos</div> 457*5dd36a3bSchristos</div> 458*5dd36a3bSchristos<a id="aa0c17825f920ebf122bd7b9abede919f"></a> 459*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#aa0c17825f920ebf122bd7b9abede919f">§ </a></span>cbor_string_length()</h2> 460*5dd36a3bSchristos 461*5dd36a3bSchristos<div class="memitem"> 462*5dd36a3bSchristos<div class="memproto"> 463*5dd36a3bSchristos <table class="memname"> 464*5dd36a3bSchristos <tr> 465*5dd36a3bSchristos <td class="memname">size_t cbor_string_length </td> 466*5dd36a3bSchristos <td>(</td> 467*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 468*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 469*5dd36a3bSchristos <td></td> 470*5dd36a3bSchristos </tr> 471*5dd36a3bSchristos </table> 472*5dd36a3bSchristos</div><div class="memdoc"> 473*5dd36a3bSchristos 474*5dd36a3bSchristos<p>Returns the length of the underlying string. </p> 475*5dd36a3bSchristos<p>For definite strings only</p> 476*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 477*5dd36a3bSchristos <table class="params"> 478*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>a definite string </td></tr> 479*5dd36a3bSchristos </table> 480*5dd36a3bSchristos </dd> 481*5dd36a3bSchristos</dl> 482*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>length of the string. Zero if no chunk has been attached yet </dd></dl> 483*5dd36a3bSchristos 484*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00106">106</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 485*5dd36a3bSchristos 486*5dd36a3bSchristos</div> 487*5dd36a3bSchristos</div> 488*5dd36a3bSchristos<a id="a5e9292c04df380f2c775fe599511a7ab"></a> 489*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a5e9292c04df380f2c775fe599511a7ab">§ </a></span>cbor_string_set_handle()</h2> 490*5dd36a3bSchristos 491*5dd36a3bSchristos<div class="memitem"> 492*5dd36a3bSchristos<div class="memproto"> 493*5dd36a3bSchristos <table class="memname"> 494*5dd36a3bSchristos <tr> 495*5dd36a3bSchristos <td class="memname">void cbor_string_set_handle </td> 496*5dd36a3bSchristos <td>(</td> 497*5dd36a3bSchristos <td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 498*5dd36a3bSchristos <td class="paramname"><em>item</em>, </td> 499*5dd36a3bSchristos </tr> 500*5dd36a3bSchristos <tr> 501*5dd36a3bSchristos <td class="paramkey"></td> 502*5dd36a3bSchristos <td></td> 503*5dd36a3bSchristos <td class="paramtype"><a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> <a class="el" href="common_8h.html#a9ac79315ed2dcf2c9587e8e3a9a6bc97">CBOR_RESTRICT_POINTER</a> </td> 504*5dd36a3bSchristos <td class="paramname"><em>data</em>, </td> 505*5dd36a3bSchristos </tr> 506*5dd36a3bSchristos <tr> 507*5dd36a3bSchristos <td class="paramkey"></td> 508*5dd36a3bSchristos <td></td> 509*5dd36a3bSchristos <td class="paramtype">size_t </td> 510*5dd36a3bSchristos <td class="paramname"><em>length</em> </td> 511*5dd36a3bSchristos </tr> 512*5dd36a3bSchristos <tr> 513*5dd36a3bSchristos <td></td> 514*5dd36a3bSchristos <td>)</td> 515*5dd36a3bSchristos <td></td><td></td> 516*5dd36a3bSchristos </tr> 517*5dd36a3bSchristos </table> 518*5dd36a3bSchristos</div><div class="memdoc"> 519*5dd36a3bSchristos 520*5dd36a3bSchristos<p>Set the handle to the underlying string. </p> 521*5dd36a3bSchristos<pre class="fragment">embed:rst:leading-asterisk 522*5dd36a3bSchristos* .. warning:: Using a pointer to a stack allocated constant is a common mistake. Lifetime of the string will expire when it goes out of scope and the CBOR item will be left inconsistent. 523*5dd36a3bSchristos* </pre><dl class="params"><dt>Parameters</dt><dd> 524*5dd36a3bSchristos <table class="params"> 525*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A definite string </td></tr> 526*5dd36a3bSchristos <tr><td class="paramname">data</td><td>The memory block. The caller gives up the ownership of the block. libcbor will deallocate it when appropriate using its free function </td></tr> 527*5dd36a3bSchristos <tr><td class="paramname">length</td><td>Length of the data block </td></tr> 528*5dd36a3bSchristos </table> 529*5dd36a3bSchristos </dd> 530*5dd36a3bSchristos</dl> 531*5dd36a3bSchristos 532*5dd36a3bSchristos<p>Definition at line <a class="el" href="strings_8c_source.html#l00059">59</a> of file <a class="el" href="strings_8c_source.html">strings.c</a>.</p> 533*5dd36a3bSchristos 534*5dd36a3bSchristos</div> 535*5dd36a3bSchristos</div> 536*5dd36a3bSchristos</div><!-- contents --> 537*5dd36a3bSchristos<!-- start footer part --> 538*5dd36a3bSchristos<hr class="footer"/><address class="footer"><small> 539*5dd36a3bSchristosGenerated on Mon Feb 6 2017 00:26:19 for libcbor by  <a href="http://www.doxygen.org/index.html"> 540*5dd36a3bSchristos<img class="footer" src="doxygen.png" alt="doxygen"/> 541*5dd36a3bSchristos</a> 1.8.12 542*5dd36a3bSchristos</small></address> 543*5dd36a3bSchristos</body> 544*5dd36a3bSchristos</html> 545