返回介绍

QUrlInfo Class

发布于 2019-10-04 15:03:45 字数 13195 浏览 1006 评论 0 收藏 0

The QUrlInfo class stores information about URLs. More...

#include <qurlinfo.h>

List of all member functions.

Public Members

  • QUrlInfo ()
  • QUrlInfo ( constQUrlOperator&path, constQString&file )
  • QUrlInfo ( constQUrlInfo&ui )
  • QUrlInfo ( constQString&name, intpermissions, constQString&owner, constQString&group, uintsize, constQDateTime&lastModified, constQDateTime&lastRead, boolisDir, boolisFile, boolisSymLink, boolisWritable, boolisReadable, boolisExecutable )
  • QUrlInfo ( constQUrl&url, intpermissions, constQString&owner, constQString&group, uintsize, constQDateTime&lastModified, constQDateTime&lastRead, boolisDir, boolisFile, boolisSymLink, boolisWritable, boolisReadable, boolisExecutable )
  • QUrlInfo & operator= ( constQUrlInfo&ui )
  • virtual ~QUrlInfo ()
  • virtual void setName ( constQString&name )
  • virtual void setDir ( boolb )
  • virtual void setFile ( boolb )
  • virtual void setSymLink ( boolb )
  • virtual void setOwner ( constQString&s )
  • virtual void setGroup ( constQString&s )
  • virtual void setSize ( uints )
  • virtual void setWritable ( boolb )
  • virtual void setReadable ( boolb )
  • virtual void setPermissions ( intp )
  • virtual void setLastModified ( constQDateTime&dt )
  • bool isValid () const
  • QString name () const
  • int permissions () const
  • QString owner () const
  • QString group () const
  • uint size () const
  • QDateTime lastModified () const
  • QDateTime lastRead () const
  • bool isDir () const
  • bool isFile () const
  • bool isSymLink () const
  • bool isWritable () const
  • bool isReadable () const
  • bool isExecutable () const
  • bool operator== ( constQUrlInfo&i ) const

Static Public Members

  • bool greaterThan ( constQUrlInfo&i1, constQUrlInfo&i2, intsortBy )
  • bool lessThan ( constQUrlInfo&i1, constQUrlInfo&i2, intsortBy )
  • bool equal ( constQUrlInfo&i1, constQUrlInfo&i2, intsortBy )

Detailed Description

The QUrlInfo class stores information about URLs.

This class is just a container for storing information about URLs, which is why all information must be passed in the constructor.

Unless you're reimplementing a network protocol you're unlikely to create QUrlInfo objects yourself, but you may receive QUrlInfo objects from functions, e.g. QUrlOperator::info().

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

See also Input/Output and Networking and Miscellaneous Classes.


Member Function Documentation

QUrlInfo::QUrlInfo ()

Constructs an invalid QUrlInfo object with default values.

See also isValid().

QUrlInfo::QUrlInfo ( constQUrlOperator&path, constQString&file )

Constructs a QUrlInfo object with information about the file file in the path. It tries to find the information about the file in the QUrlOperator path.

If the information is not found, this constructor creates an invalid QUrlInfo, i.e. isValid() returns FALSE. You should always check if the URL info is valid before relying on the return values of any getter functions.

If file is empty, it defaults to the QUrlOperator path, i.e. to the directory.

See also isValid() and QUrlOperator::info().

QUrlInfo::QUrlInfo ( constQUrlInfo&ui )

Copy constructor, copies ui to this URL info object.

QUrlInfo::QUrlInfo ( constQString&name, intpermissions, constQString&owner, constQString&group, uintsize, constQDateTime&lastModified, constQDateTime&lastRead, boolisDir, boolisFile, boolisSymLink, boolisWritable, boolisReadable, boolisExecutable )

Constructs a 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 ( constQUrl&url, intpermissions, constQString&owner, constQString&group, uintsize, constQDateTime&lastModified, constQDateTime&lastRead, boolisDir, boolisFile, boolisSymLink, boolisWritable, boolisReadable, boolisExecutable )

Constructs a 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 () [virtual]

Destroys the URL info object.

The QUrlOperator object to which this URL referred (if any) is not affected.

bool QUrlInfo::equal ( constQUrlInfo&i1, constQUrlInfo&i2, intsortBy ) [static]

Returns TRUE if 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.

bool QUrlInfo::greaterThan ( constQUrlInfo&i1, constQUrlInfo&i2, intsortBy ) [static]

Returns TRUE if i1 is greater than 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.

See also isValid().

bool QUrlInfo::isDir () const

Returns TRUE if the URL is a directory; otherwise returns FALSE.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

bool QUrlInfo::isExecutable () const

Returns TRUE if the URL is executable; otherwise returns FALSE.

See also isValid().

bool QUrlInfo::isFile () const

Returns TRUE if the URL is a file; otherwise returns FALSE.

See also isValid().

bool QUrlInfo::isReadable () const

Returns TRUE if the URL is readable; otherwise returns FALSE.

See also isValid().

bool QUrlInfo::isSymLink () const

Returns TRUE if the URL is a symbolic link; otherwise returns FALSE.

See also isValid().

bool QUrlInfo::isValid () const

Returns TRUE if the URL info is valid; otherwise returns FALSE. Valid means that the QUrlInfo contains real information. For example, a call to QUrlOperator::info() might return a an invalid QUrlInfo, if no information about the requested entry is available.

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.

See also isValid().

QDateTime QUrlInfo::lastModified () const

Returns the last modification date of the URL.

See also isValid().

QDateTime QUrlInfo::lastRead () const

Returns the date when the URL was last read.

See also isValid().

bool QUrlInfo::lessThan ( constQUrlInfo&i1, constQUrlInfo&i2, intsortBy ) [static]

Returns TRUE if i1 is less than 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.

See also isValid().

Examples: network/ftpclient/ftpmainwindow.cpp and network/ftpclient/ftpview.cpp.

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

Assigns the values of ui to this QUrlInfo object.

bool QUrlInfo::operator== ( constQUrlInfo&i ) const

Compares this QUrlInfo with i and returns TRUE if they are equal; otherwise returns FALSE.

QString QUrlInfo::owner () const

Returns the owner of the URL.

See also isValid().

int QUrlInfo::permissions () const

Returns the permissions of the URL.

See also isValid().

void QUrlInfo::setDir ( boolb ) [virtual]

If 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.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

void QUrlInfo::setFile ( boolb ) [virtual]

If b is TRUE then the URL is set to be a file; if \b 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.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

void QUrlInfo::setGroup ( constQString&s ) [virtual]

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.

See also isValid().

void QUrlInfo::setLastModified ( constQDateTime&dt ) [virtual]

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.

See also isValid().

void QUrlInfo::setName ( constQString&name ) [virtual]

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

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

See also isValid().

Example: network/networkprotocol/nntp.cpp.

void QUrlInfo::setOwner ( constQString&s ) [virtual]

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.

See also isValid().

void QUrlInfo::setPermissions ( intp ) [virtual]

Specifies that the URL has access permisions, p.

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

See also isValid().

void QUrlInfo::setReadable ( boolb ) [virtual]

Specifies that the URL is readable if b is TRUE and not readable if b is FALSE.

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

See also isValid().

Example: network/networkprotocol/nntp.cpp.

void QUrlInfo::setSize ( uints ) [virtual]

Specifies that the URL has size s.

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

See also isValid().

void QUrlInfo::setSymLink ( boolb ) [virtual]

Specifies that the URL refers to a symbolic link if b is TRUE and that it does not if b is FALSE.

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

See also isValid().

Example: network/networkprotocol/nntp.cpp.

void QUrlInfo::setWritable ( boolb ) [virtual]

Specifies that the URL is writable if b is TRUE and not writable if b is FALSE.

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

See also isValid().

Example: network/networkprotocol/nntp.cpp.

uint QUrlInfo::size () const

Returns the size of the URL.

See also isValid().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文