Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QUrlInfo Class

TheQUrlInfo class stores information about URLs.More...

Header:#include <QUrlInfo>

Public Types

enumPermissionSpec { ReadOwner, WriteOwner, ExeOwner, ReadGroup, ..., ExeOther }

Public Functions

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()
QStringgroup() const
boolisDir() const
boolisExecutable() const
boolisFile() const
boolisReadable() const
boolisSymLink() const
boolisValid() const
boolisWritable() const
QDateTimelastModified() const
QDateTimelastRead() const
QStringname() const
QStringowner() const
intpermissions() const
virtual voidsetDir(bool b)
virtual voidsetFile(bool b)
virtual voidsetGroup(const QString & s)
virtual voidsetLastModified(const QDateTime & dt)
voidsetLastRead(const QDateTime & dt)
virtual voidsetName(const QString & name)
virtual voidsetOwner(const QString & s)
virtual voidsetPermissions(int p)
virtual voidsetReadable(bool b)
virtual voidsetSize(qint64 size)
virtual voidsetSymLink(bool b)
virtual voidsetWritable(bool b)
qint64size() const
booloperator!=(const QUrlInfo & other) const
QUrlInfo &operator=(const QUrlInfo & ui)
booloperator==(const QUrlInfo & other) const

Static Public Members

boolequal(const QUrlInfo & i1, const QUrlInfo & i2, int sortBy)
boolgreaterThan(const QUrlInfo & i1, const QUrlInfo & i2, int sortBy)
boollessThan(const QUrlInfo & i1, const QUrlInfo & i2, int sortBy)

Detailed Description

TheQUrlInfo class stores information about URLs.

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

You can create your ownQUrlInfo objects passing in all the relevant information in the constructor, and you can modify aQUrlInfo; for each getter mentioned above there is an equivalent setter. Note that setting values does not affect the underlying resource that theQUrlInfo provides information about; for example if you callsetWritable(true) on a read-only resource the only thing changed is theQUrlInfo object, not the resource.

See alsoQUrl andFTP Example.

Member Type Documentation

enum QUrlInfo::PermissionSpec

This enum is used by thepermissions() function to report the permissions of a file.

ConstantValueDescription
QUrlInfo::ReadOwner00400The file is readable by the owner of the file.
QUrlInfo::WriteOwner00200The file is writable by the owner of the file.
QUrlInfo::ExeOwner00100The file is executable by the owner of the file.
QUrlInfo::ReadGroup00040The file is readable by the group.
QUrlInfo::WriteGroup00020The file is writable by the group.
QUrlInfo::ExeGroup00010The file is executable by the group.
QUrlInfo::ReadOther00004The file is readable by anyone.
QUrlInfo::WriteOther00002The file is writable by anyone.
QUrlInfo::ExeOther00001The file is executable by anyone.

Member Function Documentation

QUrlInfo::QUrlInfo()

Constructs an invalidQUrlInfo object with default values.

See alsoisValid().

QUrlInfo::QUrlInfo(constQUrlInfo & ui)

Copy constructor, copiesui to this URL info object.

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

Constructs aQUrlInfo object by specifying all the URL's information.

The information that is passed is thename, filepermissions,owner andgroup and the file'ssize. Also passed is thelastModified date/time and thelastRead date/time. Flags are also passed, specifically,isDir,isFile,isSymLink,isWritable,isReadable andisExecutable.

QUrlInfo::QUrlInfo(constQUrl & url,int permissions, constQString & owner, constQString & group,qint64 size, constQDateTime & lastModified, constQDateTime & lastRead,bool isDir,bool isFile,bool isSymLink,bool isWritable,bool isReadable,bool isExecutable)

Constructs aQUrlInfo object by specifying all the URL's information.

The information that is passed is theurl, filepermissions,owner andgroup and the file'ssize. Also passed is thelastModified date/time and thelastRead date/time. Flags are also passed, specifically,isDir,isFile,isSymLink,isWritable,isReadable andisExecutable.

[virtual]QUrlInfo::~QUrlInfo()

Destroys the URL info object.

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

Returns true ifi1 equals toi2; otherwise returns false. The objects are compared by the value, which is specified bysortBy. This must be one ofQDir::Name,QDir::Time orQDir::Size.

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

Returns true ifi1 is greater thani2; otherwise returns false. The objects are compared by the value, which is specified bysortBy. This must be one ofQDir::Name,QDir::Time orQDir::Size.

QString QUrlInfo::group() const

Returns the group of the URL.

See alsosetGroup() andisValid().

bool QUrlInfo::isDir() const

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

See alsoisValid().

bool QUrlInfo::isExecutable() const

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

See alsoisValid().

bool QUrlInfo::isFile() const

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

See alsoisValid().

bool QUrlInfo::isReadable() const

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

See alsoisValid().

bool QUrlInfo::isSymLink() const

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

See alsoisValid().

bool QUrlInfo::isValid() const

Returns true if the URL info is valid; otherwise returns false. Valid means that theQUrlInfo 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.

See alsoisValid().

QDateTime QUrlInfo::lastModified() const

Returns the last modification date of the URL.

See alsosetLastModified() andisValid().

QDateTime QUrlInfo::lastRead() const

Returns the date when the URL was last read.

See alsosetLastRead() andisValid().

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

Returns true ifi1 is less thani2; otherwise returns false. The objects are compared by the value, which is specified bysortBy. This must be one ofQDir::Name,QDir::Time orQDir::Size.

QString QUrlInfo::name() const

Returns the file name of the URL.

See alsosetName() andisValid().

QString QUrlInfo::owner() const

Returns the owner of the URL.

See alsosetOwner() andisValid().

int QUrlInfo::permissions() const

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

See alsosetPermissions() andisValid().

[virtual]void QUrlInfo::setDir(bool b)

Ifb is true then the URL is set to be a directory; ifb 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 alsoisDir() andisValid().

[virtual]void QUrlInfo::setFile(bool b)

Ifb is true then the URL is set to be a file; ifis 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 alsoisFile() andisValid().

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

Specifies that the owning group of the URL is calleds.

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

See alsogroup() andisValid().

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

Specifies that the object the URL refers to was last modified atdt.

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

See alsolastModified() andisValid().

void QUrlInfo::setLastRead(constQDateTime & dt)

Specifies that the object the URL refers to was last read atdt.

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

This function was introduced in Qt 4.4.

See alsolastRead() andisValid().

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

Sets the name of the URL toname. 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.

See alsoname() andisValid().

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

Specifies that the owner of the URL is calleds.

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

See alsoowner() andisValid().

[virtual]void QUrlInfo::setPermissions(int p)

Specifies that the URL has access permissionsp.

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

See alsopermissions() andisValid().

[virtual]void QUrlInfo::setReadable(bool b)

Specifies that the URL is readable ifb is true and not readable ifb is false.

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

See alsoisReadable() andisValid().

[virtual]void QUrlInfo::setSize(qint64 size)

Specifies thesize of the URL.

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

See alsosize() andisValid().

[virtual]void QUrlInfo::setSymLink(bool b)

Specifies that the URL refers to a symbolic link ifb is true and that it does not ifb is false.

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

See alsoisSymLink() andisValid().

[virtual]void QUrlInfo::setWritable(bool b)

Specifies that the URL is writable ifb is true and not writable ifb is false.

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

See alsoisWritable() andisValid().

qint64 QUrlInfo::size() const

Returns the size of the URL.

See alsosetSize() andisValid().

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

Returns true if thisQUrlInfo is not equal toother; otherwise returns false.

This function was introduced in Qt 4.2.

See alsolessThan() andequal().

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

Assigns the values ofui to thisQUrlInfo object.

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

Returns true if thisQUrlInfo is equal toother; otherwise returns false.

See alsolessThan() andequal().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp