<!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>glibmm 2.4: 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="../../../../gtkmm-2.4/docs/index.html">Main Page</a> <a href="../../../../gtkmm-2.4/docs/reference/html/group__Widgets.html">Widgets</a> <a class="qindex" href="namespaces.html">glibmm Namespaces</a> <a href="../../../../gtkmm-2.4/docs/tutorial/html/index.html"> Book</a> </center> <hr width="100%"/> <!-- begin main content --> <div id="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="nav"> <a class="el" href="namespaceGlib.html">Glib</a>::<a class="el" href="classGlib_1_1Dir.html">Dir</a></div> <h1>Glib::Dir Class Reference<br> <small> [<a class="el" href="group__FileUtils.html">File Utilities</a>]</small> </h1><!-- doxytag: class="Glib::Dir" -->Utility class representing an open directory. <a href="#_details">More...</a> <p> <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 class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#47896460e9d37efc9e93af33e0d1ccf3">iterator</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#87555a3d202abc6535c0479378289c65">const_iterator</a></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#bbcedb96cc9cf9cdfa37ab7164631fe9">Dir</a> (const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>& path)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Opens a directory for reading. <a href="#bbcedb96cc9cf9cdfa37ab7164631fe9"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#8de43168d60f9ffc12842b6d277834de">~Dir</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Closes the directory and deallocates all related resources. <a href="#8de43168d60f9ffc12842b6d277834de"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#0b7540337a31b10b5dd5775a46ff2f43">read_name</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the name of the next entry in the directory. <a href="#0b7540337a31b10b5dd5775a46ff2f43"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#13bc8d04aef36e4c77eb05710096ab26">rewind</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Resets the directory. <a href="#13bc8d04aef36e4c77eb05710096ab26"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#9d648d71ee0ac37f57b478f8d43a3bf9">close</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Closes the directory and deallocates all related resources. <a href="#9d648d71ee0ac37f57b478f8d43a3bf9"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#e5b5900d5f7838b2437f36609c30d7ca">begin</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the begin of an input iterator sequence. <a href="#e5b5900d5f7838b2437f36609c30d7ca"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html#ded8f8cb05e1aed5fb445569c44fff68">end</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the end of an input iterator sequence. <a href="#ded8f8cb05e1aed5fb445569c44fff68"></a><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 class="fragment"> <a class="code" href="classGlib_1_1Dir.html" title="Utility class representing an open directory.">Glib::Dir</a> dir (directory_path); <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1list.html">std::list<std::string></a> entries (dir.begin(), dir.end()); </pre></div> <dl class="note" 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#g6cf95dc00505401594260a360d70c17b" title="Converts a string which is in the encoding used for filenames into a UTF-8 string...">Glib::filename_to_utf8()</a> if you need to display them. </dd></dl> <hr><h2>Member Typedef Documentation</h2> <a class="anchor" name="47896460e9d37efc9e93af33e0d1ccf3"></a><!-- doxytag: member="Glib::Dir::iterator" ref="47896460e9d37efc9e93af33e0d1ccf3" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> <a class="el" href="classGlib_1_1DirIterator.html">Glib::Dir::iterator</a> </td> </tr> </table> </div> <div class="memdoc"> <p> </div> </div><p> <a class="anchor" name="87555a3d202abc6535c0479378289c65"></a><!-- doxytag: member="Glib::Dir::const_iterator" ref="87555a3d202abc6535c0479378289c65" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef <a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> <a class="el" href="classGlib_1_1DirIterator.html">Glib::Dir::const_iterator</a> </td> </tr> </table> </div> <div class="memdoc"> <p> </div> </div><p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="bbcedb96cc9cf9cdfa37ab7164631fe9"></a><!-- doxytag: member="Glib::Dir::Dir" ref="bbcedb96cc9cf9cdfa37ab7164631fe9" args="(const std::string &path)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Glib::Dir::Dir </td> <td>(</td> <td class="paramtype">const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> & </td> <td class="paramname"> <em>path</em> </td> <td> ) </td> <td width="100%"><code> [explicit]</code></td> </tr> </table> </div> <div class="memdoc"> <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#0b7540337a31b10b5dd5775a46ff2f43" title="Retrieves the name of the next entry in the directory.">read_name()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><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"></td><td valign="top"><em><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors.">Glib::FileError</a></em> </td><td></td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="8de43168d60f9ffc12842b6d277834de"></a><!-- doxytag: member="Glib::Dir::~Dir" ref="8de43168d60f9ffc12842b6d277834de" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Glib::Dir::~Dir </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Closes the directory and deallocates all related resources. <p> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="0b7540337a31b10b5dd5775a46ff2f43"></a><!-- doxytag: member="Glib::Dir::read_name" ref="0b7540337a31b10b5dd5775a46ff2f43" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> Glib::Dir::read_name </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Retrieves the name of the next entry in the directory. <p> The <code>'.'</code> and <code>'..'</code> entries are omitted. <dl class="return" compact><dt><b>Returns:</b></dt><dd>The entry's name or <code>""</code> if there are no more entries. </dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classGlib_1_1Dir.html#e5b5900d5f7838b2437f36609c30d7ca" title="Get the begin of an input iterator sequence.">begin()</a>, <a class="el" href="classGlib_1_1Dir.html#ded8f8cb05e1aed5fb445569c44fff68" title="Get the end of an input iterator sequence.">end()</a> </dd></dl> </div> </div><p> <a class="anchor" name="13bc8d04aef36e4c77eb05710096ab26"></a><!-- doxytag: member="Glib::Dir::rewind" ref="13bc8d04aef36e4c77eb05710096ab26" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Glib::Dir::rewind </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Resets the directory. <p> The next call to <a class="el" href="classGlib_1_1Dir.html#0b7540337a31b10b5dd5775a46ff2f43" title="Retrieves the name of the next entry in the directory.">read_name()</a> will return the first entry again. </div> </div><p> <a class="anchor" name="9d648d71ee0ac37f57b478f8d43a3bf9"></a><!-- doxytag: member="Glib::Dir::close" ref="9d648d71ee0ac37f57b478f8d43a3bf9" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Glib::Dir::close </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Closes the directory and deallocates all related resources. <p> Note that <a class="el" href="classGlib_1_1Dir.html#9d648d71ee0ac37f57b478f8d43a3bf9" title="Closes the directory and deallocates all related resources.">close()</a> is implicitely called by <a class="el" href="classGlib_1_1Dir.html#8de43168d60f9ffc12842b6d277834de" title="Closes the directory and deallocates all related resources.">~Dir()</a>. Thus you don't need to call <a class="el" href="classGlib_1_1Dir.html#9d648d71ee0ac37f57b478f8d43a3bf9" title="Closes the directory and deallocates all related resources.">close()</a> yourself unless you want to close the directory before the destructor runs. </div> </div><p> <a class="anchor" name="e5b5900d5f7838b2437f36609c30d7ca"></a><!-- doxytag: member="Glib::Dir::begin" ref="e5b5900d5f7838b2437f36609c30d7ca" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> Glib::Dir::begin </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Get the begin of an input iterator sequence. <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>An input iterator pointing to the first directory entry. </dd></dl> </div> </div><p> <a class="anchor" name="ded8f8cb05e1aed5fb445569c44fff68"></a><!-- doxytag: member="Glib::Dir::end" ref="ded8f8cb05e1aed5fb445569c44fff68" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classGlib_1_1DirIterator.html">DirIterator</a> Glib::Dir::end </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Get the end of an input iterator sequence. <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>An input iterator pointing behind the last directory entry. </dd></dl> </div> </div><p> <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> </div> <!-- end main content --> <hr><address><small> Generated for glibmm 2.4 by <a href="http://www.doxygen.org/index.html"> Doxygen</a> 1.5.3 © 1997-2001</small></address> </body> </html>