Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > 3b996fe272685bfa229e6a8dcb542001 > files > 996

glibmm2.4-doc-2.60.0-1.mga7.noarch.rpm

<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>glibmm: File Utilities</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">glibmm
   &#160;<span id="projectnumber">2.60.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">File Utilities</div>  </div>
</div><!--header-->
<div class="contents">

<p>Various file-related classes and functions.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1FileError.html">Glib::FileError</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exception class for file-related errors.  <a href="classGlib_1_1FileError.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1DirIterator.html">Glib::DirIterator</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The iterator type of <a class="el" href="classGlib_1_1Dir.html" title="Utility class representing an open directory. ">Glib::Dir</a>.  <a href="classGlib_1_1DirIterator.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html">Glib::Dir</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility class representing an open directory.  <a href="classGlib_1_1Dir.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga0b2fce78896a9a84f7ea3a5646cc7d36"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#ga0b2fce78896a9a84f7ea3a5646cc7d36">Glib::file_test</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; filename, FileTest test)</td></tr>
<tr class="memdesc:ga0b2fce78896a9a84f7ea3a5646cc7d36"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns <code>true</code> if any of the tests in the bitfield <em>test</em> are true.  <a href="group__FileUtils.html#ga0b2fce78896a9a84f7ea3a5646cc7d36">More...</a><br /></td></tr>
<tr class="separator:ga0b2fce78896a9a84f7ea3a5646cc7d36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae4c8d716bd109b6b8e1420a8c20b3507"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#gae4c8d716bd109b6b8e1420a8c20b3507">Glib::mkstemp</a> (<a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; filename_template)</td></tr>
<tr class="memdesc:gae4c8d716bd109b6b8e1420a8c20b3507"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens a temporary file.  <a href="group__FileUtils.html#gae4c8d716bd109b6b8e1420a8c20b3507">More...</a><br /></td></tr>
<tr class="separator:gae4c8d716bd109b6b8e1420a8c20b3507"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae91f239f1cf0123399374deed54fbf3a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#gae91f239f1cf0123399374deed54fbf3a">Glib::file_open_tmp</a> (<a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; name_used, const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; prefix)</td></tr>
<tr class="memdesc:gae91f239f1cf0123399374deed54fbf3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gac42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files. ">Glib::get_tmp_dir()</a>).  <a href="group__FileUtils.html#gae91f239f1cf0123399374deed54fbf3a">More...</a><br /></td></tr>
<tr class="separator:gae91f239f1cf0123399374deed54fbf3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga682379de4ea119540b4bdc1759e93e1d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#ga682379de4ea119540b4bdc1759e93e1d">Glib::file_open_tmp</a> (<a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; name_used)</td></tr>
<tr class="memdesc:ga682379de4ea119540b4bdc1759e93e1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gac42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files. ">Glib::get_tmp_dir()</a>).  <a href="group__FileUtils.html#ga682379de4ea119540b4bdc1759e93e1d">More...</a><br /></td></tr>
<tr class="separator:ga682379de4ea119540b4bdc1759e93e1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga835da54212fe78e833ac55b49150b989"><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#ga835da54212fe78e833ac55b49150b989">Glib::file_get_contents</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; filename)</td></tr>
<tr class="memdesc:ga835da54212fe78e833ac55b49150b989"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads an entire file into a string, with good error checking.  <a href="group__FileUtils.html#ga835da54212fe78e833ac55b49150b989">More...</a><br /></td></tr>
<tr class="separator:ga835da54212fe78e833ac55b49150b989"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Various file-related classes and functions. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga835da54212fe78e833ac55b49150b989"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> Glib::file_get_contents </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads an entire file into a string, with good error checking. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>A file to read contents from. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The file contents. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors. ">Glib::FileError</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="gae91f239f1cf0123399374deed54fbf3a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::file_open_tmp </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>name_used</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>prefix</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gac42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files. ">Glib::get_tmp_dir()</a>). </p>
<p><em>prefix</em> should a basename template; it'll be suffixed by 6 characters in order to form a unique filename. No directory components are allowed.</p>
<p>The actual name used is returned in <em>name_used</em>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">name_used</td><td>The actual name used. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">prefix</td><td>Template for file name, basename only. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A file handle (as from <code>open()</code>) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with <code>close()</code>. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors. ">Glib::FileError</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga682379de4ea119540b4bdc1759e93e1d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::file_open_tmp </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>name_used</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gac42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files. ">Glib::get_tmp_dir()</a>). </p>
<p>This function works like <a class="el" href="group__FileUtils.html#gae91f239f1cf0123399374deed54fbf3a" title="Opens a file for writing in the preferred directory for temporary files (as returned by Glib::get_tmp...">file_open_tmp(std::string&amp;, const std::string&amp;)</a> but uses a default basename prefix.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">name_used</td><td>The actual name used. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A file handle (as from <code>open()</code>) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with <code>close()</code>. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors. ">Glib::FileError</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga0b2fce78896a9a84f7ea3a5646cc7d36"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Glib::file_test </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#ga33c24ccefbd130021f06708763e16ef2">FileTest</a>&#160;</td>
          <td class="paramname"><em>test</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns <code>true</code> if any of the tests in the bitfield <em>test</em> are true. </p>
<p>For example, <code>(<a class="el" href="namespaceGlib.html#ga33c24ccefbd130021f06708763e16ef2aa6cf22c3904f707c94f2ad911b5df6fd" title="true if the file exists. ">Glib::FILE_TEST_EXISTS</a> | <a class="el" href="namespaceGlib.html#ga33c24ccefbd130021f06708763e16ef2ae4072d5338587b51642d1a68c730ec19" title="true if the file is a directory. ">Glib::FILE_TEST_IS_DIR</a>)</code> will return <code>true</code> if the file exists; the check whether it's a directory doesn't matter since the existence test is true. With the current set of available tests, there's no point passing in more than one test at a time.</p>
<p>Apart from <code><a class="el" href="namespaceGlib.html#ga33c24ccefbd130021f06708763e16ef2ae9fcdfcc6fc6ee7bb83ce9634e5e9f18" title="true if the file is a symlink. ">Glib::FILE_TEST_IS_SYMLINK</a></code> all tests follow symbolic links, so for a symbolic link to a regular file <a class="el" href="group__FileUtils.html#ga0b2fce78896a9a84f7ea3a5646cc7d36" title="Returns true if any of the tests in the bitfield test are true. ">file_test()</a> will return <code>true</code> for both <code><a class="el" href="namespaceGlib.html#ga33c24ccefbd130021f06708763e16ef2ae9fcdfcc6fc6ee7bb83ce9634e5e9f18" title="true if the file is a symlink. ">Glib::FILE_TEST_IS_SYMLINK</a></code> and <code><a class="el" href="namespaceGlib.html#ga33c24ccefbd130021f06708763e16ef2ad7bb008269376841fe11c05da9c01a55" title="true if the file is a regular file (not a directory). ">Glib::FILE_TEST_IS_REGULAR</a></code>.</p>
<dl class="section note"><dt>Note</dt><dd>For a dangling symbolic link <a class="el" href="group__FileUtils.html#ga0b2fce78896a9a84f7ea3a5646cc7d36" title="Returns true if any of the tests in the bitfield test are true. ">file_test()</a> will return <code>true</code> for <code><a class="el" href="namespaceGlib.html#ga33c24ccefbd130021f06708763e16ef2ae9fcdfcc6fc6ee7bb83ce9634e5e9f18" title="true if the file is a symlink. ">Glib::FILE_TEST_IS_SYMLINK</a></code> and <code>false</code> for all other flags.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>A filename to test. </td></tr>
    <tr><td class="paramname">test</td><td>Bitfield of <a class="el" href="group__glibmmEnums.html#ga33c24ccefbd130021f06708763e16ef2" title="A test to perform on a file using g_file_test(). ">Glib::FileTest</a> flags. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Whether a test was true. </dd></dl>

</div>
</div>
<a class="anchor" id="gae4c8d716bd109b6b8e1420a8c20b3507"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::mkstemp </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01512.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>filename_template</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Opens a temporary file. </p>
<p>See the mkstemp() documentation on most UNIX-like systems. This is a portability wrapper, which simply calls mkstemp() on systems that have it, and implements it in GLib otherwise. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename_template</td><td>A string that should match the rules for mkstemp(), i.e. end in <code>"XXXXXX"</code>. The <code>X</code> string will be modified to form the name of a file that didn't exist. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, <code>-1</code> is returned. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Mar 19 2019 09:56:38 for glibmm by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>