<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcbor: src/cbor/strings.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libcbor
 <span id="projectnumber">0.5.0</span>
</div>
<div id="projectbrief">libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<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>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">strings.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include "<a class="el" href="common_8h_source.html">cbor/common.h</a>"</code><br />
</div>
<p><a href="strings_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<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>
<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>
<tr class="separator:aa0c17825f920ebf122bd7b9abede919f"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:a90c1cf7781f7ef1f3549f497abd259ef"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<tr class="memdesc:aa2778891e70dec4cd59c9a969294d4aa"><td class="mdescLeft"> </td><td class="mdescRight">Is the string definite? <a href="#aa2778891e70dec4cd59c9a969294d4aa">More...</a><br /></td></tr>
<tr class="separator:aa2778891e70dec4cd59c9a969294d4aa"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<tr class="memdesc:aa1a92438a04ae77beea9a17910805530"><td class="mdescLeft"> </td><td class="mdescRight">Is the string indefinite? <a href="#aa1a92438a04ae77beea9a17910805530">More...</a><br /></td></tr>
<tr class="separator:aa1a92438a04ae77beea9a17910805530"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:af12871b50ba25f756fa1bfacd1fca12a"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:a5e9292c04df380f2c775fe599511a7ab"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:a81d1160eed81b2a29b6c5e9ff6b9e02a"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:ad8062db21711a51ae520cc1e4f5fe5ab"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:a634462c7237298a196413cd62d7d1877"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<tr class="memdesc:a6e2516983e412b9d22fd1fccbeded632"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new definite string. <a href="#a6e2516983e412b9d22fd1fccbeded632">More...</a><br /></td></tr>
<tr class="separator:a6e2516983e412b9d22fd1fccbeded632"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<tr class="memdesc:a226f91c7bfd6be9b0a52cdc6f0b17741"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new indefinite string. <a href="#a226f91c7bfd6be9b0a52cdc6f0b17741">More...</a><br /></td></tr>
<tr class="separator:a226f91c7bfd6be9b0a52cdc6f0b17741"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:a61a9388aca4fc7ee5355eb92a6d56536"><td class="memSeparator" colspan="2"> </td></tr>
<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>
<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>
<tr class="separator:a26f8c53bb33641408921c388bf539b0c"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a61a9388aca4fc7ee5355eb92a6d56536"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a61a9388aca4fc7ee5355eb92a6d56536">§ </a></span>cbor_build_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_string </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>val</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new string and initializes it. </p>
<p>The <code>val</code> will be copied to a newly allocated block</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">val</td><td>A null-terminated UTF-8 string </td></tr>
</table>
</dd>
</dl>
<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>
<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>
</div>
</div>
<a id="a26f8c53bb33641408921c388bf539b0c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a26f8c53bb33641408921c388bf539b0c">§ </a></span>cbor_build_stringn()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_stringn </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>val</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new string and initializes it. </p>
<p>The <code>handle</code> will be copied to a newly allocated block</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">val</td><td>A UTF-8 string, at least <code>length</code> long (excluding the null byte) </td></tr>
</table>
</dd>
</dl>
<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>
<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>
</div>
</div>
<a id="a6e2516983e412b9d22fd1fccbeded632"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6e2516983e412b9d22fd1fccbeded632">§ </a></span>cbor_new_definite_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_definite_string </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new definite string. </p>
<p>The handle is initialized to <code>NULL</code> and length to 0</p>
<dl class="section return"><dt>Returns</dt><dd><b>new</b> definite string. <code>NULL</code> on malloc failure. </dd></dl>
<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>
</div>
</div>
<a id="a226f91c7bfd6be9b0a52cdc6f0b17741"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a226f91c7bfd6be9b0a52cdc6f0b17741">§ </a></span>cbor_new_indefinite_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_indefinite_string </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new indefinite string. </p>
<p>The chunks array is initialized to <code>NULL</code> and chunkcount to 0</p>
<dl class="section return"><dt>Returns</dt><dd><b>new</b> indefinite string. <code>NULL</code> on malloc failure. </dd></dl>
<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>
</div>
</div>
<a id="a634462c7237298a196413cd62d7d1877"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a634462c7237298a196413cd62d7d1877">§ </a></span>cbor_string_add_chunk()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool cbor_string_add_chunk </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>chunk</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Appends a chunk to the string. </p>
<p>Indefinite strings only.</p>
<p>May realloc the chunk storage.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>An indefinite string </td></tr>
<tr><td class="paramname">item[incref]</td><td>A definite string </td></tr>
</table>
</dd>
</dl>
<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>
<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>
</div>
</div>
<a id="ad8062db21711a51ae520cc1e4f5fe5ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad8062db21711a51ae520cc1e4f5fe5ab">§ </a></span>cbor_string_chunk_count()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t cbor_string_chunk_count </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the number of chunks this string consist of. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A indefinite string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The chunk count. 0 for freshly created items. </dd></dl>
<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>
</div>
</div>
<a id="a81d1160eed81b2a29b6c5e9ff6b9e02a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a81d1160eed81b2a29b6c5e9ff6b9e02a">§ </a></span>cbor_string_chunks_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>** cbor_string_chunks_handle </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the handle to the array of chunks. </p>
<p>Manipulations with the memory block (e.g. sorting it) are allowed, but the validity and the number of chunks must be retained.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A indefinite string </td></tr>
</table>
</dd>
</dl>
<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>
<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>
</div>
</div>
<a id="a90c1cf7781f7ef1f3549f497abd259ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a90c1cf7781f7ef1f3549f497abd259ef">§ </a></span>cbor_string_codepoint_count()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t cbor_string_codepoint_count </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>The number of codepoints in this string. </p>
<p>Might differ from length if there are multibyte ones</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of codepoints in this string </dd></dl>
<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>
</div>
</div>
<a id="af12871b50ba25f756fa1bfacd1fca12a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af12871b50ba25f756fa1bfacd1fca12a">§ </a></span>cbor_string_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> cbor_string_handle </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the handle to the underlying string. </p>
<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>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A definite string </td></tr>
</table>
</dd>
</dl>
<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>
<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>
</div>
</div>
<a id="aa2778891e70dec4cd59c9a969294d4aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa2778891e70dec4cd59c9a969294d4aa">§ </a></span>cbor_string_is_definite()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool cbor_string_is_definite </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Is the string definite? </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>a string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Is the string definite? </dd></dl>
<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>
</div>
</div>
<a id="aa1a92438a04ae77beea9a17910805530"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa1a92438a04ae77beea9a17910805530">§ </a></span>cbor_string_is_indefinite()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool cbor_string_is_indefinite </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Is the string indefinite? </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>a string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Is the string indefinite? </dd></dl>
<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>
</div>
</div>
<a id="aa0c17825f920ebf122bd7b9abede919f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa0c17825f920ebf122bd7b9abede919f">§ </a></span>cbor_string_length()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t cbor_string_length </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the length of the underlying string. </p>
<p>For definite strings only</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>a definite string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>length of the string. Zero if no chunk has been attached yet </dd></dl>
<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>
</div>
</div>
<a id="a5e9292c04df380f2c775fe599511a7ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e9292c04df380f2c775fe599511a7ab">§ </a></span>cbor_string_set_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void cbor_string_set_handle </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<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>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the handle to the underlying string. </p>
<pre class="fragment">embed:rst:leading-asterisk
* .. 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.
* </pre><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A definite string </td></tr>
<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>
<tr><td class="paramname">length</td><td>Length of the data block </td></tr>
</table>
</dd>
</dl>
<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>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Feb 6 2017 00:26:19 for libcbor by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>