<!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>Glib::Dir class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ffffff"> <table border="0" width="100%"> <tr> <td width="10%" height="40"><img src="../../images/gtkmm_logo.gif" alt="logo" border="0" width="100%" height="100%"/></td> <td width="90%" height="40"><img src="../../images/top.gif" alt="top" width="100%" height="40"/></td> </tr> </table> <center> <a class="qindex" href="../../index.html">Main Page</a> <a href="group__Widgets.html">Widgets</a> <a class="qindex" href="namespaces.html"> Namespaces</a> <a href="../../tutorial/html/index.html"> Book</a> </center> <hr width="100%"/> <!-- Generated by Doxygen 1.3-rc1 --> <h1>Glib::Dir Class Reference<br> <small> [<a class="el" href="group__FileUtils.html">File Utilities</a>]</small> </h1>Utility class representing an open directory. <a href="#_details">More...</a> <p> <a href="classGlib_1_1Dir-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td></td></tr> <tr><td colspan=2><br><h2>Public Types</h2></td></tr> <tr><td nowrap align=right valign=top>typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#s0">iterator</a></td></tr> <tr><td nowrap align=right valign=top>typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#s1">const_iterator</a></td></tr> <tr><td colspan=2><br><h2>Public Methods</h2></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a0">Dir</a> (const std::string& path)</td></tr> <tr><td> </td><td><font size=-1><em>Opens a directory for reading.</em> <a href="#a0"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a1">~Dir</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Closes the directory and deallocates all related resources.</em> <a href="#a1"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>std::string </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a2">read_name</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Retrieves the name of the next entry in the directory.</em> <a href="#a2"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a3">rewind</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Resets the directory.</em> <a href="#a3"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a4">close</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Closes the directory and deallocates all related resources.</em> <a href="#a4"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a5">begin</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Get the begin of an input iterator sequence.</em> <a href="#a5"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td valign=bottom><a class="el" href="classGlib_1_1Dir.html#a6">end</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Get the end of an input iterator sequence.</em> <a href="#a6"></a><em></em></font><br><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> Utility class representing an open directory. <p> It's highly recommended to use the iterator interface. With iterators, reading an entire directory into a STL container is really easy: <div class="fragment"><pre> <a class="code" href="classGlib_1_1Dir.html">Glib::Dir</a> dir (directory_path); std::list<std::string> entries (dir.<a class="code" href="classGlib_1_1Dir.html#a5">begin</a>(), dir.<a class="code" href="classGlib_1_1Dir.html#a6">end</a>()); </pre></div><dl compact><dt><b>Note:</b></dt><dd>The encoding of the directory entries isn't necessarily UTF-8. Use <a class="el" href="group__CharsetConv.html#a7">Glib::filename_to_utf8()</a> if you need to display them. </dd></dl> <p> <hr><h2>Member Typedef Documentation</h2> <a name="s1" doxytag="Glib::Dir::const_iterator"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> Glib::Dir::const_iterator </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> </td> </tr> </table> <a name="s0" doxytag="Glib::Dir::iterator"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> Glib::Dir::iterator </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> </td> </tr> </table> <hr><h2>Constructor & Destructor Documentation</h2> <a name="a0" doxytag="Glib::Dir::Dir"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> Glib::Dir::Dir </td> <td class="md" valign="top">(</td> <td class="md" nowrap valign="top">const std::string& </td> <td class="mdname1" valign="top" nowrap> <em>path</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [explicit]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Opens a directory for reading. <p> The names of the files in the directory can then be retrieved using <a class="el" href="classGlib_1_1Dir.html#a2">read_name()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>path</em> </td><td>The path to the directory you are interested in. </td></tr> </table> </dl> <dl compact><dt><b>Exceptions:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>Glib::FileError</em> </td><td></td></tr> </table> </dl> </td> </tr> </table> <a name="a1" doxytag="Glib::Dir::~Dir"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> Glib::Dir::~Dir </td> <td class="md" valign="top">(</td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Closes the directory and deallocates all related resources. <p> </td> </tr> </table> <hr><h2>Member Function Documentation</h2> <a name="a5" doxytag="Glib::Dir::begin"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> Glib::Dir::begin </td> <td class="md" valign="top">(</td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Get the begin of an input iterator sequence. <p> <dl compact><dt><b>Returns:</b></dt><dd>An input iterator pointing to the first directory entry. </dd></dl> </td> </tr> </table> <a name="a4" doxytag="Glib::Dir::close"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void Glib::Dir::close </td> <td class="md" valign="top">(</td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Closes the directory and deallocates all related resources. <p> Note that <a class="el" href="classGlib_1_1Dir.html#a4">close()</a> is implicitely called by <a class="el" href="classGlib_1_1Dir.html#a1">~Dir()</a>. Thus you don't need to call <a class="el" href="classGlib_1_1Dir.html#a4">close()</a> yourself unless you want to close the directory before the destructor runs. </td> </tr> </table> <a name="a6" doxytag="Glib::Dir::end"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> Glib::Dir::end </td> <td class="md" valign="top">(</td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Get the end of an input iterator sequence. <p> <dl compact><dt><b>Returns:</b></dt><dd>An input iterator pointing behind the last directory entry. </dd></dl> </td> </tr> </table> <a name="a2" doxytag="Glib::Dir::read_name"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> std::string Glib::Dir::read_name </td> <td class="md" valign="top">(</td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Retrieves the name of the next entry in the directory. <p> The <code>'.'</code> and <code>'..'</code> entries are omitted. <dl compact><dt><b>Returns:</b></dt><dd>The entry's name or <code>""</code> if there are no more entries. </dd></dl> <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classGlib_1_1Dir.html#a5">begin()</a>, <a class="el" href="classGlib_1_1Dir.html#a6">end()</a> </dd></dl> </td> </tr> </table> <a name="a3" doxytag="Glib::Dir::rewind"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void Glib::Dir::rewind </td> <td class="md" valign="top">(</td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Resets the directory. <p> The next call to <a class="el" href="classGlib_1_1Dir.html#a2">read_name()</a> will return the first entry again. </td> </tr> </table> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="fileutils_8h.html">fileutils.h</a></ul> <hr><address><small> Generated for gtkmm by <a href="http://www.doxygen.org/index.html"> Doxygen</a> 1.3-rc1 © 1997-2001</small></address> </body> </html>