<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qfileinfo.cpp:52 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>TQFileInfo Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQFileInfo Class Reference</h1> <p>The TQFileInfo class provides system-independent file information. <a href="#details">More...</a> <p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p> <p><tt>#include <<a href="qfileinfo-h.html">qfileinfo.h</a>></tt> <p><a href="qfileinfo-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn>enum <a href="#PermissionSpec-enum"><b>PermissionSpec</b></a> { ReadOwner = 04000, WriteOwner = 02000, ExeOwner = 01000, ReadUser = 00400, WriteUser = 00200, ExeUser = 00100, ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010, ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 }</li> <li class=fn><a href="#TQFileInfo"><b>TQFileInfo</b></a> ()</li> <li class=fn><a href="#TQFileInfo-2"><b>TQFileInfo</b></a> ( const TQString & file )</li> <li class=fn><a href="#TQFileInfo-3"><b>TQFileInfo</b></a> ( const TQFile & file )</li> <li class=fn><a href="#TQFileInfo-4"><b>TQFileInfo</b></a> ( const TQDir & d, const TQString & fileName )</li> <li class=fn><a href="#TQFileInfo-5"><b>TQFileInfo</b></a> ( const TQFileInfo & fi )</li> <li class=fn><a href="#~TQFileInfo"><b>~TQFileInfo</b></a> ()</li> <li class=fn>TQFileInfo & <a href="#operator-eq"><b>operator=</b></a> ( const TQFileInfo & fi )</li> <li class=fn>void <a href="#setFile"><b>setFile</b></a> ( const TQString & file )</li> <li class=fn>void <a href="#setFile-2"><b>setFile</b></a> ( const TQFile & file )</li> <li class=fn>void <a href="#setFile-3"><b>setFile</b></a> ( const TQDir & d, const TQString & fileName )</li> <li class=fn>bool <a href="#exists"><b>exists</b></a> () const</li> <li class=fn>void <a href="#refresh"><b>refresh</b></a> () const</li> <li class=fn>bool <a href="#caching"><b>caching</b></a> () const</li> <li class=fn>void <a href="#setCaching"><b>setCaching</b></a> ( bool enable )</li> <li class=fn>TQString <a href="#filePath"><b>filePath</b></a> () const</li> <li class=fn>TQString <a href="#fileName"><b>fileName</b></a> () const</li> <li class=fn>TQString <a href="#absFilePath"><b>absFilePath</b></a> () const</li> <li class=fn>TQString <a href="#baseName"><b>baseName</b></a> ( bool complete = FALSE ) const</li> <li class=fn>TQString <a href="#extension"><b>extension</b></a> ( bool complete = TRUE ) const</li> <li class=fn>TQString <a href="#dirPath"><b>dirPath</b></a> ( bool absPath = FALSE ) const</li> <li class=fn>TQDir <a href="#dir"><b>dir</b></a> ( bool absPath = FALSE ) const</li> <li class=fn>bool <a href="#isReadable"><b>isReadable</b></a> () const</li> <li class=fn>bool <a href="#isWritable"><b>isWritable</b></a> () const</li> <li class=fn>bool <a href="#isExecutable"><b>isExecutable</b></a> () const</li> <li class=fn>bool <a href="#isHidden"><b>isHidden</b></a> () const</li> <li class=fn>bool <a href="#isRelative"><b>isRelative</b></a> () const</li> <li class=fn>bool <a href="#convertToAbs"><b>convertToAbs</b></a> ()</li> <li class=fn>bool <a href="#isFile"><b>isFile</b></a> () const</li> <li class=fn>bool <a href="#isDir"><b>isDir</b></a> () const</li> <li class=fn>bool <a href="#isSymLink"><b>isSymLink</b></a> () const</li> <li class=fn>TQString <a href="#readLink"><b>readLink</b></a> () const</li> <li class=fn>TQString <a href="#owner"><b>owner</b></a> () const</li> <li class=fn>uint <a href="#ownerId"><b>ownerId</b></a> () const</li> <li class=fn>TQString <a href="#group"><b>group</b></a> () const</li> <li class=fn>uint <a href="#groupId"><b>groupId</b></a> () const</li> <li class=fn>bool <a href="#permission"><b>permission</b></a> ( int permissionSpec ) const</li> <li class=fn>uint <a href="#size"><b>size</b></a> () const</li> <li class=fn>TQDateTime <a href="#created"><b>created</b></a> () const</li> <li class=fn>TQDateTime <a href="#lastModified"><b>lastModified</b></a> () const</li> <li class=fn>TQDateTime <a href="#lastRead"><b>lastRead</b></a> () const</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The TQFileInfo class provides system-independent file information. <p> <p> TQFileInfo provides information about a file's name and position (path) in the file system, its access rights and whether it is a directory or symbolic link, etc. The file's size and last modified/read times are also available. <p> A TQFileInfo can point to a file with either a relative or an absolute file path. Absolute file paths begin with the directory separator "/" (or with a drive specification on Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current working directory. An example of an absolute path is the string "/tmp/quartz". A relative path might look like "src/fatlib". You can use the function <a href="#isRelative">isRelative</a>() to check whether a TQFileInfo is using a relative or an absolute file path. You can call the function <a href="#convertToAbs">convertToAbs</a>() to convert a relative TQFileInfo's path to an absolute path. <p> The file that the TQFileInfo works on is set in the constructor or later with <a href="#setFile">setFile</a>(). Use <a href="#exists">exists</a>() to see if the file exists and <a href="#size">size</a>() to get its size. <p> To speed up performance, TQFileInfo caches information about the file. Because files can be changed by other users or programs, or even by other parts of the same program, there is a function that refreshes the file information: <a href="#refresh">refresh</a>(). If you want to switch off a TQFileInfo's caching and force it to access the file system every time you request information from it call <a href="#setCaching">setCaching</a>(FALSE). <p> The file's type is obtained with <a href="#isFile">isFile</a>(), <a href="#isDir">isDir</a>() and <a href="#isSymLink">isSymLink</a>(). The <a href="#readLink">readLink</a>() function provides the name of the file the symlink points to. <p> Elements of the file's name can be extracted with <a href="#dirPath">dirPath</a>() and <a href="#fileName">fileName</a>(). The fileName()'s parts can be extracted with <a href="#baseName">baseName</a>() and <a href="#extension">extension</a>(). <p> The file's dates are returned by <a href="#created">created</a>(), <a href="#lastModified">lastModified</a>() and <a href="#lastRead">lastRead</a>(). Information about the file's access permissions is obtained with <a href="#isReadable">isReadable</a>(), <a href="#isWritable">isWritable</a>() and <a href="#isExecutable">isExecutable</a>(). The file's ownership is available from <a href="#owner">owner</a>(), <a href="#ownerId">ownerId</a>(), <a href="#group">group</a>() and <a href="#groupId">groupId</a>(). You can examine a file's permissions and ownership in a single statement using the <a href="#permission">permission</a>() function. <p> If you need to read and traverse directories, see the <a href="qdir.html">TQDir</a> class. <p>See also <a href="io.html">Input/Output and Networking</a>. <hr><h2>Member Type Documentation</h2> <h3 class=fn><a name="PermissionSpec-enum"></a>TQFileInfo::PermissionSpec</h3> <p> This enum is used by the <a href="#permission">permission</a>() function to report the permissions and ownership of a file. The values may be OR-ed together to test multiple permissions and ownership values. <ul> <li><tt>TQFileInfo::ReadOwner</tt> - The file is readable by the owner of the file. <li><tt>TQFileInfo::WriteOwner</tt> - The file is writable by the owner of the file. <li><tt>TQFileInfo::ExeOwner</tt> - The file is executable by the owner of the file. <li><tt>TQFileInfo::ReadUser</tt> - The file is readable by the user. <li><tt>TQFileInfo::WriteUser</tt> - The file is writable by the user. <li><tt>TQFileInfo::ExeUser</tt> - The file is executable by the user. <li><tt>TQFileInfo::ReadGroup</tt> - The file is readable by the group. <li><tt>TQFileInfo::WriteGroup</tt> - The file is writable by the group. <li><tt>TQFileInfo::ExeGroup</tt> - The file is executable by the group. <li><tt>TQFileInfo::ReadOther</tt> - The file is readable by anyone. <li><tt>TQFileInfo::WriteOther</tt> - The file is writable by anyone. <li><tt>TQFileInfo::ExeOther</tt> - The file is executable by anyone. </ul><p> <b>Warning:</b> The semantics of <a href="#PermissionSpec-enum">ReadUser</a>, <a href="#PermissionSpec-enum">WriteUser</a> and <a href="#PermissionSpec-enum">ExeUser</a> are unfortunately not platform independent: on Unix, the rights of the owner of the file are returned and on Windows the rights of the current user are returned. This behavior might change in a future TQt version. If you want to find the rights of the owner of the file, you should use the flags <a href="#PermissionSpec-enum">ReadOwner</a>, <a href="#PermissionSpec-enum">WriteOwner</a> and <a href="#PermissionSpec-enum">ExeOwner</a>. If you want to find out the rights of the current user, you should use <a href="#isReadable">isReadable</a>(), <a href="#isWritable">isWritable</a>() and <a href="#isExecutable">isExecutable</a>(). <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="TQFileInfo"></a>TQFileInfo::TQFileInfo () </h3> Constructs a new empty TQFileInfo. <h3 class=fn><a name="TQFileInfo-2"></a>TQFileInfo::TQFileInfo ( const <a href="qstring.html">TQString</a> & file ) </h3> Constructs a new TQFileInfo that gives information about the given file. The <em>file</em> can also include an absolute or relative path. <p> <b>Warning:</b> Some functions might behave in a counter-intuitive way if <em>file</em> has a trailing directory separator. <p> <p>See also <a href="#setFile">setFile</a>(), <a href="#isRelative">isRelative</a>(), <a href="qdir.html#setCurrent">TQDir::setCurrent</a>(), and <a href="qdir.html#isRelativePath">TQDir::isRelativePath</a>(). <h3 class=fn><a name="TQFileInfo-3"></a>TQFileInfo::TQFileInfo ( const <a href="qfile.html">TQFile</a> & file ) </h3> Constructs a new TQFileInfo that gives information about file <em>file</em>. <p> If the <em>file</em> has a relative path, the TQFileInfo will also have a relative path. <p> <p>See also <a href="#isRelative">isRelative</a>(). <h3 class=fn><a name="TQFileInfo-4"></a>TQFileInfo::TQFileInfo ( const <a href="qdir.html">TQDir</a> & d, const <a href="qstring.html">TQString</a> & fileName ) </h3> Constructs a new TQFileInfo that gives information about the file called <em>fileName</em> in the directory <em>d</em>. <p> If <em>d</em> has a relative path, the TQFileInfo will also have a relative path. <p> <p>See also <a href="#isRelative">isRelative</a>(). <h3 class=fn><a name="TQFileInfo-5"></a>TQFileInfo::TQFileInfo ( const <a href="qfileinfo.html">TQFileInfo</a> & fi ) </h3> Constructs a new TQFileInfo that is a copy of <em>fi</em>. <h3 class=fn><a name="~TQFileInfo"></a>TQFileInfo::~TQFileInfo () </h3> Destroys the TQFileInfo and frees its resources. <h3 class=fn><a href="qstring.html">TQString</a> <a name="absFilePath"></a>TQFileInfo::absFilePath () const </h3> Returns the absolute path including the file name. <p> The absolute path name consists of the full path and the file name. On Unix this will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'. <p> This function returns the same as <a href="#filePath">filePath</a>(), unless <a href="#isRelative">isRelative</a>() is TRUE. <p> If the TQFileInfo is empty it returns <a href="qdir.html#currentDirPath">TQDir::currentDirPath</a>(). <p> This function can be time consuming under Unix (in the order of milliseconds). <p> <p>See also <a href="#isRelative">isRelative</a>() and <a href="#filePath">filePath</a>(). <p>Examples: <a href="biff-example.html#x1954">biff/biff.cpp</a> and <a href="fileiconview-example.html#x820">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="qstring.html">TQString</a> <a name="baseName"></a>TQFileInfo::baseName ( bool complete = FALSE ) const </h3> Returns the base name of the file. <p> If <em>complete</em> is FALSE (the default) the base name consists of all characters in the file name up to (but not including) the <em>first</em> '.' character. <p> If <em>complete</em> is TRUE the base name consists of all characters in the file up to (but not including) the <em>last</em> '.' character. <p> The path is not included in either case. <p> Example: <pre> TQFileInfo fi( "/tmp/archive.tar.gz" ); <a href="qstring.html">TQString</a> base = fi.<a href="#baseName">baseName</a>(); // base = "archive" base = fi.<a href="#baseName">baseName</a>( TRUE ); // base = "archive.tar" </pre> <p> <p>See also <a href="#fileName">fileName</a>() and <a href="#extension">extension</a>(). <h3 class=fn>bool <a name="caching"></a>TQFileInfo::caching () const </h3> <p> Returns TRUE if caching is enabled; otherwise returns FALSE. <p> <p>See also <a href="#setCaching">setCaching</a>() and <a href="#refresh">refresh</a>(). <h3 class=fn>bool <a name="convertToAbs"></a>TQFileInfo::convertToAbs () </h3> Converts the file's path to an absolute path. <p> If it is already absolute, nothing is done. <p> <p>See also <a href="#filePath">filePath</a>() and <a href="#isRelative">isRelative</a>(). <h3 class=fn><a href="qdatetime.html">TQDateTime</a> <a name="created"></a>TQFileInfo::created () const </h3> Returns the date and time when the file was created. <p> On platforms where this information is not available, returns the same as <a href="#lastModified">lastModified</a>(). <p> <p>See also <a href="#lastModified">lastModified</a>() and <a href="#lastRead">lastRead</a>(). <h3 class=fn><a href="qdir.html">TQDir</a> <a name="dir"></a>TQFileInfo::dir ( bool absPath = FALSE ) const </h3> Returns the file's path as a <a href="qdir.html">TQDir</a> object. <p> If the TQFileInfo is relative and <em>absPath</em> is FALSE, the TQDir will be relative; otherwise it will be absolute. <p> <p>See also <a href="#dirPath">dirPath</a>(), <a href="#filePath">filePath</a>(), <a href="#fileName">fileName</a>(), and <a href="#isRelative">isRelative</a>(). <p>Example: <a href="fileiconview-example.html#x821">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="qstring.html">TQString</a> <a name="dirPath"></a>TQFileInfo::dirPath ( bool absPath = FALSE ) const </h3> Returns the file's path. <p> If <em>absPath</em> is TRUE an absolute path is returned. <p> <p>See also <a href="#dir">dir</a>(), <a href="#filePath">filePath</a>(), <a href="#fileName">fileName</a>(), and <a href="#isRelative">isRelative</a>(). <p>Example: <a href="fileiconview-example.html#x822">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>bool <a name="exists"></a>TQFileInfo::exists () const </h3> Returns TRUE if the file exists; otherwise returns FALSE. <p>Examples: <a href="biff-example.html#x1955">biff/biff.cpp</a>, <a href="distributor-example.html#x2661">distributor/distributor.ui.h</a>, and <a href="i18n-example.html#x1937">i18n/main.cpp</a>. <h3 class=fn><a href="qstring.html">TQString</a> <a name="extension"></a>TQFileInfo::extension ( bool complete = TRUE ) const </h3> Returns the file's extension name. <p> If <em>complete</em> is TRUE (the default), <a href="#extension">extension</a>() returns the string of all characters in the file name after (but not including) the first '.' character. <p> If <em>complete</em> is FALSE, extension() returns the string of all characters in the file name after (but not including) the last '.' character. <p> Example: <pre> TQFileInfo fi( "/tmp/archive.tar.gz" ); <a href="qstring.html">TQString</a> ext = fi.<a href="#extension">extension</a>(); // ext = "tar.gz" ext = fi.<a href="#extension">extension</a>( FALSE ); // ext = "gz" </pre> <p> <p>See also <a href="#fileName">fileName</a>() and <a href="#baseName">baseName</a>(). <p>Example: <a href="qdir-example.html#x1823">qdir/qdir.cpp</a>. <h3 class=fn><a href="qstring.html">TQString</a> <a name="fileName"></a>TQFileInfo::fileName () const </h3> Returns the name of the file, excluding the path. <p> Example: <pre> TQFileInfo fi( "/tmp/archive.tar.gz" ); <a href="qstring.html">TQString</a> name = fi.<a href="#fileName">fileName</a>(); // name = "archive.tar.gz" </pre> <p> <p>See also <a href="#isRelative">isRelative</a>(), <a href="#filePath">filePath</a>(), <a href="#baseName">baseName</a>(), and <a href="#extension">extension</a>(). <p>Examples: <a href="dirview-example.html#x1675">dirview/dirview.cpp</a>, <a href="fileiconview-example.html#x823">fileiconview/qfileiconview.cpp</a>, and <a href="ftpclient-example.html#x743">network/ftpclient/ftpmainwindow.ui.h</a>. <h3 class=fn><a href="qstring.html">TQString</a> <a name="filePath"></a>TQFileInfo::filePath () const </h3> Returns the file name, including the path (which may be absolute or relative). <p> <p>See also <a href="#isRelative">isRelative</a>() and <a href="#absFilePath">absFilePath</a>(). <p>Examples: <a href="dirview-example.html#x1713">dirview/main.cpp</a> and <a href="fileiconview-example.html#x824">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="qstring.html">TQString</a> <a name="group"></a>TQFileInfo::group () const </h3> Returns the group of the file. On Windows, on systems where files do not have groups, or if an error occurs, <a href="qstring.html#TQString-null">TQString::null</a> is returned. <p> This function can be time consuming under Unix (in the order of milliseconds). <p> <p>See also <a href="#groupId">groupId</a>(), <a href="#owner">owner</a>(), and <a href="#ownerId">ownerId</a>(). <h3 class=fn>uint <a name="groupId"></a>TQFileInfo::groupId () const </h3> Returns the id of the group the file belongs to. <p> On Windows and on systems where files do not have groups this function always returns (uint) -2. <p> <p>See also <a href="#group">group</a>(), <a href="#owner">owner</a>(), and <a href="#ownerId">ownerId</a>(). <h3 class=fn>bool <a name="isDir"></a>TQFileInfo::isDir () const </h3> Returns TRUE if this object points to a directory or to a symbolic link to a directory; otherwise returns FALSE. <p> <p>See also <a href="#isFile">isFile</a>() and <a href="#isSymLink">isSymLink</a>(). <p>Examples: <a href="dirview-example.html#x1676">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x825">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>bool <a name="isExecutable"></a>TQFileInfo::isExecutable () const </h3> Returns TRUE if the file is executable; otherwise returns FALSE. <p> <p>See also <a href="#isReadable">isReadable</a>(), <a href="#isWritable">isWritable</a>(), and <a href="#permission">permission</a>(). <h3 class=fn>bool <a name="isFile"></a>TQFileInfo::isFile () const </h3> Returns TRUE if this object points to a file. Returns FALSE if the object points to something which isn't a file, e.g. a directory or a symlink. <p> <p>See also <a href="#isDir">isDir</a>() and <a href="#isSymLink">isSymLink</a>(). <p>Examples: <a href="dirview-example.html#x1677">dirview/dirview.cpp</a>, <a href="distributor-example.html#x2662">distributor/distributor.ui.h</a>, <a href="fileiconview-example.html#x826">fileiconview/qfileiconview.cpp</a>, and <a href="qdir-example.html#x1824">qdir/qdir.cpp</a>. <h3 class=fn>bool <a name="isHidden"></a>TQFileInfo::isHidden () const </h3> Returns TRUE if the file is hidden; otherwise returns FALSE. <p> On Unix-like operating systems, including Mac OS X, a file is hidden if its name begins with ".". On Windows a file is hidden if its hidden attribute is set. <h3 class=fn>bool <a name="isReadable"></a>TQFileInfo::isReadable () const </h3> Returns TRUE if the file is readable; otherwise returns FALSE. <p> <p>See also <a href="#isWritable">isWritable</a>(), <a href="#isExecutable">isExecutable</a>(), and <a href="#permission">permission</a>(). <p>Example: <a href="distributor-example.html#x2663">distributor/distributor.ui.h</a>. <h3 class=fn>bool <a name="isRelative"></a>TQFileInfo::isRelative () const </h3> Returns TRUE if the file path name is relative. Returns FALSE if the path is absolute (e.g. under Unix a path is absolute if it begins with a "/"). <h3 class=fn>bool <a name="isSymLink"></a>TQFileInfo::isSymLink () const </h3> Returns TRUE if this object points to a symbolic link (or to a shortcut on Windows, or an alias on Mac OS X); otherwise returns FALSE. <p> <p>See also <a href="#isFile">isFile</a>(), <a href="#isDir">isDir</a>(), and <a href="#readLink">readLink</a>(). <p>Examples: <a href="dirview-example.html#x1678">dirview/dirview.cpp</a>, <a href="distributor-example.html#x2664">distributor/distributor.ui.h</a>, and <a href="fileiconview-example.html#x827">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>bool <a name="isWritable"></a>TQFileInfo::isWritable () const </h3> Returns TRUE if the file is writable; otherwise returns FALSE. <p> <p>See also <a href="#isReadable">isReadable</a>(), <a href="#isExecutable">isExecutable</a>(), and <a href="#permission">permission</a>(). <p>Example: <a href="distributor-example.html#x2665">distributor/distributor.ui.h</a>. <h3 class=fn><a href="qdatetime.html">TQDateTime</a> <a name="lastModified"></a>TQFileInfo::lastModified () const </h3> Returns the date and time when the file was last modified. <p> <p>See also <a href="#created">created</a>() and <a href="#lastRead">lastRead</a>(). <p>Example: <a href="biff-example.html#x1956">biff/biff.cpp</a>. <h3 class=fn><a href="qdatetime.html">TQDateTime</a> <a name="lastRead"></a>TQFileInfo::lastRead () const </h3> Returns the date and time when the file was last read (accessed). <p> On platforms where this information is not available, returns the same as <a href="#lastModified">lastModified</a>(). <p> <p>See also <a href="#created">created</a>() and <a href="#lastModified">lastModified</a>(). <p>Example: <a href="biff-example.html#x1957">biff/biff.cpp</a>. <h3 class=fn><a href="qfileinfo.html">TQFileInfo</a> & <a name="operator-eq"></a>TQFileInfo::operator= ( const <a href="qfileinfo.html">TQFileInfo</a> & fi ) </h3> Makes a copy of <em>fi</em> and assigns it to this TQFileInfo. <h3 class=fn><a href="qstring.html">TQString</a> <a name="owner"></a>TQFileInfo::owner () const </h3> Returns the owner of the file. On systems where files do not have owners, or if an error occurs, <a href="qstring.html#TQString-null">TQString::null</a> is returned. <p> This function can be time consuming under Unix (in the order of milliseconds). <p> <p>See also <a href="#ownerId">ownerId</a>(), <a href="#group">group</a>(), and <a href="#groupId">groupId</a>(). <h3 class=fn>uint <a name="ownerId"></a>TQFileInfo::ownerId () const </h3> Returns the id of the owner of the file. <p> On Windows and on systems where files do not have owners this function returns ((uint) -2). <p> <p>See also <a href="#owner">owner</a>(), <a href="#group">group</a>(), and <a href="#groupId">groupId</a>(). <h3 class=fn>bool <a name="permission"></a>TQFileInfo::permission ( int permissionSpec ) const </h3> Tests for file permissions. The <em>permissionSpec</em> argument can be several flags of type <a href="#PermissionSpec-enum">PermissionSpec</a> OR-ed together to check for permission combinations. <p> On systems where files do not have permissions this function always returns TRUE. <p> Example: <pre> TQFileInfo fi( "/tmp/archive.tar.gz" ); if ( fi.<a href="#permission">permission</a>( TQFileInfo::<a href="#PermissionSpec-enum">WriteUser</a> | TQFileInfo::<a href="#PermissionSpec-enum">ReadGroup</a> ) ) <a href="qapplication.html#qWarning">qWarning</a>( "I can change the file; my group can read the file" ); if ( fi.<a href="#permission">permission</a>( TQFileInfo::<a href="#PermissionSpec-enum">WriteGroup</a> | TQFileInfo::<a href="#PermissionSpec-enum">WriteOther</a> ) ) <a href="qapplication.html#qWarning">qWarning</a>( "The group or others can change the file" ); </pre> <p> <p>See also <a href="#isReadable">isReadable</a>(), <a href="#isWritable">isWritable</a>(), and <a href="#isExecutable">isExecutable</a>(). <h3 class=fn><a href="qstring.html">TQString</a> <a name="readLink"></a>TQFileInfo::readLink () const </h3> Returns the name a symlink (or shortcut on Windows) points to, or a <a href="qstring.html#TQString-null">TQString::null</a> if the object isn't a symbolic link. <p> This name may not represent an existing file; it is only a string. <a href="#exists">TQFileInfo::exists</a>() returns TRUE if the symlink points to an existing file. <p> <p>See also <a href="#exists">exists</a>(), <a href="#isSymLink">isSymLink</a>(), <a href="#isDir">isDir</a>(), and <a href="#isFile">isFile</a>(). <h3 class=fn>void <a name="refresh"></a>TQFileInfo::refresh () const </h3> Refreshes the information about the file, i.e. reads in information from the file system the next time a cached property is fetched. <p> <p>See also <a href="#setCaching">setCaching</a>(). <h3 class=fn>void <a name="setCaching"></a>TQFileInfo::setCaching ( bool enable ) </h3> If <em>enable</em> is TRUE, enables caching of file information. If <em>enable</em> is FALSE caching is disabled. <p> When caching is enabled, TQFileInfo reads the file information from the file system the first time it's needed, but generally not later. <p> Caching is enabled by default. <p> <p>See also <a href="#refresh">refresh</a>() and <a href="#caching">caching</a>(). <h3 class=fn>void <a name="setFile"></a>TQFileInfo::setFile ( const <a href="qstring.html">TQString</a> & file ) </h3> Sets the file that the TQFileInfo provides information about to <em>file</em>. <p> The <em>file</em> can also include an absolute or relative file path. Absolute paths begin with the directory separator (e.g. "/" under Unix) or a drive specification (under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory. <p> Example: <pre> <a href="qstring.html">TQString</a> absolute = "/local/bin"; <a href="qstring.html">TQString</a> relative = "local/bin"; TQFileInfo absFile( absolute ); TQFileInfo relFile( relative ); TQDir::<a href="qdir.html#setCurrent">setCurrent</a>( TQDir::<a href="qdir.html#rootDirPath">rootDirPath</a>() ); // absFile and relFile now point to the same file TQDir::<a href="qdir.html#setCurrent">setCurrent</a>( "/tmp" ); // absFile now points to "/local/bin", // while relFile points to "/tmp/local/bin" </pre> <p> <p>See also <a href="#isRelative">isRelative</a>(), <a href="qdir.html#setCurrent">TQDir::setCurrent</a>(), and <a href="qdir.html#isRelativePath">TQDir::isRelativePath</a>(). <p>Example: <a href="biff-example.html#x1958">biff/biff.cpp</a>. <h3 class=fn>void <a name="setFile-2"></a>TQFileInfo::setFile ( const <a href="qfile.html">TQFile</a> & file ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Sets the file that the TQFileInfo provides information about to <em>file</em>. <p> If <em>file</em> includes a relative path, the TQFileInfo will also have a relative path. <p> <p>See also <a href="#isRelative">isRelative</a>(). <h3 class=fn>void <a name="setFile-3"></a>TQFileInfo::setFile ( const <a href="qdir.html">TQDir</a> & d, const <a href="qstring.html">TQString</a> & fileName ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Sets the file that the TQFileInfo provides information about to <em>fileName</em> in directory <em>d</em>. <p> If <em>fileName</em> includes a relative path, the TQFileInfo will also have a relative path. <p> <p>See also <a href="#isRelative">isRelative</a>(). <h3 class=fn>uint <a name="size"></a>TQFileInfo::size () const </h3> Returns the file size in bytes, or 0 if the file does not exist or if the size is 0 or if the size cannot be fetched. <p>Example: <a href="qdir-example.html#x1825">qdir/qdir.cpp</a>. <!-- eof --> <hr><p> This file is part of the <a href="index.html">TQt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>TQt 3.3.8</div> </table></div></address></body> </html>