Tue, 29 Oct 2024 16:47:40 +0100
remove dynamic arrays which are not supported by msvc
<!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.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>ucx: /home/mike/workspace/c/ucx/src/ucx/properties.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" /> </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="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">ucx </div> <div id="projectbrief">UAP Common Extensions</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <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_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">properties.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Load / store utilities for properties files. <a href="#details">More...</a></p> <div class="textblock"><code>#include "<a class="el" href="ucx_8h_source.html">ucx.h</a>"</code><br /> <code>#include "<a class="el" href="map_8h_source.html">map.h</a>"</code><br /> </div> <p><a href="properties_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="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxProperties.html">UcxProperties</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object for parsing properties data. <a href="structUcxProperties.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a44d9dd12cab3aaa0084f1c8b89405796"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxProperties.html">UcxProperties</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#a44d9dd12cab3aaa0084f1c8b89405796">ucx_properties_new</a> ()</td></tr> <tr class="memdesc:a44d9dd12cab3aaa0084f1c8b89405796"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object. <a href="#a44d9dd12cab3aaa0084f1c8b89405796">More...</a><br /></td></tr> <tr class="separator:a44d9dd12cab3aaa0084f1c8b89405796"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a38a2fe7bb2986bd87c7e69356ab05c05"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#a38a2fe7bb2986bd87c7e69356ab05c05">ucx_properties_free</a> (<a class="el" href="structUcxProperties.html">UcxProperties</a> *prop)</td></tr> <tr class="memdesc:a38a2fe7bb2986bd87c7e69356ab05c05"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object. <a href="#a38a2fe7bb2986bd87c7e69356ab05c05">More...</a><br /></td></tr> <tr class="separator:a38a2fe7bb2986bd87c7e69356ab05c05"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aaf8de121764a4d22c763ff2ab41f3a4d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#aaf8de121764a4d22c763ff2ab41f3a4d">ucx_properties_fill</a> (<a class="el" href="structUcxProperties.html">UcxProperties</a> *prop, char *buf, size_t len)</td></tr> <tr class="memdesc:aaf8de121764a4d22c763ff2ab41f3a4d"><td class="mdescLeft"> </td><td class="mdescRight">Sets the input buffer for the properties parser. <a href="#aaf8de121764a4d22c763ff2ab41f3a4d">More...</a><br /></td></tr> <tr class="separator:aaf8de121764a4d22c763ff2ab41f3a4d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a7e03bc573d45d48c538cd721e810d33c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#a7e03bc573d45d48c538cd721e810d33c">ucx_properties_next</a> (<a class="el" href="structUcxProperties.html">UcxProperties</a> *prop, <a class="el" href="structsstr__t.html">sstr_t</a> *name, <a class="el" href="structsstr__t.html">sstr_t</a> *value)</td></tr> <tr class="memdesc:a7e03bc573d45d48c538cd721e810d33c"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the next key/value-pair. <a href="#a7e03bc573d45d48c538cd721e810d33c">More...</a><br /></td></tr> <tr class="separator:a7e03bc573d45d48c538cd721e810d33c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a5c7ff8bc3139960a3f3dc92072b742f3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#a5c7ff8bc3139960a3f3dc92072b742f3">ucx_properties2map</a> (<a class="el" href="structUcxProperties.html">UcxProperties</a> *prop, <a class="el" href="structUcxMap.html">UcxMap</a> *map)</td></tr> <tr class="memdesc:a5c7ff8bc3139960a3f3dc92072b742f3"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves all available key/value-pairs and puts them into a <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a>. <a href="#a5c7ff8bc3139960a3f3dc92072b742f3">More...</a><br /></td></tr> <tr class="separator:a5c7ff8bc3139960a3f3dc92072b742f3"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae1b600f839a6b2278b68fc314981a8a3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#ae1b600f839a6b2278b68fc314981a8a3">ucx_properties_load</a> (<a class="el" href="structUcxMap.html">UcxMap</a> *map, FILE *file)</td></tr> <tr class="memdesc:ae1b600f839a6b2278b68fc314981a8a3"><td class="mdescLeft"> </td><td class="mdescRight">Loads a properties file to a <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a>. <a href="#ae1b600f839a6b2278b68fc314981a8a3">More...</a><br /></td></tr> <tr class="separator:ae1b600f839a6b2278b68fc314981a8a3"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a63c0c1b7648e675b21a1788917ff36fb"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="properties_8h.html#a63c0c1b7648e675b21a1788917ff36fb">ucx_properties_store</a> (<a class="el" href="structUcxMap.html">UcxMap</a> *map, FILE *file)</td></tr> <tr class="memdesc:a63c0c1b7648e675b21a1788917ff36fb"><td class="mdescLeft"> </td><td class="mdescRight">Stores a <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a> to a file. <a href="#a63c0c1b7648e675b21a1788917ff36fb">More...</a><br /></td></tr> <tr class="separator:a63c0c1b7648e675b21a1788917ff36fb"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Load / store utilities for properties files. </p> <dl class="section author"><dt>Author</dt><dd>Mike Becker </dd> <dd> Olaf Wintermann </dd></dl> </div><h2 class="groupheader">Function Documentation</h2> <a id="a5c7ff8bc3139960a3f3dc92072b742f3"></a> <h2 class="memtitle"><span class="permalink"><a href="#a5c7ff8bc3139960a3f3dc92072b742f3">◆ </a></span>ucx_properties2map()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_properties2map </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxProperties.html">UcxProperties</a> * </td> <td class="paramname"><em>prop</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structUcxMap.html">UcxMap</a> * </td> <td class="paramname"><em>map</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Retrieves all available key/value-pairs and puts them into a <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a>. </p> <p>This is done by successive calls to <a class="el" href="properties_8h.html#a7e03bc573d45d48c538cd721e810d33c" title="Retrieves the next key/value-pair. ">ucx_properties_next()</a> until no more key/value-pairs can be retrieved.</p> <p>The memory for the map values is allocated by the map's own allocator.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">prop</td><td>the <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object </td></tr> <tr><td class="paramname">map</td><td>the target map </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The <a class="el" href="structUcxProperties.html#a34f71a6ab6dcb6892e3b4eb802e75bff" title="Parser error code. ">UcxProperties.error</a> code (i.e. 0 on success). </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="properties_8h.html#aaf8de121764a4d22c763ff2ab41f3a4d" title="Sets the input buffer for the properties parser. ">ucx_properties_fill()</a> </dd> <dd> <a class="el" href="structUcxMap.html#a531f3e481c1c331cf037b916192e974d" title="An allocator that is used for the map elements. ">UcxMap.allocator</a> </dd></dl> </div> </div> <a id="aaf8de121764a4d22c763ff2ab41f3a4d"></a> <h2 class="memtitle"><span class="permalink"><a href="#aaf8de121764a4d22c763ff2ab41f3a4d">◆ </a></span>ucx_properties_fill()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_properties_fill </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxProperties.html">UcxProperties</a> * </td> <td class="paramname"><em>prop</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char * </td> <td class="paramname"><em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>len</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Sets the input buffer for the properties parser. </p> <p>After calling this function, you may parse the data by calling <a class="el" href="properties_8h.html#a7e03bc573d45d48c538cd721e810d33c" title="Retrieves the next key/value-pair. ">ucx_properties_next()</a> until it returns 0. The function <a class="el" href="properties_8h.html#a5c7ff8bc3139960a3f3dc92072b742f3" title="Retrieves all available key/value-pairs and puts them into a UcxMap. ">ucx_properties2map()</a> is a convenience function that reads as much data as possible by using this function.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">prop</td><td>the <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object </td></tr> <tr><td class="paramname">buf</td><td>a pointer to the new buffer </td></tr> <tr><td class="paramname">len</td><td>the payload length of the buffer </td></tr> </table> </dd> </dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="properties_8h.html#a7e03bc573d45d48c538cd721e810d33c" title="Retrieves the next key/value-pair. ">ucx_properties_next()</a> </dd> <dd> <a class="el" href="properties_8h.html#a5c7ff8bc3139960a3f3dc92072b742f3" title="Retrieves all available key/value-pairs and puts them into a UcxMap. ">ucx_properties2map()</a> </dd></dl> </div> </div> <a id="a38a2fe7bb2986bd87c7e69356ab05c05"></a> <h2 class="memtitle"><span class="permalink"><a href="#a38a2fe7bb2986bd87c7e69356ab05c05">◆ </a></span>ucx_properties_free()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_properties_free </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxProperties.html">UcxProperties</a> * </td> <td class="paramname"><em>prop</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys a <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">prop</td><td>the <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object to destroy </td></tr> </table> </dd> </dl> </div> </div> <a id="ae1b600f839a6b2278b68fc314981a8a3"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae1b600f839a6b2278b68fc314981a8a3">◆ </a></span>ucx_properties_load()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_properties_load </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxMap.html">UcxMap</a> * </td> <td class="paramname"><em>map</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">FILE * </td> <td class="paramname"><em>file</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Loads a properties file to a <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a>. </p> <p>This is a convenience function that reads data from an input stream until the end of the stream is reached.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">map</td><td>the map object to write the key/value-pairs to </td></tr> <tr><td class="paramname">file</td><td>the <code>FILE*</code> stream to read from </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>0 on success, or a non-zero value on error</dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="properties_8h.html#aaf8de121764a4d22c763ff2ab41f3a4d" title="Sets the input buffer for the properties parser. ">ucx_properties_fill()</a> </dd> <dd> <a class="el" href="properties_8h.html#a5c7ff8bc3139960a3f3dc92072b742f3" title="Retrieves all available key/value-pairs and puts them into a UcxMap. ">ucx_properties2map()</a> </dd></dl> </div> </div> <a id="a44d9dd12cab3aaa0084f1c8b89405796"></a> <h2 class="memtitle"><span class="permalink"><a href="#a44d9dd12cab3aaa0084f1c8b89405796">◆ </a></span>ucx_properties_new()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxProperties.html">UcxProperties</a>* ucx_properties_new </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Constructs a new <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object. </p> <dl class="section return"><dt>Returns</dt><dd>a pointer to the new <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object </dd></dl> </div> </div> <a id="a7e03bc573d45d48c538cd721e810d33c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a7e03bc573d45d48c538cd721e810d33c">◆ </a></span>ucx_properties_next()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_properties_next </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxProperties.html">UcxProperties</a> * </td> <td class="paramname"><em>prop</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structsstr__t.html">sstr_t</a> * </td> <td class="paramname"><em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structsstr__t.html">sstr_t</a> * </td> <td class="paramname"><em>value</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Retrieves the next key/value-pair. </p> <p>This function returns a nonzero value as long as there are key/value-pairs found. If no more key/value-pairs are found, you may refill the input buffer with <a class="el" href="properties_8h.html#aaf8de121764a4d22c763ff2ab41f3a4d" title="Sets the input buffer for the properties parser. ">ucx_properties_fill()</a>.</p> <p><b>Attention:</b> the <a class="el" href="structsstr__t.html#af8049914efc1e67f7de3ee55ec0611b0" title="A pointer to the string (not necessarily NULL-terminated) ">sstr_t.ptr</a> pointers of the output parameters point to memory within the input buffer of the parser and will get invalid some time. If you want long term copies of the key/value-pairs, use <a class="el" href="string_8h.html#accbfd2b459a028d7af9fb7df6f977d80" title="Creates a duplicate of the specified string. ">sstrdup()</a> after calling this function.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">prop</td><td>the <a class="el" href="structUcxProperties.html" title="UcxProperties object for parsing properties data. ">UcxProperties</a> object </td></tr> <tr><td class="paramname">name</td><td>a pointer to the <a class="el" href="structsstr__t.html" title="The UCX string structure. ">sstr_t</a> that shall contain the property name </td></tr> <tr><td class="paramname">value</td><td>a pointer to the <a class="el" href="structsstr__t.html" title="The UCX string structure. ">sstr_t</a> that shall contain the property value </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Nonzero, if a key/value-pair was successfully retrieved </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="properties_8h.html#aaf8de121764a4d22c763ff2ab41f3a4d" title="Sets the input buffer for the properties parser. ">ucx_properties_fill()</a> </dd></dl> </div> </div> <a id="a63c0c1b7648e675b21a1788917ff36fb"></a> <h2 class="memtitle"><span class="permalink"><a href="#a63c0c1b7648e675b21a1788917ff36fb">◆ </a></span>ucx_properties_store()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_properties_store </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxMap.html">UcxMap</a> * </td> <td class="paramname"><em>map</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">FILE * </td> <td class="paramname"><em>file</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Stores a <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a> to a file. </p> <p>The key/value-pairs are written by using the following format:</p> <p><code>[key] = [value]\n</code></p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">map</td><td>the map to store </td></tr> <tr><td class="paramname">file</td><td>the <code>FILE*</code> stream to write to </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>0 on success, or a non-zero value on error </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>