⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qdir.3qt

📁 tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.TH QDir 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQDir \- Traverses directory structures and contents in a platform-independent way.SH SYNOPSIS.br.PP\fC#include <qdir.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBFilterSpec\fR { Dirs = 0x001, Files = 0x002, Drives = 0x004, NoSymLinks = 0x008, All = 0x007, TypeMask = 0x00F, Readable = 0x010, Writable = 0x020, Executable = 0x040, RWEMask = 0x070, Modified = 0x080, Hidden = 0x100, System = 0x200, AccessMask = 0x3F0, DefaultFilter = -1 }".br.ti -1c.BI "enum \fBSortSpec\fR { Name = 0x00, Time = 0x01, Size = 0x02, Unsorted = 0x03, SortByMask = 0x03, DirsFirst = 0x04, Reversed = 0x08, IgnoreCase = 0x10, DefaultSort = -1 }".br.ti -1c.BI "\fBQDir\fR ()".br.ti -1c.BI "\fBQDir\fR ( const QString & " "path" ", const QString & nameFilter = QString::null, int sortSpec = Name | IgnoreCase, int " "filterSpec" " = All )".br.ti -1c.BI "\fBQDir\fR ( const QDir & )".br.ti -1c.BI "virtual \fB~QDir\fR ()".br.ti -1c.BI "QDir& \fBoperator=\fR ( const QDir & )".br.ti -1c.BI "QDir& \fBoperator=\fR ( const QString & path )".br.ti -1c.BI "virtual void \fBsetPath\fR ( const QString & path )".br.ti -1c.BI "virtual QString \fBpath\fR () const".br.ti -1c.BI "virtual QString \fBabsPath\fR () const".br.ti -1c.BI "virtual QString \fBcanonicalPath\fR () const".br.ti -1c.BI "virtual QString \fBdirName\fR () const".br.ti -1c.BI "virtual QString \fBfilePath\fR ( const QString & " "fileName" ", bool " "acceptAbsPath" " = TRUE ) const".br.ti -1c.BI "virtual QString \fBabsFilePath\fR ( const QString & " "fileName" ", bool " "acceptAbsPath" " = TRUE ) const".br.ti -1c.BI "virtual bool \fBcd\fR ( const QString & " "dirName" ", bool " "acceptAbsPath" " = TRUE )".br.ti -1c.BI "virtual bool \fBcdUp\fR ()".br.ti -1c.BI "QString \fBnameFilter\fR () const".br.ti -1c.BI "virtual void \fBsetNameFilter\fR ( const QString & nameFilter )".br.ti -1c.BI "FilterSpec \fBfilter\fR () const".br.ti -1c.BI "virtual void \fBsetFilter\fR ( int filterSpec )".br.ti -1c.BI "SortSpec \fBsorting\fR () const".br.ti -1c.BI "virtual void \fBsetSorting\fR ( int sortSpec )".br.ti -1c.BI "bool \fBmatchAllDirs\fR () const".br.ti -1c.BI "virtual void \fBsetMatchAllDirs\fR ( bool )".br.ti -1c.BI "uint \fBcount\fR () const".br.ti -1c.BI "QString \fBoperator[]\fR ( int ) const".br.ti -1c.BI "virtual QStrList \fBencodedEntryList\fR ( int " "filterSpec" " = DefaultFilter, int " "sortSpec" " = DefaultSort ) const".br.ti -1c.BI "virtual QStrList \fBencodedEntryList\fR ( const QString & " "nameFilter" ", int " "filterSpec" " = DefaultFilter, int " "sortSpec" " = DefaultSort ) const".br.ti -1c.BI "virtual QStringList \fBentryList\fR ( int " "filterSpec" " = DefaultFilter, int " "sortSpec" " = DefaultSort ) const".br.ti -1c.BI "virtual QStringList \fBentryList\fR ( const QString & " "nameFilter" ", int " "filterSpec" " = DefaultFilter, int " "sortSpec" " = DefaultSort ) const".br.ti -1c.BI "virtual const QFileInfoList* \fBentryInfoList\fR ( int " "filterSpec" " = DefaultFilter, int " "sortSpec" " = DefaultSort ) const".br.ti -1c.BI "virtual const QFileInfoList* \fBentryInfoList\fR ( const QString & " "nameFilter" ", int " "filterSpec" " = DefaultFilter, int " "sortSpec" " = DefaultSort ) const".br.ti -1c.BI "virtual bool \fBmkdir\fR ( const QString & " "dirName" ", bool " "acceptAbsPath" " = TRUE ) const".br.ti -1c.BI "virtual bool \fBrmdir\fR ( const QString & " "dirName" ", bool " "acceptAbsPath" " = TRUE ) const".br.ti -1c.BI "virtual bool \fBisReadable\fR () const".br.ti -1c.BI "virtual bool \fBexists\fR () const".br.ti -1c.BI "virtual bool \fBisRoot\fR () const".br.ti -1c.BI "virtual bool \fBisRelative\fR () const".br.ti -1c.BI "virtual void \fBconvertToAbs\fR ()".br.ti -1c.BI "virtual bool \fBoperator==\fR ( const QDir & ) const".br.ti -1c.BI "virtual bool \fBoperator!=\fR ( const QDir & ) const".br.ti -1c.BI "virtual bool \fBremove\fR ( const QString & " "fileName" ", bool " "acceptAbsPath" " = TRUE )".br.ti -1c.BI "virtual bool \fBrename\fR ( const QString & " "name" ", const QString & " "newName" ", bool " "acceptAbsPaths" " = TRUE )".br.ti -1c.BI "virtual bool \fBexists\fR ( const QString & " "name" ", bool " "acceptAbsPath" " = TRUE )".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QString \fBconvertSeparators\fR ( const QString & pathName )".br.ti -1c.BI "const QFileInfoList* \fBdrives\fR ()".br.ti -1c.BI "char \fBseparator\fR ()".br.ti -1c.BI "bool \fBsetCurrent\fR ( const QString & path )".br.ti -1c.BI "QDir \fBcurrent\fR ()".br.ti -1c.BI "QDir \fBhome\fR ()".br.ti -1c.BI "QDir \fBroot\fR ()".br.ti -1c.BI "QString \fBcurrentDirPath\fR ()".br.ti -1c.BI "QString \fBhomeDirPath\fR ()".br.ti -1c.BI "QString \fBrootDirPath\fR ()".br.ti -1c.BI "bool \fBmatch\fR ( const QString & " "filter" ", const QString & fileName )".br.ti -1c.BI "QString \fBcleanDirPath\fR ( const QString & dirPath )".br.ti -1c.BI "bool \fBisRelativePath\fR ( const QString & path )".br.in -1c.SH DESCRIPTIONTraverses directory structures and contents in a platform-independent way..PPA QDir can point to a file using either a relative or an absolute file path. Absolute file paths begin with the directory separator ('/') or a drive specification (not applicable to UNIX). Relative file names begin with a directory name or a file name and specify a path relative to the current directory..PPAn example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib". You can use the function isRelative() to check if a QDir is using a relative or an absolute file path. You can call the function convertToAbs() to convert a relative QDir to an absolute one..PPThe directory "example" under the current directory is checked for existence in the example below:.PP.nf.br    QDir d( "example" );                        // "./example".br    if ( !d.exists() ).br        qWarning( "Cannot find the example directory" );.fi.PPIf you always use '/' as a directory separator, Qt will translate your paths to conform to the underlying operating system..PPcd() and cdUp() can be used to navigate the directory tree. Note that the logical cd and cdUp operations are not performed if the new directory does not exist..PPExample:.PP.nf.br    QDir d = QDir::root();                      // "/".br    if ( !d.cd("tmp") ) {                       // "/tmp".br        qWarning( "Cannot find the \\"/tmp\\" directory" );.br    } else {.br        QFile f( d.filePath("ex1.txt") );       // "/tmp/ex1.txt".br        if ( !f.open(IO_ReadWrite) ).br            qWarning( "Cannot create the file %s", f.name() );.br    }.fi.PPTo read the contents of a directory you can use the entryList() and entryInfoList() functions..PPExample:.PP.nf.br    #include <stdio.h>.br    #include <qdir.h>.br.br    //.br    // This program scans the current directory and lists all files.br    // that are not symbolic links, sorted by size with the smallest files.br    // first..br    //.br.br    int main( int argc, char **argv ).br    {.br        QDir d;.br        d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );.br        d.setSorting( QDir::Size | QDir::Reversed );.br.br        const QFileInfoList *list = d.entryInfoList();.br        QFileInfoListIterator it( *list );      // create list iterator.br        QFileInfo *fi;                          // pointer for traversing.br.br        printf( "     BYTES FILENAME\\n" );      // print header.br        while ( (fi=it.current()) ) {           // for each file....br            printf( "%10li %s\\n", fi->size(), fi->fileName().data() );.br            ++it;                               // goto next list element.br        }.br    }.fi.SH MEMBER FUNCTION DOCUMENTATION.SH "QDir::QDir ()"Constructs a QDir pointing to the current directory..PPSee also: currentDirPath()..SH "QDir::QDir ( const QString & path, const QString & nameFilter = QString::null, int sortSpec = Name | IgnoreCase, int filterSpec = All )"Constructs a QDir..PPArguments:.TP\fIpath\fR is the directory..TP\fInameFilter\fR is the file name filter..TP\fIsortSpec\fR is the sort specification, which describes how to sort the files in the directory..TP\fIfilterSpec\fR is the filter specification, which describes how to filter the files in the directory. Most of these arguments (except \fIpath)\fR have optional values..PPExample:.PP.nf.br    // lists all files in /tmp.br.br    QDir d( "/tmp" );.br    for ( int i=0; i<d.count(); i++ ).br        printf( "%s\\n", d[i] );.fi.PPIf \fIpath\fR is "" or null, the directory is set to "." (the current directory). If \fInameFilter\fR is "" or null, it is set to "*" (all files)..PPNo check is made to ensure that the directory exists..PPSee also: exists(), setPath(), setNameFilter(), setFilter() and setSorting()..SH "QDir::QDir ( const QDir & d )"Constructs a QDir that is a copy of the given directory..PPSee also: operator=()..SH "QDir::~QDir () \fC[virtual]\fR"Destroys the QDir and cleans up..SH "QString QDir::absFilePath ( const QString & fileName, bool acceptAbsPath = TRUE ) const \fC[virtual]\fR"Returns the absolute path name of a file in the directory. Does NOT check if the file actually exists in the directory. Redundant multiple separators or "." and ".." directories in \fIfileName\fR will NOT be removed (see cleanDirPath())..PPIf \fIacceptAbsPath\fR is TRUE a \fIfileName\fR starting with a separator ('/') will be returned without change. if \fIacceptAbsPath\fR is FALSE an absolute path will be appended to the directory path..PPSee also: filePath()..SH "QString QDir::absPath () const \fC[virtual]\fR"Returns the absolute (a path that starts with '/') path, which may contain symbolic links, but never contains redundant ".", ".." or multiple separators..PPSee also: setPath(), canonicalPath(), exists(), cleanDirPath(), dirName() and absFilePath()..SH "QString QDir::canonicalPath () const \fC[virtual]\fR"Returns the canonical path, i.e. a path without symbolic links..PPOn systems that do not have symbolic links this function will always return the same string that absPath returns. If the canonical path does not exist a null string is returned..PPSee also: path(), absPath(), exists(), cleanDirPath(), dirName(), absFilePath() and QString::isNull()..SH "bool QDir::cd ( const QString & dirName, bool acceptAbsPath = TRUE ) \fC[virtual]\fR"Changes directory by descending into the given directory. Returns TRUE if the new directory exists and is readable. Note that the logical cd operation is NOT performed if the new directory does not exist..PPIf \fIacceptAbsPath\fR is TRUE a path starting with a separator ('/') will cd to the absolute directory, if \fIacceptAbsPath\fR is FALSE any number of separators at the beginning of \fIdirName\fR will be removed..PP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -