<!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>libdap++: util.cc File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <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">libdap++ <span id="projectnumber">Updated for version 3.8.2</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="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 id="navrow2" class="tabs2"> <ul class="tablist"> <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 id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('util_8cc.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#namespaces">Namespaces</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>util.cc File Reference</h1> </div> </div> <div class="contents"> <div class="textblock"><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/> </div><div class="textblock"><div class="dynheader"> Include dependency graph for util.cc:</div> <div class="dyncontent"> <div class="center"><img src="util_8cc__incl.png" border="0" usemap="#util_8cc" alt=""/></div> <map name="util_8cc" id="util_8cc"> <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="1941,453,2064,480"/><area shape="rect" id="node41" href="Error_8h.html" title="Error.h" alt="" coords="3077,603,3168,629"/><area shape="rect" id="node75" href="Str_8h.html" title="Str.h" alt="" coords="1175,379,1247,405"/><area shape="rect" id="node81" href="Url_8h.html" title="Url.h" alt="" coords="1248,304,1320,331"/><area shape="rect" id="node87" href="Sequence_8h.html" title="Sequence.h" alt="" coords="2765,80,2888,107"/><area shape="rect" id="node141" href="parser_8h.html" title="parser.h" alt="" coords="3399,155,3500,181"/><area shape="rect" id="node144" href="util_8h.html" title="util.h" alt="" coords="1449,379,1532,405"/><area shape="rect" id="node151" href="debug_8h.html" title="debug.h" alt="" coords="3883,80,3973,107"/><area shape="rect" id="node37" href="AttrTable_8h.html" title="AttrTable.h" alt="" coords="2195,528,2325,555"/><area shape="rect" id="node47" href="DapObj_8h.html" title="DapObj.h" alt="" coords="2075,603,2176,629"/><area shape="rect" id="node54" href="InternalErr_8h.html" title="InternalErr.h" alt="" coords="2349,528,2501,555"/><area shape="rect" id="node58" href="dods-datatypes_8h.html" title="dods-datatypes.h" alt="" coords="1681,603,1863,629"/><area shape="rect" id="node63" href="Marshaller_8h.html" title="Marshaller.h" alt="" coords="1877,528,2019,555"/><area shape="rect" id="node69" href="UnMarshaller_8h.html" title="UnMarshaller.h" alt="" coords="1691,528,1853,555"/><area shape="rect" id="node50" href="DapIndent_8h.html" title="DapIndent.h" alt="" coords="2325,677,2456,704"/><area shape="rect" id="node78" href="dods-limits_8h.html" title="dods-limits.h" alt="" coords="1160,453,1312,480"/><area shape="rect" id="node91" href="Constructor_8h.html" title="Constructor.h" alt="" coords="1699,379,1851,405"/><area shape="rect" id="node95" href="ConstraintEvaluator_8h.html" title="ConstraintEvaluator.h" alt="" coords="2619,155,2851,181"/><area shape="rect" id="node128" href="XDRUtils_8h.html" title="XDRUtils.h" alt="" coords="3176,379,3299,405"/><area shape="rect" id="node99" href="DDS_8h.html" title="DDS.h" alt="" coords="2475,304,2547,331"/><area shape="rect" id="node117" href="DataDDS_8h.html" title="DataDDS.h" alt="" coords="2548,229,2660,256"/><area shape="rect" id="node122" href="Clause_8h.html" title="Clause.h" alt="" coords="2684,229,2785,256"/><area shape="rect" id="node107" href="BaseTypeFactory_8h.html" title="BaseTypeFactory.h" alt="" coords="2531,677,2723,704"/><area shape="rect" id="node110" href="DAS_8h.html" title="DAS.h" alt="" coords="2773,453,2845,480"/><area shape="rect" id="node126" href="RValue_8h.html" title="RValue.h" alt="" coords="2779,304,2880,331"/><area shape="rect" id="node131" href="xdr-datatypes_8h.html" title="xdr-datatypes.h" alt="" coords="3199,453,3369,480"/></map> </div> </div> <p><a href="util_8cc_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="namespaces"></a> Namespaces</h2></td></tr> <tr><td class="memItemLeft" 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"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#affccb78f3a718e01f5fac17b682430d1">libdap::dap_version</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a7edce266869606fc7bb46124f8d63809">libdap::downcase</a> (string &s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#aed6073fcecd8d82a616f4d2de9a8e591">libdap::file_to_string</a> (FILE *fp)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#af5f0e11f33c1eb25b831c02d65b2a9ee">libdap::is_quoted</a> (const string &s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a218c76777bb3b1a6088a5d9f431fd3f0">libdap::libdap_name</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#aa410c0b58527efed5753f9f2da1b9775">libdap::libdap_root</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a3c2e481465a4567eaf6d1f22d84c0ef9">libdap::libdap_version</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a38d9163360ace25ebe5dec96b17039ac">libdap::path_to_filename</a> (string path)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a4b1fc86f3e9e75f967ad66f07962d406">libdap::prune_spaces</a> (const string &name)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a37a24fcba1630ac658ec4c8a902dd92c">libdap::remove_quotes</a> (const string &s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#aa865553d4933d667330f305dcb2564b0">libdap::systime</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#afabf64c5d4c1900f1c05ac655895f7ee">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">Integer to string conversion functions</div></td></tr> <tr><td colspan="2"><div class="groupText"><p>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><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">val</td><td>The long value we which to convert to string.</td></tr> <tr><td class="paramname">base</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 class="paramname">str_val</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> </dd> </dl> <dl class="return"><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> </div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a576580781bca7dcd4b5a84cc06892aff">libdap::append_long_to_string</a> (long val, int base, string &str_val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a317edea830aab50d2137a5bd313cc86a">libdap::long_to_string</a> (long val, int base)</td></tr> <tr><td colspan="2"><div class="groupHeader">Double to string conversion functions</div></td></tr> <tr><td colspan="2"><div class="groupText"><p>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><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">num</td><td>The double you wish to append to str.</td></tr> <tr><td class="paramname">str</td><td>The string where the textual representation of num will be appended.</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>void. </dd></dl> </div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a385e0e3c04caef28126afb481f4867dd">libdap::append_double_to_string</a> (const double &num, string &str)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a7c3f898946a0ae498f4ca830731cc474">libdap::double_to_string</a> (const double &num)</td></tr> <tr><td colspan="2"><div class="groupHeader">Security functions</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a36c4fc80766718669c9790c6cb20c895">libdap::size_ok</a> (unsigned int sz, unsigned int 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="#a36c4fc80766718669c9790c6cb20c895"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacelibdap.html#a7c34f89476954f3a2fd0eaa1d1e8cd32">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="#a7c34f89476954f3a2fd0eaa1d1e8cd32"></a><br/></td></tr> </table> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="util_8cc.html">util.cc</a> </li> <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>