<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>libdap++: util.cc File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>util.cc File Reference</h1><code>#include "<a class="el" href="config_8h_source.html">config.h</a>"</code><br> <code>#include <cassert></code><br> <code>#include <cstring></code><br> <code>#include <ctype.h></code><br> <code>#include <time.h></code><br> <code>#include <unistd.h></code><br> <code>#include <sys/types.h></code><br> <code>#include <sys/stat.h></code><br> <code>#include <string></code><br> <code>#include <sstream></code><br> <code>#include <vector></code><br> <code>#include <algorithm></code><br> <code>#include <stdexcept></code><br> <code>#include "<a class="el" href="BaseType_8h_source.html">BaseType.h</a>"</code><br> <code>#include "<a class="el" href="Str_8h_source.html">Str.h</a>"</code><br> <code>#include "<a class="el" href="Url_8h_source.html">Url.h</a>"</code><br> <code>#include "<a class="el" href="Sequence_8h_source.html">Sequence.h</a>"</code><br> <code>#include "<a class="el" href="Error_8h_source.html">Error.h</a>"</code><br> <code>#include "<a class="el" href="parser_8h_source.html">parser.h</a>"</code><br> <code>#include "<a class="el" href="util_8h_source.html">util.h</a>"</code><br> <code>#include "GNURegex.h"</code><br> <code>#include "<a class="el" href="debug_8h_source.html">debug.h</a>"</code><br> <p> <div class="dynheader"> Include dependency graph for util.cc:</div> <div class="dynsection"> <p><center><img src="util_8cc__incl.png" border="0" usemap="#util.cc_map" alt=""></center> <map name="util.cc_map"> <area shape="rect" id="node3" href="config_8h.html" title="config.h" alt="" coords="5,80,107,107"><area shape="rect" id="node29" href="BaseType_8h.html" title="BaseType.h" alt="" coords="2276,304,2396,331"><area shape="rect" id="node40" href="Error_8h.html" title="Error.h" alt="" coords="1441,453,1532,480"><area shape="rect" id="node70" href="Str_8h.html" title="Str.h" alt="" coords="1321,229,1393,256"><area shape="rect" id="node76" href="Url_8h.html" title="Url.h" alt="" coords="1243,155,1315,181"><area shape="rect" id="node82" href="Sequence_8h.html" title="Sequence.h" alt="" coords="2061,155,2181,181"><area shape="rect" id="node103" href="parser_8h.html" title="parser.h" alt="" coords="1416,155,1517,181"><area shape="rect" id="node106" href="util_8h.html" title="util.h" alt="" coords="2323,80,2403,107"><area shape="rect" id="node167" href="debug_8h.html" title="debug.h" alt="" coords="3627,80,3717,107"><area shape="rect" id="node37" href="InternalErr_8h.html" title="InternalErr.h" alt="" coords="1680,379,1832,405"><area shape="rect" id="node46" href="dods-datatypes_8h.html" title="dods-datatypes.h" alt="" coords="2971,453,3152,480"><area shape="rect" id="node50" href="Marshaller_8h.html" title="Marshaller.h" alt="" coords="2600,379,2741,405"><area shape="rect" id="node58" href="UnMarshaller_8h.html" title="UnMarshaller.h" alt="" coords="2416,379,2576,405"><area shape="rect" id="node64" href="AttrTable_8h.html" title="AttrTable.h" alt="" coords="1957,379,2088,405"><area shape="rect" id="node54" href="DapObj_8h.html" title="DapObj.h" alt="" coords="2445,453,2547,480"><area shape="rect" id="node73" href="dods-limits_8h.html" title="dods-limits.h" alt="" coords="1155,304,1307,331"><area shape="rect" id="node85" href="XDRUtils_8h.html" title="XDRUtils.h" alt="" coords="1699,229,1819,256"><area shape="rect" id="node92" href="Constructor_8h.html" title="Constructor.h" alt="" coords="2045,229,2197,256"><area shape="rect" id="node96" href="ConstraintEvaluator_8h.html" title="ConstraintEvaluator.h" alt="" coords="2877,304,3109,331"><area shape="rect" id="node88" href="xdr-datatypes_8h.html" title="xdr-datatypes.h" alt="" coords="1749,304,1920,331"><area shape="rect" id="node100" href="Clause_8h.html" title="Clause.h" alt="" coords="3053,379,3155,405"><area shape="rect" id="node110" href="Byte_8h.html" title="Byte.h" alt="" coords="2611,229,2691,256"><area shape="rect" id="node115" href="Int16_8h.html" title="Int16.h" alt="" coords="2816,229,2907,256"><area shape="rect" id="node120" href="UInt16_8h.html" title="UInt16.h" alt="" coords="2931,229,3032,256"><area shape="rect" id="node125" href="Int32_8h.html" title="Int32.h" alt="" coords="3056,229,3147,256"><area shape="rect" id="node130" href="UInt32_8h.html" title="UInt32.h" alt="" coords="3171,229,3272,256"><area shape="rect" id="node135" href="Float32_8h.html" title="Float32.h" alt="" coords="3296,229,3408,256"><area shape="rect" id="node140" href="Float64_8h.html" title="Float64.h" alt="" coords="2475,229,2587,256"><area shape="rect" id="node147" href="Array_8h.html" title="Array.h" alt="" coords="1533,229,1624,256"><area shape="rect" id="node152" href="Structure_8h.html" title="Structure.h" alt="" coords="2373,155,2504,181"><area shape="rect" id="node159" href="Grid_8h.html" title="Grid.h" alt="" coords="1765,155,1845,181"></map> </div> <p> <a href="util_8cc_source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Namespaces</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">namespace </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html">libdap</a></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#ffccb78f3a718e01f5fac17b682430d1">libdap::dap_version</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#7edce266869606fc7bb46124f8d63809">libdap::downcase</a> (string &s)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#ed6073fcecd8d82a616f4d2de9a8e591">libdap::file_to_string</a> (FILE *fp)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#f5f0e11f33c1eb25b831c02d65b2a9ee">libdap::is_quoted</a> (const string &s)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#218c76777bb3b1a6088a5d9f431fd3f0">libdap::libdap_name</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a410c0b58527efed5753f9f2da1b9775">libdap::libdap_root</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#3c2e481465a4567eaf6d1f22d84c0ef9">libdap::libdap_version</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#38d9163360ace25ebe5dec96b17039ac">libdap::path_to_filename</a> (string path)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#4b1fc86f3e9e75f967ad66f07962d406">libdap::prune_spaces</a> (const string &name)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#37a24fcba1630ac658ec4c8a902dd92c">libdap::remove_quotes</a> (const string &s)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a865553d4933d667330f305dcb2564b0">libdap::systime</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#fabf64c5d4c1900f1c05ac655895f7ee">libdap::unique_names</a> (vector< BaseType * > l, const string &var_name, const string &type_name, string &msg)</td></tr> <tr><td colspan="2"><div class="groupHeader">Double to string conversion functions</div></td></tr> <tr><td colspan="2"><div class="groupText">Conversions from double to a character representation which gets appended to a string. This function depends on the standard routine sprintf to convert a double to a textual representation which gets appended to the string 'str'.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>num</em> </td><td>The double you wish to append to str.</td></tr> <tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>The string where the textual representation of num will be appended.</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd>void. </dd></dl> <br><br></div></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#385e0e3c04caef28126afb481f4867dd">libdap::append_double_to_string</a> (const double &num, string &str)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#7c3f898946a0ae498f4ca830731cc474">libdap::double_to_string</a> (const double &num)</td></tr> <tr><td colspan="2"><div class="groupHeader">Integer to string conversion functions</div></td></tr> <tr><td colspan="2"><div class="groupText">Fast, safe conversions from long to a character representation which gets appended to a string. This method will take a long value 'val' and it will recursively divide it by 'base' in order to "extract" one by one the digits which compose it; these digits will be <em>appended</em> to the string <code>str_val</code> which will become the textual representation of 'val'. Please notice that the digits ``extracted'' from `val' will vary depending on the base chosen for the conversion; for example val=15 converted to base 10 will yield the digits (1,5), converted to base 16 will yield (F) and converted to base 2 will yield (1,1,1,1).<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>val</em> </td><td>The long value we which to convert to string.</td></tr> <tr><td valign="top"></td><td valign="top"><em>base</em> </td><td>A value in the range [2,36] which is the base to use while transforming the long value 'val' to its textual representation. Typical bases are 2 (binary), 10 (decimal) and 16 (hexadecimal).</td></tr> <tr><td valign="top"></td><td valign="top"><em>str_val</em> </td><td>This is the string that will hold the textual representation of 'val'. The string <code>str_val</code> should be pre-set to an empty string ("") otherwise the output of this function will just append the textual representation of val to whatever data is there; these feature may be useful if you wish to append a long value to a string s1 (just like operator+ does) without having to create a new string object s2 and then use string::operator+ between s1 and s2.</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd>void. This method returns nothing however be aware that it will throw and exception of type <code>std::invalid_argument</code> if the parameter base is not in the valid range. </dd></dl> <br><br></div></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#576580781bca7dcd4b5a84cc06892aff">libdap::append_long_to_string</a> (long val, int base, string &str_val)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#317edea830aab50d2137a5bd313cc86a">libdap::long_to_string</a> (long val, int base)</td></tr> <tr><td colspan="2"><div class="groupHeader">Security functions</div></td></tr> <tr><td colspan="2"><div class="groupText"><br><br></div></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#7c34f89476954f3a2fd0eaa1d1e8cd32">libdap::pathname_ok</a> (const string &path, bool strict)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Does the string name a potentailly valid pathname? Test the given pathname to verfiy that it is a valid name. We define this as: Contains only printable characters; and Is less then 256 characters. If <em>strict</em> is true, test that the pathname consists of only letters, digits, and underscore, dash and dot characters instead of the more general case where a pathname can be composed of any printable characters. <a href="#7c34f89476954f3a2fd0eaa1d1e8cd32"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#d29f8fc547919875e3369fefbf92fb15">libdap::size_ok</a> (uint sz, uint nelem)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">sanitize the size of an array. Test for integer overflow when dynamically allocating an array. <a href="#d29f8fc547919875e3369fefbf92fb15"></a><br></td></tr> </table> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 19:58:18 2009 for libdap++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>