<!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 Source File</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="headertitle"> <div class="title">strings.h</div> </div> </div><!--header--> <div class="contents"> <a href="strings_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2014-2017 Pavel Kalvoda <me@pavelkalvoda.com></span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * libcbor is free software; you can redistribute it and/or modify</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * it under the terms of the MIT license. See LICENSE for details.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> */</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> </div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#ifndef LIBCBOR_STRINGS_H</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#define LIBCBOR_STRINGS_H</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include "<a class="code" href="common_8h.html">cbor/common.h</a>"</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">/*</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">* ============================================================================</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment">* String manipulation</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">* ============================================================================</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment">*/</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="keywordtype">size_t</span> <a class="code" href="strings_8h.html#aa0c17825f920ebf122bd7b9abede919f">cbor_string_length</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keywordtype">size_t</span> <a class="code" href="strings_8h.html#a90c1cf7781f7ef1f3549f497abd259ef">cbor_string_codepoint_count</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keywordtype">bool</span> <a class="code" href="strings_8h.html#aa2778891e70dec4cd59c9a969294d4aa">cbor_string_is_definite</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="keywordtype">bool</span> <a class="code" href="strings_8h.html#aa1a92438a04ae77beea9a17910805530">cbor_string_is_indefinite</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span> <a class="code" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> <a class="code" href="strings_8h.html#af12871b50ba25f756fa1bfacd1fca12a">cbor_string_handle</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">void</span> <a class="code" href="strings_8h.html#a5e9292c04df380f2c775fe599511a7ab">cbor_string_set_handle</a>(<a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item, <a class="code" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> <a class="code" href="common_8h.html#a9ac79315ed2dcf2c9587e8e3a9a6bc97">CBOR_RESTRICT_POINTER</a> data, <span class="keywordtype">size_t</span> length);</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> **<a class="code" href="strings_8h.html#a81d1160eed81b2a29b6c5e9ff6b9e02a">cbor_string_chunks_handle</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="keywordtype">size_t</span> <a class="code" href="strings_8h.html#ad8062db21711a51ae520cc1e4f5fe5ab">cbor_string_chunk_count</a>(<span class="keyword">const</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item);</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="keywordtype">bool</span> <a class="code" href="strings_8h.html#a634462c7237298a196413cd62d7d1877">cbor_string_add_chunk</a>(<a class="code" href="structcbor__item__t.html">cbor_item_t</a> *item, <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *chunk);</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *<a class="code" href="strings_8h.html#a6e2516983e412b9d22fd1fccbeded632">cbor_new_definite_string</a>();</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *<a class="code" href="strings_8h.html#a226f91c7bfd6be9b0a52cdc6f0b17741">cbor_new_indefinite_string</a>();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *<a class="code" href="strings_8h.html#a61a9388aca4fc7ee5355eb92a6d56536">cbor_build_string</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *val);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <a class="code" href="structcbor__item__t.html">cbor_item_t</a> *<a class="code" href="strings_8h.html#a26f8c53bb33641408921c388bf539b0c">cbor_build_stringn</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *val, <span class="keywordtype">size_t</span> length);</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> </div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> }</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> </div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="preprocessor">#endif //LIBCBOR_STRINGS_H</span></div><div class="ttc" id="strings_8h_html_a6e2516983e412b9d22fd1fccbeded632"><div class="ttname"><a href="strings_8h.html#a6e2516983e412b9d22fd1fccbeded632">cbor_new_definite_string</a></div><div class="ttdeci">cbor_item_t * cbor_new_definite_string()</div><div class="ttdoc">Creates a new definite string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00012">strings.c:12</a></div></div> <div class="ttc" id="strings_8h_html_af12871b50ba25f756fa1bfacd1fca12a"><div class="ttname"><a href="strings_8h.html#af12871b50ba25f756fa1bfacd1fca12a">cbor_string_handle</a></div><div class="ttdeci">cbor_mutable_data cbor_string_handle(const cbor_item_t *item)</div><div class="ttdoc">Get the handle to the underlying string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00112">strings.c:112</a></div></div> <div class="ttc" id="strings_8h_html_aa1a92438a04ae77beea9a17910805530"><div class="ttname"><a href="strings_8h.html#aa1a92438a04ae77beea9a17910805530">cbor_string_is_indefinite</a></div><div class="ttdeci">bool cbor_string_is_indefinite(const cbor_item_t *item)</div><div class="ttdoc">Is the string indefinite? </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00130">strings.c:130</a></div></div> <div class="ttc" id="common_8h_html_a9ac79315ed2dcf2c9587e8e3a9a6bc97"><div class="ttname"><a href="common_8h.html#a9ac79315ed2dcf2c9587e8e3a9a6bc97">CBOR_RESTRICT_POINTER</a></div><div class="ttdeci">#define CBOR_RESTRICT_POINTER</div><div class="ttdef"><b>Definition:</b> <a href="common_8h_source.html#l00033">common.h:33</a></div></div> <div class="ttc" id="strings_8h_html_a5e9292c04df380f2c775fe599511a7ab"><div class="ttname"><a href="strings_8h.html#a5e9292c04df380f2c775fe599511a7ab">cbor_string_set_handle</a></div><div class="ttdeci">void cbor_string_set_handle(cbor_item_t *item, cbor_mutable_data CBOR_RESTRICT_POINTER data, size_t length)</div><div class="ttdoc">Set the handle to the underlying string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00059">strings.c:59</a></div></div> <div class="ttc" id="strings_8h_html_a26f8c53bb33641408921c388bf539b0c"><div class="ttname"><a href="strings_8h.html#a26f8c53bb33641408921c388bf539b0c">cbor_build_stringn</a></div><div class="ttdeci">cbor_item_t * cbor_build_stringn(const char *val, size_t length)</div><div class="ttdoc">Creates a new string and initializes it. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00050">strings.c:50</a></div></div> <div class="ttc" id="strings_8h_html_a61a9388aca4fc7ee5355eb92a6d56536"><div class="ttname"><a href="strings_8h.html#a61a9388aca4fc7ee5355eb92a6d56536">cbor_build_string</a></div><div class="ttdeci">cbor_item_t * cbor_build_string(const char *val)</div><div class="ttdoc">Creates a new string and initializes it. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00040">strings.c:40</a></div></div> <div class="ttc" id="data_8h_html_aabb40e458ece40477e134a69c76693e8"><div class="ttname"><a href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a></div><div class="ttdeci">unsigned char * cbor_mutable_data</div><div class="ttdef"><b>Definition:</b> <a href="data_8h_source.html#l00021">data.h:21</a></div></div> <div class="ttc" id="strings_8h_html_aa2778891e70dec4cd59c9a969294d4aa"><div class="ttname"><a href="strings_8h.html#aa2778891e70dec4cd59c9a969294d4aa">cbor_string_is_definite</a></div><div class="ttdeci">bool cbor_string_is_definite(const cbor_item_t *item)</div><div class="ttdoc">Is the string definite? </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00124">strings.c:124</a></div></div> <div class="ttc" id="strings_8h_html_aa0c17825f920ebf122bd7b9abede919f"><div class="ttname"><a href="strings_8h.html#aa0c17825f920ebf122bd7b9abede919f">cbor_string_length</a></div><div class="ttdeci">size_t cbor_string_length(const cbor_item_t *item)</div><div class="ttdoc">Returns the length of the underlying string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00106">strings.c:106</a></div></div> <div class="ttc" id="strings_8h_html_a634462c7237298a196413cd62d7d1877"><div class="ttname"><a href="strings_8h.html#a634462c7237298a196413cd62d7d1877">cbor_string_add_chunk</a></div><div class="ttdeci">bool cbor_string_add_chunk(cbor_item_t *item, cbor_item_t *chunk)</div><div class="ttdoc">Appends a chunk to the string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00082">strings.c:82</a></div></div> <div class="ttc" id="strings_8h_html_a81d1160eed81b2a29b6c5e9ff6b9e02a"><div class="ttname"><a href="strings_8h.html#a81d1160eed81b2a29b6c5e9ff6b9e02a">cbor_string_chunks_handle</a></div><div class="ttdeci">cbor_item_t ** cbor_string_chunks_handle(const cbor_item_t *item)</div><div class="ttdoc">Get the handle to the array of chunks. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00067">strings.c:67</a></div></div> <div class="ttc" id="strings_8h_html_ad8062db21711a51ae520cc1e4f5fe5ab"><div class="ttname"><a href="strings_8h.html#ad8062db21711a51ae520cc1e4f5fe5ab">cbor_string_chunk_count</a></div><div class="ttdeci">size_t cbor_string_chunk_count(const cbor_item_t *item)</div><div class="ttdoc">Get the number of chunks this string consist of. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00074">strings.c:74</a></div></div> <div class="ttc" id="strings_8h_html_a90c1cf7781f7ef1f3549f497abd259ef"><div class="ttname"><a href="strings_8h.html#a90c1cf7781f7ef1f3549f497abd259ef">cbor_string_codepoint_count</a></div><div class="ttdeci">size_t cbor_string_codepoint_count(const cbor_item_t *item)</div><div class="ttdoc">The number of codepoints in this string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00118">strings.c:118</a></div></div> <div class="ttc" id="common_8h_html"><div class="ttname"><a href="common_8h.html">common.h</a></div></div> <div class="ttc" id="structcbor__item__t_html"><div class="ttname"><a href="structcbor__item__t.html">cbor_item_t</a></div><div class="ttdoc">The item handle. </div><div class="ttdef"><b>Definition:</b> <a href="data_8h_source.html#l00149">data.h:149</a></div></div> <div class="ttc" id="strings_8h_html_a226f91c7bfd6be9b0a52cdc6f0b17741"><div class="ttname"><a href="strings_8h.html#a226f91c7bfd6be9b0a52cdc6f0b17741">cbor_new_indefinite_string</a></div><div class="ttdeci">cbor_item_t * cbor_new_indefinite_string()</div><div class="ttdoc">Creates a new indefinite string. </div><div class="ttdef"><b>Definition:</b> <a href="strings_8c_source.html#l00023">strings.c:23</a></div></div> </div><!-- fragment --></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> |