Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QUrlInfo Class Reference
[QtNetwork module]

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

 #include <QUrlInfo>

This class is not part of the Qt GUI Framework Edition.


Public Types

enum PermissionSpec { 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 ()
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

Static Public Members

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 )

Detailed Description

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() and isExecutable().

You can create your own 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.

See also QUrl and FTP Example.


Member Type Documentation

enum QUrlInfo::PermissionSpec

This enum is used by the permissions() 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 invalid QUrlInfo object with default values.

See also isValid().

QUrlInfo::QUrlInfo ( const QUrlInfo & ui )

Copy constructor, copies 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 )

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 ( 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 )

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.

bool QUrlInfo::equal ( const QUrlInfo & i1, const QUrlInfo & i2, int sortBy )   [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 ( const QUrlInfo & i1, const QUrlInfo & i2, int sortBy )   [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 setGroup() and isValid().

bool QUrlInfo::isDir () const

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

See also isValid().

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.

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 setLastModified() and isValid().

QDateTime QUrlInfo::lastRead () const

Returns the date when the URL was last read.

See also setLastRead() and isValid().

bool QUrlInfo::lessThan ( const QUrlInfo & i1, const QUrlInfo & i2, int sortBy )   [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 setName() and isValid().

QString QUrlInfo::owner () const

Returns the owner of the URL.

See also setOwner() and isValid().

int QUrlInfo::permissions () const

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

See also setPermissions() and isValid().

void QUrlInfo::setDir ( bool b )   [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 isDir() and isValid().

void QUrlInfo::setFile ( bool b )   [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 isFile() and isValid().

void QUrlInfo::setGroup ( const QString & 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 group() and isValid().

void QUrlInfo::setLastModified ( const QDateTime & 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 lastModified() and 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.

This function was introduced in Qt 4.4.

See also lastRead() and isValid().

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

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.

See also name() and isValid().

void QUrlInfo::setOwner ( const QString & 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 owner() and isValid().

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

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.

See also permissions() and isValid().

void QUrlInfo::setReadable ( bool b )   [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 isReadable() and isValid().

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

Specifies the size of the URL.

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

See also size() and isValid().

void QUrlInfo::setSymLink ( bool b )   [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 isSymLink() and isValid().

void QUrlInfo::setWritable ( bool b )   [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 isWritable() and isValid().

qint64 QUrlInfo::size () const

Returns the size of the URL.

See also setSize() and isValid().

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

Returns true if this QUrlInfo is not equal to other; otherwise returns false.

This function was introduced in Qt 4.2.

See also lessThan() and equal().

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

Assigns the values of ui to this QUrlInfo object.

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

Returns true if this QUrlInfo is equal to other; otherwise returns false.

See also lessThan() and equal().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web