<!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"/> <title>libcollection: collection_tools.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.7.4 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libcollection <span id="projectnumber">0.1.3</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li id="searchli"> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">collection_tools.h</div> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> COLLECTION LIBRARY</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> Header file for supplementary functions that provide</span> <a name="l00005"></a>00005 <span class="comment"> printing and debugging of collections.</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment"> Copyright (C) Dmitri Pal <dpal@redhat.com> 2009</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> Collection Library is free software: you can redistribute it and/or modify</span> <a name="l00010"></a>00010 <span class="comment"> it under the terms of the GNU Lesser General Public License as published by</span> <a name="l00011"></a>00011 <span class="comment"> the Free Software Foundation, either version 3 of the License, or</span> <a name="l00012"></a>00012 <span class="comment"> (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment"> Collection Library is distributed in the hope that it will be useful,</span> <a name="l00015"></a>00015 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00016"></a>00016 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00017"></a>00017 <span class="comment"> GNU Lesser General Public License for more details.</span> <a name="l00018"></a>00018 <span class="comment"></span> <a name="l00019"></a>00019 <span class="comment"> You should have received a copy of the GNU Lesser General Public License</span> <a name="l00020"></a>00020 <span class="comment"> along with Collection Library. If not, see <http://www.gnu.org/licenses/>.</span> <a name="l00021"></a>00021 <span class="comment">*/</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#ifndef COLLECTION_TOOLS_H</span> <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define COLLECTION_TOOLS_H</span> <a name="l00025"></a>00025 <span class="preprocessor"></span> <a name="l00026"></a>00026 <span class="preprocessor">#include "collection.h"</span> <a name="l00027"></a>00027 <a name="l00041"></a>00041 <span class="preprocessor">#ifdef HAVE_TRACE</span> <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define COL_DEBUG_COLLECTION(collection) col_debug_collection(collection,COL_TRAVERSE_DEFAULT);</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#else</span> <a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define COL_DEBUG_COLLECTION(collection) ;</span> <a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00046"></a>00046 <span class="preprocessor"></span> <a name="l00048"></a><a class="code" href="group__tools.html#ga0e0ad5517f64e55ed7dfa19c83e1c9ee">00048</a> <span class="preprocessor">#define COL_TYPE_NAME_STRING "string"</span> <a name="l00049"></a>00049 <span class="preprocessor"></span> <a name="l00050"></a><a class="code" href="group__tools.html#ga535c8a542a2406b225e114cae5b480de">00050</a> <span class="preprocessor">#define COL_TYPE_NAME_BINARY "bin"</span> <a name="l00051"></a>00051 <span class="preprocessor"></span> <a name="l00052"></a><a class="code" href="group__tools.html#gae670552734d2aff1b899d4d49af8bd41">00052</a> <span class="preprocessor">#define COL_TYPE_NAME_INTEGER "int"</span> <a name="l00053"></a>00053 <span class="preprocessor"></span> <a name="l00054"></a><a class="code" href="group__tools.html#ga026c91e1eb32561c32a36fa065dd2eaa">00054</a> <span class="preprocessor">#define COL_TYPE_NAME_UNSIGNED "uint"</span> <a name="l00055"></a>00055 <span class="preprocessor"></span> <a name="l00056"></a><a class="code" href="group__tools.html#ga0129f186169c5af7c54248bcfda1eb50">00056</a> <span class="preprocessor">#define COL_TYPE_NAME_LONG "long"</span> <a name="l00057"></a>00057 <span class="preprocessor"></span> <a name="l00058"></a><a class="code" href="group__tools.html#ga09039181b49928b8351f21bdeecc73a6">00058</a> <span class="preprocessor">#define COL_TYPE_NAME_ULONG "ulong"</span> <a name="l00059"></a>00059 <span class="preprocessor"></span> <a name="l00060"></a><a class="code" href="group__tools.html#ga565e9565049465fa8e91e4b683400251">00060</a> <span class="preprocessor">#define COL_TYPE_NAME_DOUBLE "double"</span> <a name="l00061"></a>00061 <span class="preprocessor"></span> <a name="l00062"></a><a class="code" href="group__tools.html#gaeb3b657ae179826aab5959b158da29d3">00062</a> <span class="preprocessor">#define COL_TYPE_NAME_BOOL "bool"</span> <a name="l00063"></a>00063 <span class="preprocessor"></span> <a name="l00064"></a><a class="code" href="group__tools.html#ga30dd9bac5b510f5e5e629ceb2040456f">00064</a> <span class="preprocessor">#define COL_TYPE_NAME_UNKNOWN "unknown"</span> <a name="l00065"></a>00065 <span class="preprocessor"></span> <a name="l00067"></a><a class="code" href="group__tools.html#ga357f6fd9a05f4826029da1dbc1d01337">00067</a> <span class="preprocessor">#define TEXT_COLLECTION "SET"</span> <a name="l00068"></a>00068 <span class="preprocessor"></span> <a name="l00069"></a><a class="code" href="group__tools.html#ga6610313081dc9823ba26d6828029ea9a">00069</a> <span class="preprocessor">#define TEXT_COLLEN 3</span> <a name="l00070"></a>00070 <span class="preprocessor"></span> <a name="l00075"></a><a class="code" href="group__tools.html#gad51ded0bbd705f02f73fc60c0b721ced">00075</a> <span class="preprocessor">#define BLOCK_SIZE 1024</span> <a name="l00076"></a>00076 <span class="preprocessor"></span> <a name="l00081"></a><a class="code" href="structcol__serial__data.html">00081</a> <span class="keyword">struct </span><a class="code" href="structcol__serial__data.html" title="Structure is used to incrementaly serialize collection.">col_serial_data</a> { <a name="l00082"></a>00082 <span class="keywordtype">char</span> *buffer; <a name="l00083"></a>00083 <span class="keywordtype">int</span> size; <a name="l00084"></a>00084 <span class="keywordtype">int</span> length; <a name="l00085"></a>00085 <span class="keywordtype">int</span> nest_level; <a name="l00086"></a>00086 }; <a name="l00087"></a>00087 <a name="l00088"></a>00088 <a name="l00097"></a>00097 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#ga429e48fbb0d0004cd2adb958640f729e" title="Calculate the potential size of the item.">col_get_data_len</a>(<span class="keywordtype">int</span> type, <span class="keywordtype">int</span> length); <a name="l00098"></a>00098 <a name="l00109"></a>00109 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#gaab66465a7ac06cc7fe761e1194a48497" title="Grow serialization buffer.">col_grow_buffer</a>(<span class="keyword">struct</span> <a class="code" href="structcol__serial__data.html" title="Structure is used to incrementaly serialize collection.">col_serial_data</a> *buf_data, <span class="keywordtype">int</span> len); <a name="l00110"></a>00110 <a name="l00121"></a>00121 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#ga9e1ae48ab8f8da6b8f007d8240bedfb2" title="Add special data to the serialization output.">col_put_marker</a>(<span class="keyword">struct</span> <a class="code" href="structcol__serial__data.html" title="Structure is used to incrementaly serialize collection.">col_serial_data</a> *buf_data, <a name="l00122"></a>00122 <span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">int</span> len); <a name="l00123"></a>00123 <a name="l00141"></a>00141 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#ga87ed98ae77485302291437f3dc128187" title="Serialization of data callback.">col_serialize</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *property_in, <a name="l00142"></a>00142 <span class="keywordtype">int</span> property_len_in, <a name="l00143"></a>00143 <span class="keywordtype">int</span> type, <a name="l00144"></a>00144 <span class="keywordtype">void</span> *data_in, <a name="l00145"></a>00145 <span class="keywordtype">int</span> length_in, <a name="l00146"></a>00146 <span class="keywordtype">void</span> *custom_data, <a name="l00147"></a>00147 <span class="keywordtype">int</span> *dummy); <a name="l00148"></a>00148 <a name="l00165"></a>00165 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#gadf0726d3ee6a8d0f2af491cf368d94db" title="Debug property callback.">col_debug_handle</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *property, <a name="l00166"></a>00166 <span class="keywordtype">int</span> property_len, <a name="l00167"></a>00167 <span class="keywordtype">int</span> type, <a name="l00168"></a>00168 <span class="keywordtype">void</span> *data, <a name="l00169"></a>00169 <span class="keywordtype">int</span> length, <a name="l00170"></a>00170 <span class="keywordtype">void</span> *custom_data, <a name="l00171"></a>00171 <span class="keywordtype">int</span> *dummy); <a name="l00172"></a>00172 <a name="l00183"></a>00183 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#ga2d3a13e09bd117cb6aeefc7da9297cfd" title="Convenience function to debug an item.">col_debug_item</a>(<span class="keyword">struct</span> <a class="code" href="structcollection__item.html" title="Opaque structure that holds one property.">collection_item</a> *item); <a name="l00184"></a>00184 <a name="l00196"></a>00196 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#gaa00d6122b50463e296c9ba519906cc53" title="Print collection for debugging purposes.">col_debug_collection</a>(<span class="keyword">struct</span> <a class="code" href="structcollection__item.html" title="Opaque structure that holds one property.">collection_item</a> *handle, <a name="l00197"></a>00197 <span class="keywordtype">int</span> flag); <a name="l00198"></a>00198 <a name="l00211"></a>00211 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#gafb7c365e36ed6be8006337670021cb94" title="Print collection data.">col_print_collection</a>(<span class="keyword">struct</span> <a class="code" href="structcollection__item.html" title="Opaque structure that holds one property.">collection_item</a> *handle); <a name="l00212"></a>00212 <a name="l00224"></a>00224 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#gaf30b1eefba0461b31f240638d258de1a" title="Print collection data.">col_print_collection2</a>(<span class="keyword">struct</span> <a class="code" href="structcollection__item.html" title="Opaque structure that holds one property.">collection_item</a> *handle); <a name="l00225"></a>00225 <a name="l00237"></a>00237 <span class="keywordtype">int</span> <a class="code" href="group__tools.html#gafa3625bac175cf5c7e42669d07071538" title="Find and print one property.">col_print_item</a>(<span class="keyword">struct</span> <a class="code" href="structcollection__item.html" title="Opaque structure that holds one property.">collection_item</a> *handle, <span class="keyword">const</span> <span class="keywordtype">char</span> *name); <a name="l00238"></a>00238 <a name="l00257"></a>00257 <span class="keywordtype">char</span> **<a class="code" href="group__tools.html#gae8a801a46f64c5f673b82331661233b3" title="Convert collection to the array of properties.">col_collection_to_list</a>(<span class="keyword">struct</span> <a class="code" href="structcollection__item.html" title="Opaque structure that holds one property.">collection_item</a> *handle, <a name="l00258"></a>00258 <span class="keywordtype">int</span> *size, <a name="l00259"></a>00259 <span class="keywordtype">int</span> *error); <a name="l00260"></a>00260 <a name="l00266"></a>00266 <span class="keywordtype">void</span> <a class="code" href="group__tools.html#gace253d7f83008def0574eed30df91ae2" title="Free list of properties.">col_free_property_list</a>(<span class="keywordtype">char</span> **str_list); <a name="l00267"></a>00267 <a name="l00268"></a>00268 <span class="preprocessor">#endif</span> </pre></div></div> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a></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> <hr class="footer"/><address class="footer"><small>Generated on Thu Sep 15 2011 for libcollection by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>