<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: csutil/util.h File Reference (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <h1>csutil/util.h File Reference</h1>Miscellaneous utilities. <a href="#_details">More...</a> <p> <code>#include <stdio.h></code><br> <code>#include "csextern.h"</code><br> <code>#include "<a class="el" href="csunicode_8h-source.html">csutil/csunicode.h</a>"</code><br> <p> <a href="util_8h-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="namespaceCS.html">CS</a></td></tr> <tr><td colspan="2"><br><h2>Classes</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structcsCtoW.html">csCtoW</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Helper class to convert char* (UTF-8 encoded )to wchar_t* strings for use as function parameters. <a href="structcsCtoW.html#_details">More...</a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structcsWtoC.html">csWtoC</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Helper class to convert wchar_t* to char* (UTF-8 encoded) strings for use as function parameters. <a href="structcsWtoC.html#_details">More...</a><br></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ga437c89b1107aa2ead839931b5f72ddd">csExpandName</a> (const char *iName)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Expand a filename if it contains shortcuts. <a href="group__util.html#ga437c89b1107aa2ead839931b5f72ddd"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ge54904d35bd5deee0f65e854cb14a205">csFindNearestPowerOf2</a> (int n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Finds the smallest number that is a power of two and is larger or equal to n. <a href="group__util.html#ge54904d35bd5deee0f65e854cb14a205"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gfc99af7265cc5d08f7624eae45c44d9e">csGlobMatches</a> (const char *fName, const char *fMask)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Perform shell-like filename <em>globbing</em> (pattern matching). <a href="group__util.html#gfc99af7265cc5d08f7624eae45c44d9e"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ga8b9766fe4cf58b75ced0a981bf50d4d">csIsPowerOf2</a> (int n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if n is a power of two. <a href="group__util.html#ga8b9766fe4cf58b75ced0a981bf50d4d"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gfbc5586ec15e063666bea048baeeff2d">csLog2</a> (int n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Find the log2 of 32bit argument. <a href="group__util.html#gfbc5586ec15e063666bea048baeeff2d"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gce48c6c345114d83048c3f6b3623584e">csReplaceAll</a> (char *dest, const char *src, const char *search, const char *replace, int max)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Given <code>src</code> and <code>dest</code>, which are already allocated, copy <code>source</code> to <code>dest</code>. <a href="group__util.html#gce48c6c345114d83048c3f6b3623584e"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#ge0a6483b3739029bdf5ba7de15ef8e1c">csSplitPath</a> (const char *iPathName, char *oPath, size_t iPathSize, char *oName, size_t iNameSize)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Split a pathname into separate path and name. <a href="group__util.html#ge0a6483b3739029bdf5ba7de15ef8e1c"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gd3b337b96b8bafe9b27b4cf683d85fdb">csStrCaseCmp</a> (char const *str1, char const *str2)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Perform case-insensitive string comparison. <a href="group__util.html#gd3b337b96b8bafe9b27b4cf683d85fdb"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g4661a6ce9f5b3c79f468611c69256a0b">csStrNCaseCmp</a> (char const *str1, char const *str2, size_t n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Perform case-insensitive string comparison of the first <code>n</code> characters of <code>str1</code> and <code>str2</code>. <a href="group__util.html#g4661a6ce9f5b3c79f468611c69256a0b"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g00c9036151cf0777ff9d95f6cf8684d7">csStrNew</a> (const <a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a new char [] and copy an UTF-8 version of the string into the newly allocated storage. <a href="group__util.html#g00c9036151cf0777ff9d95f6cf8684d7"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#gc3a6e34ea28a22fdeda8802c872ce2d0">csStrNew</a> (const char *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a new char [] and copy the string into the newly allocated storage. <a href="group__util.html#gc3a6e34ea28a22fdeda8802c872ce2d0"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g85aedc4b9b1eac350ee5062d2ca17ad9">csStrNewW</a> (const char *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a new widechar [] and copy the string converted from UTF-8 into the newly allocated storage. <a href="group__util.html#g85aedc4b9b1eac350ee5062d2ca17ad9"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__util.html#g2ace23f21519843f0649595f9bb05793">csStrNewW</a> (const <a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a new widechar [] and copy the string into the newly allocated storage. <a href="group__util.html#g2ace23f21519843f0649595f9bb05793"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCS.html#19f5a5d4c1265c3ba98aa85ec1f1d81f">CS::StrDup</a> (const <a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a char string with <a class="el" href="cssysdef_8h.html#bcc451ff5f6451f8b8bcbe91c762bcf0">cs_malloc()</a> and copy an UTF-8 version of the string into the newly allocated storage. <a href="#19f5a5d4c1265c3ba98aa85ec1f1d81f"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCS.html#77fba057e7351adb82ced35e32e5e2d4">CS::StrDup</a> (const char *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a char string with <a class="el" href="cssysdef_8h.html#bcc451ff5f6451f8b8bcbe91c762bcf0">cs_malloc()</a> and copy the string into the newly allocated storage. <a href="#77fba057e7351adb82ced35e32e5e2d4"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCS.html#a791ab7a63ad9497777da29be3589741">CS::StrDupW</a> (const char *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a wide char string with <a class="el" href="cssysdef_8h.html#bcc451ff5f6451f8b8bcbe91c762bcf0">cs_malloc()</a> and copy the string converted from UTF-8 into the newly allocated storage. <a href="#a791ab7a63ad9497777da29be3589741"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCS.html#2a255ea1bc67ebee680069a791b1c610">CS::StrDupW</a> (const <a class="el" href="group__util.html#g43124e776b499fd41c598b2f6d210242">wchar_t</a> *s)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a wide char string with <a class="el" href="cssysdef_8h.html#bcc451ff5f6451f8b8bcbe91c762bcf0">cs_malloc()</a> and copy the string into the newly allocated storage. <a href="#2a255ea1bc67ebee680069a791b1c610"></a><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> Miscellaneous utilities. <p> <p>Definition in file <a class="el" href="util_8h-source.html">util.h</a>.</p> <hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>