QUrlInfo Class

The QUrlInfo class stores information about URLs. 更多...

头: #include <QUrlInfo>

公共类型

enum PermissionSpec { ReadOwner, WriteOwner, ExeOwner, ReadGroup, ..., ExeOther }

公共函数

QUrlInfo ()
QUrlInfo (const QUrlInfo & ui )
QUrlInfo (const QString & name , int permissions , const QString & owner , const QString & group , qint64 size , const QDateTime & lastModified , const QDateTime & lastRead , bool isDir , bool isFile , bool isSymLink , bool isWritable , bool isReadable , bool isExecutable )
QUrlInfo (const QUrl & url , int permissions , const QString & owner , const QString & group , qint64 size , const QDateTime & lastModified , const QDateTime & lastRead , bool isDir , bool isFile , bool isSymLink , bool isWritable , bool isReadable , bool isExecutable )
virtual ~QUrlInfo ()
QString group () const
bool isDir () const
bool isExecutable () const
bool isFile () const
bool isReadable () const
bool isSymLink () const
bool isValid () const
bool isWritable () const
QDateTime lastModified () const
QDateTime lastRead () const
QString name () const
QString owner () const
int permissions () const
virtual void setDir (bool b )
virtual void setFile (bool b )
virtual void setGroup (const QString & s )
virtual void setLastModified (const QDateTime & dt )
void setLastRead (const QDateTime & dt )
virtual void setName (const QString & name )
virtual void setOwner (const QString & s )
virtual void setPermissions (int p )
virtual void setReadable (bool b )
virtual void setSize (qint64 size )
virtual void setSymLink (bool b )
virtual void setWritable (bool b )
qint64 size () const
bool operator!= (const QUrlInfo & other ) const
QUrlInfo & operator= (const QUrlInfo & ui )
bool operator== (const QUrlInfo & other ) const

静态公共成员

bool equal (const QUrlInfo & i1 , const QUrlInfo & i2 , int sortBy )
bool greaterThan (const QUrlInfo & i1 , const QUrlInfo & i2 , int sortBy )
bool lessThan (const QUrlInfo & i1 , const QUrlInfo & i2 , int sortBy )

详细描述

The QUrlInfo class stores information about URLs.

The information about a URL that can be retrieved includes name (), permissions (), owner (), group (), size (), lastModified (), lastRead (), isDir (), isFile (), isSymLink (), isWritable (), isReadable () 和 isExecutable ().

可以创建自己的 QUrlInfo objects passing in all the relevant information in the constructor, and you can modify a QUrlInfo ; for each getter mentioned above there is an equivalent setter. Note that setting values does not affect the underlying resource that the QUrlInfo provides information about; for example if you call setWritable (true) on a read-only resource the only thing changed is the QUrlInfo object, not the resource.

另请参阅 QUrl and FTP Example .

成员类型文档编制

enum QUrlInfo:: PermissionSpec

此枚举用于 permissions () function to report the permissions of a file.

常量 描述
QUrlInfo::ReadOwner 00400 文件可由文件的所有者读取。
QUrlInfo::WriteOwner 00200 文件可由文件的所有者写入。
QUrlInfo::ExeOwner 00100 文件可由文件的所有者执行。
QUrlInfo::ReadGroup 00040 文件可由组读取。
QUrlInfo::WriteGroup 00020 文件可由组写入。
QUrlInfo::ExeGroup 00010 文件可由组执行。
QUrlInfo::ReadOther 00004 The file is readable by anyone.
QUrlInfo::WriteOther 00002 The file is writable by anyone.
QUrlInfo::ExeOther 00001 The file is executable by anyone.

成员函数文档编制

QUrlInfo:: QUrlInfo ()

构造无效 QUrlInfo object with default values.

另请参阅 isValid ().

QUrlInfo:: QUrlInfo (const QUrlInfo & ui )

拷贝构造函数,拷贝 ui to this URL info object.

QUrlInfo:: QUrlInfo (const QString & name , int permissions , const QString & owner , const QString & group , qint64 size , const QDateTime & lastModified , const QDateTime & lastRead , bool isDir , bool isFile , bool isSymLink , bool isWritable , bool isReadable , bool isExecutable )

构造 QUrlInfo object by specifying all the URL's information.

The information that is passed is the name , file permissions , owner and group and the file's size . Also passed is the lastModified date/time and the lastRead date/time. Flags are also passed, specifically, isDir , isFile , isSymLink , isWritable , isReadable and isExecutable .

QUrlInfo:: QUrlInfo (const QUrl & url , int permissions , const QString & owner , const QString & group , qint64 size , const QDateTime & lastModified , const QDateTime & lastRead , bool isDir , bool isFile , bool isSymLink , bool isWritable , bool isReadable , bool isExecutable )

构造 QUrlInfo object by specifying all the URL's information.

The information that is passed is the url , file permissions , owner and group and the file's size . Also passed is the lastModified date/time and the lastRead date/time. Flags are also passed, specifically, isDir , isFile , isSymLink , isWritable , isReadable and isExecutable .

[虚拟] QUrlInfo:: ~QUrlInfo ()

Destroys the URL info object.

[static] bool QUrlInfo:: equal (const QUrlInfo & i1 , const QUrlInfo & i2 , int sortBy )

返回 true 若 i1 equals to i2 ; otherwise returns false. The objects are compared by the value, which is specified by sortBy . This must be one of QDir::Name , QDir::Time or QDir::Size .

[static] bool QUrlInfo:: greaterThan (const QUrlInfo & i1 , const QUrlInfo & i2 , int sortBy )

返回 true 若 i1 大于 i2 ; otherwise returns false. The objects are compared by the value, which is specified by sortBy . This must be one of QDir::Name , QDir::Time or QDir::Size .

QString QUrlInfo:: group () const

Returns the group of the URL.

另请参阅 setGroup () 和 isValid ().

bool QUrlInfo:: isDir () const

Returns true if the URL is a directory; otherwise returns false.

另请参阅 isValid ().

bool QUrlInfo:: isExecutable () const

Returns true if the URL is executable; otherwise returns false.

另请参阅 isValid ().

bool QUrlInfo:: isFile () const

Returns true if the URL is a file; otherwise returns false.

另请参阅 isValid ().

bool QUrlInfo:: isReadable () const

Returns true if the URL is readable; otherwise returns false.

另请参阅 isValid ().

Returns true if the URL is a symbolic link; otherwise returns false.

另请参阅 isValid ().

bool QUrlInfo:: isValid () const

Returns true if the URL info is valid; otherwise returns false. Valid means that the QUrlInfo contains real information.

You should always check if the URL info is valid before relying on the values.

bool QUrlInfo:: isWritable () const

Returns true if the URL is writable; otherwise returns false.

另请参阅 isValid ().

QDateTime QUrlInfo:: lastModified () const

Returns the last modification date of the URL.

另请参阅 setLastModified () 和 isValid ().

QDateTime QUrlInfo:: lastRead () const

Returns the date when the URL was last read.

另请参阅 setLastRead () 和 isValid ().

[static] bool QUrlInfo:: lessThan (const QUrlInfo & i1 , const QUrlInfo & i2 , int sortBy )

返回 true 若 i1 小于 i2 ; otherwise returns false. The objects are compared by the value, which is specified by sortBy . This must be one of QDir::Name , QDir::Time or QDir::Size .

QString QUrlInfo:: name () const

Returns the file name of the URL.

另请参阅 setName () 和 isValid ().

QString QUrlInfo:: owner () const

Returns the owner of the URL.

另请参阅 setOwner () 和 isValid ().

int QUrlInfo:: permissions () const

Returns the permissions of the URL. You can use the PermissionSpec flags to test for certain permissions.

另请参阅 setPermissions () 和 isValid ().

[虚拟] void QUrlInfo:: setDir ( bool b )

b is true then the URL is set to be a directory; if b is false then the URL is set not to be a directory (which normally means it is a file). (Note that a URL can refer to both a file and a directory even though most file systems do not support this.)

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 isDir () 和 isValid ().

[虚拟] void QUrlInfo:: setFile ( bool b )

b is true then the URL is set to be a file; if is false then the URL is set not to be a file (which normally means it is a directory). (Note that a URL can refer to both a file and a directory even though most file systems do not support this.)

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 isFile () 和 isValid ().

[虚拟] void QUrlInfo:: setGroup (const QString & s )

Specifies that the owning group of the URL is called s .

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 group () 和 isValid ().

[虚拟] void QUrlInfo:: setLastModified (const QDateTime & dt )

Specifies that the object the URL refers to was last modified at dt .

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 lastModified () 和 isValid ().

void QUrlInfo:: setLastRead (const QDateTime & dt )

Specifies that the object the URL refers to was last read at dt .

If you call this function for an invalid URL info, this function turns it into a valid one.

该函数在 Qt 4.4 引入。

另请参阅 lastRead () 和 isValid ().

[虚拟] void QUrlInfo:: setName (const QString & name )

Sets the name of the URL to name . The name is the full text, for example, "http://qt.nokia.com/doc/qurlinfo.html".

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 name () 和 isValid ().

[虚拟] void QUrlInfo:: setOwner (const QString & s )

Specifies that the owner of the URL is called s .

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 owner () 和 isValid ().

[虚拟] void QUrlInfo:: setPermissions ( int p )

Specifies that the URL has access permissions p .

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 permissions () 和 isValid ().

[虚拟] void QUrlInfo:: setReadable ( bool b )

Specifies that the URL is readable if b is true and not readable if b 为 false。

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 isReadable () 和 isValid ().

[虚拟] void QUrlInfo:: setSize ( qint64 size )

Specifies the size of the URL.

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 size () 和 isValid ().

Specifies that the URL refers to a symbolic link if b is true and that it does not if b 为 false。

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 isSymLink () 和 isValid ().

[虚拟] void QUrlInfo:: setWritable ( bool b )

Specifies that the URL is writable if b is true and not writable if b 为 false。

If you call this function for an invalid URL info, this function turns it into a valid one.

另请参阅 isWritable () 和 isValid ().

qint64 QUrlInfo:: size () const

Returns the size of the URL.

另请参阅 setSize () 和 isValid ().

bool QUrlInfo:: operator!= (const QUrlInfo & other ) const

返回 true,若此 QUrlInfo 不等于 other ;否则返回 false。

该函数在 Qt 4.2 引入。

另请参阅 lessThan () 和 equal ().

QUrlInfo & QUrlInfo:: operator= (const QUrlInfo & ui )

Assigns the values of ui 到此 QUrlInfo 对象。

bool QUrlInfo:: operator== (const QUrlInfo & other ) const

返回 true,若此 QUrlInfo 等于 other ;否则返回 false。

另请参阅 lessThan () 和 equal ().