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.h 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.h File Reference</div> </div> 72*5dd36a3bSchristos</div><!--header--> 73*5dd36a3bSchristos<div class="contents"> 74*5dd36a3bSchristos<div class="textblock"><code>#include "<a class="el" href="common_8h_source.html">cbor/common.h</a>"</code><br /> 75*5dd36a3bSchristos</div> 76*5dd36a3bSchristos<p><a href="strings_8h_source.html">Go to the source code of this file.</a></p> 77*5dd36a3bSchristos<table class="memberdecls"> 78*5dd36a3bSchristos<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 79*5dd36a3bSchristosFunctions</h2></td></tr> 80*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_8h.html#aa0c17825f920ebf122bd7b9abede919f">cbor_string_length</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 81*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> 82*5dd36a3bSchristos<tr class="separator:aa0c17825f920ebf122bd7b9abede919f"><td class="memSeparator" colspan="2"> </td></tr> 83*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_8h.html#a90c1cf7781f7ef1f3549f497abd259ef">cbor_string_codepoint_count</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 84*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> 85*5dd36a3bSchristos<tr class="separator:a90c1cf7781f7ef1f3549f497abd259ef"><td class="memSeparator" colspan="2"> </td></tr> 86*5dd36a3bSchristos<tr class="memitem:aa2778891e70dec4cd59c9a969294d4aa"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8h.html#aa2778891e70dec4cd59c9a969294d4aa">cbor_string_is_definite</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 87*5dd36a3bSchristos<tr class="memdesc:aa2778891e70dec4cd59c9a969294d4aa"><td class="mdescLeft"> </td><td class="mdescRight">Is the string definite? <a href="#aa2778891e70dec4cd59c9a969294d4aa">More...</a><br /></td></tr> 88*5dd36a3bSchristos<tr class="separator:aa2778891e70dec4cd59c9a969294d4aa"><td class="memSeparator" colspan="2"> </td></tr> 89*5dd36a3bSchristos<tr class="memitem:aa1a92438a04ae77beea9a17910805530"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8h.html#aa1a92438a04ae77beea9a17910805530">cbor_string_is_indefinite</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 90*5dd36a3bSchristos<tr class="memdesc:aa1a92438a04ae77beea9a17910805530"><td class="mdescLeft"> </td><td class="mdescRight">Is the string indefinite? <a href="#aa1a92438a04ae77beea9a17910805530">More...</a><br /></td></tr> 91*5dd36a3bSchristos<tr class="separator:aa1a92438a04ae77beea9a17910805530"><td class="memSeparator" colspan="2"> </td></tr> 92*5dd36a3bSchristos<tr class="memitem:af12871b50ba25f756fa1bfacd1fca12a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8h.html#af12871b50ba25f756fa1bfacd1fca12a">cbor_string_handle</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 93*5dd36a3bSchristos<tr class="memdesc:af12871b50ba25f756fa1bfacd1fca12a"><td class="mdescLeft"> </td><td class="mdescRight">Get the handle to the underlying string. <a href="#af12871b50ba25f756fa1bfacd1fca12a">More...</a><br /></td></tr> 94*5dd36a3bSchristos<tr class="separator:af12871b50ba25f756fa1bfacd1fca12a"><td class="memSeparator" colspan="2"> </td></tr> 95*5dd36a3bSchristos<tr class="memitem:a5e9292c04df380f2c775fe599511a7ab"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8h.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> 96*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> 97*5dd36a3bSchristos<tr class="separator:a5e9292c04df380f2c775fe599511a7ab"><td class="memSeparator" colspan="2"> </td></tr> 98*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_8h.html#a81d1160eed81b2a29b6c5e9ff6b9e02a">cbor_string_chunks_handle</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 99*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> 100*5dd36a3bSchristos<tr class="separator:a81d1160eed81b2a29b6c5e9ff6b9e02a"><td class="memSeparator" colspan="2"> </td></tr> 101*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_8h.html#ad8062db21711a51ae520cc1e4f5fe5ab">cbor_string_chunk_count</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr> 102*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> 103*5dd36a3bSchristos<tr class="separator:ad8062db21711a51ae520cc1e4f5fe5ab"><td class="memSeparator" colspan="2"> </td></tr> 104*5dd36a3bSchristos<tr class="memitem:a634462c7237298a196413cd62d7d1877"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="strings_8h.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> 105*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> 106*5dd36a3bSchristos<tr class="separator:a634462c7237298a196413cd62d7d1877"><td class="memSeparator" colspan="2"> </td></tr> 107*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_8h.html#a6e2516983e412b9d22fd1fccbeded632">cbor_new_definite_string</a> ()</td></tr> 108*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> 109*5dd36a3bSchristos<tr class="separator:a6e2516983e412b9d22fd1fccbeded632"><td class="memSeparator" colspan="2"> </td></tr> 110*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_8h.html#a226f91c7bfd6be9b0a52cdc6f0b17741">cbor_new_indefinite_string</a> ()</td></tr> 111*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> 112*5dd36a3bSchristos<tr class="separator:a226f91c7bfd6be9b0a52cdc6f0b17741"><td class="memSeparator" colspan="2"> </td></tr> 113*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_8h.html#a61a9388aca4fc7ee5355eb92a6d56536">cbor_build_string</a> (const char *val)</td></tr> 114*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> 115*5dd36a3bSchristos<tr class="separator:a61a9388aca4fc7ee5355eb92a6d56536"><td class="memSeparator" colspan="2"> </td></tr> 116*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_8h.html#a26f8c53bb33641408921c388bf539b0c">cbor_build_stringn</a> (const char *val, size_t length)</td></tr> 117*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> 118*5dd36a3bSchristos<tr class="separator:a26f8c53bb33641408921c388bf539b0c"><td class="memSeparator" colspan="2"> </td></tr> 119*5dd36a3bSchristos</table> 120*5dd36a3bSchristos<h2 class="groupheader">Function Documentation</h2> 121*5dd36a3bSchristos<a id="a61a9388aca4fc7ee5355eb92a6d56536"></a> 122*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a61a9388aca4fc7ee5355eb92a6d56536">§ </a></span>cbor_build_string()</h2> 123*5dd36a3bSchristos 124*5dd36a3bSchristos<div class="memitem"> 125*5dd36a3bSchristos<div class="memproto"> 126*5dd36a3bSchristos <table class="memname"> 127*5dd36a3bSchristos <tr> 128*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_string </td> 129*5dd36a3bSchristos <td>(</td> 130*5dd36a3bSchristos <td class="paramtype">const char * </td> 131*5dd36a3bSchristos <td class="paramname"><em>val</em></td><td>)</td> 132*5dd36a3bSchristos <td></td> 133*5dd36a3bSchristos </tr> 134*5dd36a3bSchristos </table> 135*5dd36a3bSchristos</div><div class="memdoc"> 136*5dd36a3bSchristos 137*5dd36a3bSchristos<p>Creates a new string and initializes it. </p> 138*5dd36a3bSchristos<p>The <code>val</code> will be copied to a newly allocated block</p> 139*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 140*5dd36a3bSchristos <table class="params"> 141*5dd36a3bSchristos <tr><td class="paramname">val</td><td>A null-terminated UTF-8 string </td></tr> 142*5dd36a3bSchristos </table> 143*5dd36a3bSchristos </dd> 144*5dd36a3bSchristos</dl> 145*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> 146*5dd36a3bSchristos 147*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> 148*5dd36a3bSchristos 149*5dd36a3bSchristos</div> 150*5dd36a3bSchristos</div> 151*5dd36a3bSchristos<a id="a26f8c53bb33641408921c388bf539b0c"></a> 152*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a26f8c53bb33641408921c388bf539b0c">§ </a></span>cbor_build_stringn()</h2> 153*5dd36a3bSchristos 154*5dd36a3bSchristos<div class="memitem"> 155*5dd36a3bSchristos<div class="memproto"> 156*5dd36a3bSchristos <table class="memname"> 157*5dd36a3bSchristos <tr> 158*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_stringn </td> 159*5dd36a3bSchristos <td>(</td> 160*5dd36a3bSchristos <td class="paramtype">const char * </td> 161*5dd36a3bSchristos <td class="paramname"><em>val</em>, </td> 162*5dd36a3bSchristos </tr> 163*5dd36a3bSchristos <tr> 164*5dd36a3bSchristos <td class="paramkey"></td> 165*5dd36a3bSchristos <td></td> 166*5dd36a3bSchristos <td class="paramtype">size_t </td> 167*5dd36a3bSchristos <td class="paramname"><em>length</em> </td> 168*5dd36a3bSchristos </tr> 169*5dd36a3bSchristos <tr> 170*5dd36a3bSchristos <td></td> 171*5dd36a3bSchristos <td>)</td> 172*5dd36a3bSchristos <td></td><td></td> 173*5dd36a3bSchristos </tr> 174*5dd36a3bSchristos </table> 175*5dd36a3bSchristos</div><div class="memdoc"> 176*5dd36a3bSchristos 177*5dd36a3bSchristos<p>Creates a new string and initializes it. </p> 178*5dd36a3bSchristos<p>The <code>handle</code> will be copied to a newly allocated block</p> 179*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 180*5dd36a3bSchristos <table class="params"> 181*5dd36a3bSchristos <tr><td class="paramname">val</td><td>A UTF-8 string, at least <code>length</code> long (excluding the null byte) </td></tr> 182*5dd36a3bSchristos </table> 183*5dd36a3bSchristos </dd> 184*5dd36a3bSchristos</dl> 185*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> 186*5dd36a3bSchristos 187*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> 188*5dd36a3bSchristos 189*5dd36a3bSchristos</div> 190*5dd36a3bSchristos</div> 191*5dd36a3bSchristos<a id="a6e2516983e412b9d22fd1fccbeded632"></a> 192*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a6e2516983e412b9d22fd1fccbeded632">§ </a></span>cbor_new_definite_string()</h2> 193*5dd36a3bSchristos 194*5dd36a3bSchristos<div class="memitem"> 195*5dd36a3bSchristos<div class="memproto"> 196*5dd36a3bSchristos <table class="memname"> 197*5dd36a3bSchristos <tr> 198*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_definite_string </td> 199*5dd36a3bSchristos <td>(</td> 200*5dd36a3bSchristos <td class="paramname"></td><td>)</td> 201*5dd36a3bSchristos <td></td> 202*5dd36a3bSchristos </tr> 203*5dd36a3bSchristos </table> 204*5dd36a3bSchristos</div><div class="memdoc"> 205*5dd36a3bSchristos 206*5dd36a3bSchristos<p>Creates a new definite string. </p> 207*5dd36a3bSchristos<p>The handle is initialized to <code>NULL</code> and length to 0</p> 208*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd><b>new</b> definite string. <code>NULL</code> on malloc failure. </dd></dl> 209*5dd36a3bSchristos 210*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> 211*5dd36a3bSchristos 212*5dd36a3bSchristos</div> 213*5dd36a3bSchristos</div> 214*5dd36a3bSchristos<a id="a226f91c7bfd6be9b0a52cdc6f0b17741"></a> 215*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a226f91c7bfd6be9b0a52cdc6f0b17741">§ </a></span>cbor_new_indefinite_string()</h2> 216*5dd36a3bSchristos 217*5dd36a3bSchristos<div class="memitem"> 218*5dd36a3bSchristos<div class="memproto"> 219*5dd36a3bSchristos <table class="memname"> 220*5dd36a3bSchristos <tr> 221*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_indefinite_string </td> 222*5dd36a3bSchristos <td>(</td> 223*5dd36a3bSchristos <td class="paramname"></td><td>)</td> 224*5dd36a3bSchristos <td></td> 225*5dd36a3bSchristos </tr> 226*5dd36a3bSchristos </table> 227*5dd36a3bSchristos</div><div class="memdoc"> 228*5dd36a3bSchristos 229*5dd36a3bSchristos<p>Creates a new indefinite string. </p> 230*5dd36a3bSchristos<p>The chunks array is initialized to <code>NULL</code> and chunkcount to 0</p> 231*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd><b>new</b> indefinite string. <code>NULL</code> on malloc failure. </dd></dl> 232*5dd36a3bSchristos 233*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> 234*5dd36a3bSchristos 235*5dd36a3bSchristos</div> 236*5dd36a3bSchristos</div> 237*5dd36a3bSchristos<a id="a634462c7237298a196413cd62d7d1877"></a> 238*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a634462c7237298a196413cd62d7d1877">§ </a></span>cbor_string_add_chunk()</h2> 239*5dd36a3bSchristos 240*5dd36a3bSchristos<div class="memitem"> 241*5dd36a3bSchristos<div class="memproto"> 242*5dd36a3bSchristos <table class="memname"> 243*5dd36a3bSchristos <tr> 244*5dd36a3bSchristos <td class="memname">bool cbor_string_add_chunk </td> 245*5dd36a3bSchristos <td>(</td> 246*5dd36a3bSchristos <td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 247*5dd36a3bSchristos <td class="paramname"><em>item</em>, </td> 248*5dd36a3bSchristos </tr> 249*5dd36a3bSchristos <tr> 250*5dd36a3bSchristos <td class="paramkey"></td> 251*5dd36a3bSchristos <td></td> 252*5dd36a3bSchristos <td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 253*5dd36a3bSchristos <td class="paramname"><em>chunk</em> </td> 254*5dd36a3bSchristos </tr> 255*5dd36a3bSchristos <tr> 256*5dd36a3bSchristos <td></td> 257*5dd36a3bSchristos <td>)</td> 258*5dd36a3bSchristos <td></td><td></td> 259*5dd36a3bSchristos </tr> 260*5dd36a3bSchristos </table> 261*5dd36a3bSchristos</div><div class="memdoc"> 262*5dd36a3bSchristos 263*5dd36a3bSchristos<p>Appends a chunk to the string. </p> 264*5dd36a3bSchristos<p>Indefinite strings only.</p> 265*5dd36a3bSchristos<p>May realloc the chunk storage.</p> 266*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 267*5dd36a3bSchristos <table class="params"> 268*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>An indefinite string </td></tr> 269*5dd36a3bSchristos <tr><td class="paramname">item[incref]</td><td>A definite string </td></tr> 270*5dd36a3bSchristos </table> 271*5dd36a3bSchristos </dd> 272*5dd36a3bSchristos</dl> 273*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> 274*5dd36a3bSchristos 275*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> 276*5dd36a3bSchristos 277*5dd36a3bSchristos</div> 278*5dd36a3bSchristos</div> 279*5dd36a3bSchristos<a id="ad8062db21711a51ae520cc1e4f5fe5ab"></a> 280*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#ad8062db21711a51ae520cc1e4f5fe5ab">§ </a></span>cbor_string_chunk_count()</h2> 281*5dd36a3bSchristos 282*5dd36a3bSchristos<div class="memitem"> 283*5dd36a3bSchristos<div class="memproto"> 284*5dd36a3bSchristos <table class="memname"> 285*5dd36a3bSchristos <tr> 286*5dd36a3bSchristos <td class="memname">size_t cbor_string_chunk_count </td> 287*5dd36a3bSchristos <td>(</td> 288*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 289*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 290*5dd36a3bSchristos <td></td> 291*5dd36a3bSchristos </tr> 292*5dd36a3bSchristos </table> 293*5dd36a3bSchristos</div><div class="memdoc"> 294*5dd36a3bSchristos 295*5dd36a3bSchristos<p>Get the number of chunks this string consist of. </p> 296*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 297*5dd36a3bSchristos <table class="params"> 298*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A indefinite string </td></tr> 299*5dd36a3bSchristos </table> 300*5dd36a3bSchristos </dd> 301*5dd36a3bSchristos</dl> 302*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>The chunk count. 0 for freshly created items. </dd></dl> 303*5dd36a3bSchristos 304*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> 305*5dd36a3bSchristos 306*5dd36a3bSchristos</div> 307*5dd36a3bSchristos</div> 308*5dd36a3bSchristos<a id="a81d1160eed81b2a29b6c5e9ff6b9e02a"></a> 309*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a81d1160eed81b2a29b6c5e9ff6b9e02a">§ </a></span>cbor_string_chunks_handle()</h2> 310*5dd36a3bSchristos 311*5dd36a3bSchristos<div class="memitem"> 312*5dd36a3bSchristos<div class="memproto"> 313*5dd36a3bSchristos <table class="memname"> 314*5dd36a3bSchristos <tr> 315*5dd36a3bSchristos <td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>** cbor_string_chunks_handle </td> 316*5dd36a3bSchristos <td>(</td> 317*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 318*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 319*5dd36a3bSchristos <td></td> 320*5dd36a3bSchristos </tr> 321*5dd36a3bSchristos </table> 322*5dd36a3bSchristos</div><div class="memdoc"> 323*5dd36a3bSchristos 324*5dd36a3bSchristos<p>Get the handle to the array of chunks. </p> 325*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> 326*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 327*5dd36a3bSchristos <table class="params"> 328*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A indefinite string </td></tr> 329*5dd36a3bSchristos </table> 330*5dd36a3bSchristos </dd> 331*5dd36a3bSchristos</dl> 332*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> 333*5dd36a3bSchristos 334*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> 335*5dd36a3bSchristos 336*5dd36a3bSchristos</div> 337*5dd36a3bSchristos</div> 338*5dd36a3bSchristos<a id="a90c1cf7781f7ef1f3549f497abd259ef"></a> 339*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a90c1cf7781f7ef1f3549f497abd259ef">§ </a></span>cbor_string_codepoint_count()</h2> 340*5dd36a3bSchristos 341*5dd36a3bSchristos<div class="memitem"> 342*5dd36a3bSchristos<div class="memproto"> 343*5dd36a3bSchristos <table class="memname"> 344*5dd36a3bSchristos <tr> 345*5dd36a3bSchristos <td class="memname">size_t cbor_string_codepoint_count </td> 346*5dd36a3bSchristos <td>(</td> 347*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 348*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 349*5dd36a3bSchristos <td></td> 350*5dd36a3bSchristos </tr> 351*5dd36a3bSchristos </table> 352*5dd36a3bSchristos</div><div class="memdoc"> 353*5dd36a3bSchristos 354*5dd36a3bSchristos<p>The number of codepoints in this string. </p> 355*5dd36a3bSchristos<p>Might differ from length if there are multibyte ones</p> 356*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 357*5dd36a3bSchristos <table class="params"> 358*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A string </td></tr> 359*5dd36a3bSchristos </table> 360*5dd36a3bSchristos </dd> 361*5dd36a3bSchristos</dl> 362*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>The number of codepoints in this string </dd></dl> 363*5dd36a3bSchristos 364*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> 365*5dd36a3bSchristos 366*5dd36a3bSchristos</div> 367*5dd36a3bSchristos</div> 368*5dd36a3bSchristos<a id="af12871b50ba25f756fa1bfacd1fca12a"></a> 369*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#af12871b50ba25f756fa1bfacd1fca12a">§ </a></span>cbor_string_handle()</h2> 370*5dd36a3bSchristos 371*5dd36a3bSchristos<div class="memitem"> 372*5dd36a3bSchristos<div class="memproto"> 373*5dd36a3bSchristos <table class="memname"> 374*5dd36a3bSchristos <tr> 375*5dd36a3bSchristos <td class="memname"><a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> cbor_string_handle </td> 376*5dd36a3bSchristos <td>(</td> 377*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 378*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 379*5dd36a3bSchristos <td></td> 380*5dd36a3bSchristos </tr> 381*5dd36a3bSchristos </table> 382*5dd36a3bSchristos</div><div class="memdoc"> 383*5dd36a3bSchristos 384*5dd36a3bSchristos<p>Get the handle to the underlying string. </p> 385*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> 386*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 387*5dd36a3bSchristos <table class="params"> 388*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A definite string </td></tr> 389*5dd36a3bSchristos </table> 390*5dd36a3bSchristos </dd> 391*5dd36a3bSchristos</dl> 392*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> 393*5dd36a3bSchristos 394*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> 395*5dd36a3bSchristos 396*5dd36a3bSchristos</div> 397*5dd36a3bSchristos</div> 398*5dd36a3bSchristos<a id="aa2778891e70dec4cd59c9a969294d4aa"></a> 399*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#aa2778891e70dec4cd59c9a969294d4aa">§ </a></span>cbor_string_is_definite()</h2> 400*5dd36a3bSchristos 401*5dd36a3bSchristos<div class="memitem"> 402*5dd36a3bSchristos<div class="memproto"> 403*5dd36a3bSchristos <table class="memname"> 404*5dd36a3bSchristos <tr> 405*5dd36a3bSchristos <td class="memname">bool cbor_string_is_definite </td> 406*5dd36a3bSchristos <td>(</td> 407*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 408*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 409*5dd36a3bSchristos <td></td> 410*5dd36a3bSchristos </tr> 411*5dd36a3bSchristos </table> 412*5dd36a3bSchristos</div><div class="memdoc"> 413*5dd36a3bSchristos 414*5dd36a3bSchristos<p>Is the string definite? </p> 415*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 416*5dd36a3bSchristos <table class="params"> 417*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>a string </td></tr> 418*5dd36a3bSchristos </table> 419*5dd36a3bSchristos </dd> 420*5dd36a3bSchristos</dl> 421*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>Is the string definite? </dd></dl> 422*5dd36a3bSchristos 423*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> 424*5dd36a3bSchristos 425*5dd36a3bSchristos</div> 426*5dd36a3bSchristos</div> 427*5dd36a3bSchristos<a id="aa1a92438a04ae77beea9a17910805530"></a> 428*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#aa1a92438a04ae77beea9a17910805530">§ </a></span>cbor_string_is_indefinite()</h2> 429*5dd36a3bSchristos 430*5dd36a3bSchristos<div class="memitem"> 431*5dd36a3bSchristos<div class="memproto"> 432*5dd36a3bSchristos <table class="memname"> 433*5dd36a3bSchristos <tr> 434*5dd36a3bSchristos <td class="memname">bool cbor_string_is_indefinite </td> 435*5dd36a3bSchristos <td>(</td> 436*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 437*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 438*5dd36a3bSchristos <td></td> 439*5dd36a3bSchristos </tr> 440*5dd36a3bSchristos </table> 441*5dd36a3bSchristos</div><div class="memdoc"> 442*5dd36a3bSchristos 443*5dd36a3bSchristos<p>Is the string indefinite? </p> 444*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 445*5dd36a3bSchristos <table class="params"> 446*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>a string </td></tr> 447*5dd36a3bSchristos </table> 448*5dd36a3bSchristos </dd> 449*5dd36a3bSchristos</dl> 450*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>Is the string indefinite? </dd></dl> 451*5dd36a3bSchristos 452*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> 453*5dd36a3bSchristos 454*5dd36a3bSchristos</div> 455*5dd36a3bSchristos</div> 456*5dd36a3bSchristos<a id="aa0c17825f920ebf122bd7b9abede919f"></a> 457*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#aa0c17825f920ebf122bd7b9abede919f">§ </a></span>cbor_string_length()</h2> 458*5dd36a3bSchristos 459*5dd36a3bSchristos<div class="memitem"> 460*5dd36a3bSchristos<div class="memproto"> 461*5dd36a3bSchristos <table class="memname"> 462*5dd36a3bSchristos <tr> 463*5dd36a3bSchristos <td class="memname">size_t cbor_string_length </td> 464*5dd36a3bSchristos <td>(</td> 465*5dd36a3bSchristos <td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 466*5dd36a3bSchristos <td class="paramname"><em>item</em></td><td>)</td> 467*5dd36a3bSchristos <td></td> 468*5dd36a3bSchristos </tr> 469*5dd36a3bSchristos </table> 470*5dd36a3bSchristos</div><div class="memdoc"> 471*5dd36a3bSchristos 472*5dd36a3bSchristos<p>Returns the length of the underlying string. </p> 473*5dd36a3bSchristos<p>For definite strings only</p> 474*5dd36a3bSchristos<dl class="params"><dt>Parameters</dt><dd> 475*5dd36a3bSchristos <table class="params"> 476*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>a definite string </td></tr> 477*5dd36a3bSchristos </table> 478*5dd36a3bSchristos </dd> 479*5dd36a3bSchristos</dl> 480*5dd36a3bSchristos<dl class="section return"><dt>Returns</dt><dd>length of the string. Zero if no chunk has been attached yet </dd></dl> 481*5dd36a3bSchristos 482*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> 483*5dd36a3bSchristos 484*5dd36a3bSchristos</div> 485*5dd36a3bSchristos</div> 486*5dd36a3bSchristos<a id="a5e9292c04df380f2c775fe599511a7ab"></a> 487*5dd36a3bSchristos<h2 class="memtitle"><span class="permalink"><a href="#a5e9292c04df380f2c775fe599511a7ab">§ </a></span>cbor_string_set_handle()</h2> 488*5dd36a3bSchristos 489*5dd36a3bSchristos<div class="memitem"> 490*5dd36a3bSchristos<div class="memproto"> 491*5dd36a3bSchristos <table class="memname"> 492*5dd36a3bSchristos <tr> 493*5dd36a3bSchristos <td class="memname">void cbor_string_set_handle </td> 494*5dd36a3bSchristos <td>(</td> 495*5dd36a3bSchristos <td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td> 496*5dd36a3bSchristos <td class="paramname"><em>item</em>, </td> 497*5dd36a3bSchristos </tr> 498*5dd36a3bSchristos <tr> 499*5dd36a3bSchristos <td class="paramkey"></td> 500*5dd36a3bSchristos <td></td> 501*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> 502*5dd36a3bSchristos <td class="paramname"><em>data</em>, </td> 503*5dd36a3bSchristos </tr> 504*5dd36a3bSchristos <tr> 505*5dd36a3bSchristos <td class="paramkey"></td> 506*5dd36a3bSchristos <td></td> 507*5dd36a3bSchristos <td class="paramtype">size_t </td> 508*5dd36a3bSchristos <td class="paramname"><em>length</em> </td> 509*5dd36a3bSchristos </tr> 510*5dd36a3bSchristos <tr> 511*5dd36a3bSchristos <td></td> 512*5dd36a3bSchristos <td>)</td> 513*5dd36a3bSchristos <td></td><td></td> 514*5dd36a3bSchristos </tr> 515*5dd36a3bSchristos </table> 516*5dd36a3bSchristos</div><div class="memdoc"> 517*5dd36a3bSchristos 518*5dd36a3bSchristos<p>Set the handle to the underlying string. </p> 519*5dd36a3bSchristos<pre class="fragment">embed:rst:leading-asterisk 520*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. 521*5dd36a3bSchristos* </pre><dl class="params"><dt>Parameters</dt><dd> 522*5dd36a3bSchristos <table class="params"> 523*5dd36a3bSchristos <tr><td class="paramname">item[borrow]</td><td>A definite string </td></tr> 524*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> 525*5dd36a3bSchristos <tr><td class="paramname">length</td><td>Length of the data block </td></tr> 526*5dd36a3bSchristos </table> 527*5dd36a3bSchristos </dd> 528*5dd36a3bSchristos</dl> 529*5dd36a3bSchristos 530*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> 531*5dd36a3bSchristos 532*5dd36a3bSchristos</div> 533*5dd36a3bSchristos</div> 534*5dd36a3bSchristos</div><!-- contents --> 535*5dd36a3bSchristos<!-- start footer part --> 536*5dd36a3bSchristos<hr class="footer"/><address class="footer"><small> 537*5dd36a3bSchristosGenerated on Mon Feb 6 2017 00:26:19 for libcbor by  <a href="http://www.doxygen.org/index.html"> 538*5dd36a3bSchristos<img class="footer" src="doxygen.png" alt="doxygen"/> 539*5dd36a3bSchristos</a> 1.8.12 540*5dd36a3bSchristos</small></address> 541*5dd36a3bSchristos</body> 542*5dd36a3bSchristos</html> 543