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

📄 qurlinfo.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    Specifies the \a size of the URL.    If you call this function for an invalid URL info, this function    turns it into a valid one.    \sa isValid()*/void QUrlInfo::setSize(qint64 size){    if (!d)        d = new QUrlInfoPrivate;    d->size = size;}/*!    Specifies that the URL has access permissions \a p.    If you call this function for an invalid URL info, this function    turns it into a valid one.    \sa isValid()*/void QUrlInfo::setPermissions(int p){    if (!d)        d = new QUrlInfoPrivate;    d->permissions = p;}/*!    Specifies that the object the URL refers to was last modified at    \a dt.    If you call this function for an invalid URL info, this function    turns it into a valid one.    \sa isValid()*/void QUrlInfo::setLastModified(const QDateTime &dt){    if (!d)        d = new QUrlInfoPrivate;    d->lastModified = dt;}/*!    Destroys the URL info object.*/QUrlInfo::~QUrlInfo(){    delete d;}/*!    Assigns the values of \a ui to this QUrlInfo object.*/QUrlInfo &QUrlInfo::operator=(const QUrlInfo &ui){    if (ui.d) {        if (!d)            d= new QUrlInfoPrivate;        *d = *ui.d;    } else {        delete d;        d = 0;    }    return *this;}/*!    Returns the file name of the URL.    \sa isValid()*/QString QUrlInfo::name() const{    if (!d)        return QString();    return d->name;}/*!    Returns the permissions of the URL. You can use the \c PermissionSpec flags    to test for certain permissions.    \sa isValid()*/int QUrlInfo::permissions() const{    if (!d)        return 0;    return d->permissions;}/*!    Returns the owner of the URL.    \sa isValid()*/QString QUrlInfo::owner() const{    if (!d)        return QString();    return d->owner;}/*!    Returns the group of the URL.    \sa isValid()*/QString QUrlInfo::group() const{    if (!d)        return QString();    return d->group;}/*!    Returns the size of the URL.    \sa isValid()*/qint64 QUrlInfo::size() const{    if (!d)        return 0;    return d->size;}/*!    Returns the last modification date of the URL.    \sa isValid()*/QDateTime QUrlInfo::lastModified() const{    if (!d)        return QDateTime();    return d->lastModified;}/*!    Returns the date when the URL was last read.    \sa isValid()*/QDateTime QUrlInfo::lastRead() const{    if (!d)        return QDateTime();    return d->lastRead;}/*!    Returns true if the URL is a directory; otherwise returns false.    \sa isValid()*/bool QUrlInfo::isDir() const{    if (!d)        return false;    return d->isDir;}/*!    Returns true if the URL is a file; otherwise returns false.    \sa isValid()*/bool QUrlInfo::isFile() const{    if (!d)        return false;    return d->isFile;}/*!    Returns true if the URL is a symbolic link; otherwise returns false.    \sa isValid()*/bool QUrlInfo::isSymLink() const{    if (!d)        return false;    return d->isSymLink;}/*!    Returns true if the URL is writable; otherwise returns false.    \sa isValid()*/bool QUrlInfo::isWritable() const{    if (!d)        return false;    return d->isWritable;}/*!    Returns true if the URL is readable; otherwise returns false.    \sa isValid()*/bool QUrlInfo::isReadable() const{    if (!d)        return false;    return d->isReadable;}/*!    Returns true if the URL is executable; otherwise returns false.    \sa isValid()*/bool QUrlInfo::isExecutable() const{    if (!d)        return false;    return d->isExecutable;}/*!    Returns true if \a i1 is greater than \a i2; otherwise returns    false. The objects are compared by the value, which is specified    by \a sortBy. This must be one of QDir::Name, QDir::Time or    QDir::Size.*/bool QUrlInfo::greaterThan(const QUrlInfo &i1, const QUrlInfo &i2,                            int sortBy){    switch (sortBy) {    case QDir::Name:        return i1.name() > i2.name();    case QDir::Time:        return i1.lastModified() > i2.lastModified();    case QDir::Size:        return i1.size() > i2.size();    default:        return false;    }}/*!    Returns true if \a i1 is less than \a i2; otherwise returns false.    The objects are compared by the value, which is specified by \a    sortBy. This must be one of QDir::Name, QDir::Time or QDir::Size.*/bool QUrlInfo::lessThan(const QUrlInfo &i1, const QUrlInfo &i2,                         int sortBy){    return !greaterThan(i1, i2, sortBy);}/*!    Returns true if \a i1 equals to \a i2; otherwise returns false.    The objects are compared by the value, which is specified by \a    sortBy. This must be one of QDir::Name, QDir::Time or QDir::Size.*/bool QUrlInfo::equal(const QUrlInfo &i1, const QUrlInfo &i2,                      int sortBy){    switch (sortBy) {    case QDir::Name:        return i1.name() == i2.name();    case QDir::Time:        return i1.lastModified() == i2.lastModified();    case QDir::Size:        return i1.size() == i2.size();    default:        return false;    }}/*!    Returns true if this QUrlInfo is equal to \a other; otherwise    returns false.    \sa lessThan(), equal()*/bool QUrlInfo::operator==(const QUrlInfo &other) const{    if (!d)        return other.d == 0;    if (!other.d)        return false;    return (d->name == other.d->name &&            d->permissions == other.d->permissions &&            d->owner == other.d->owner &&            d->group == other.d->group &&            d->size == other.d->size &&            d->lastModified == other.d->lastModified &&            d->lastRead == other.d->lastRead &&            d->isDir == other.d->isDir &&            d->isFile == other.d->isFile &&            d->isSymLink == other.d->isSymLink &&            d->isWritable == other.d->isWritable &&            d->isReadable == other.d->isReadable &&            d->isExecutable == other.d->isExecutable);}/*!    \fn bool QUrlInfo::operator!=(const QUrlInfo &other) const    \since 4.2    Returns true if this QUrlInfo is not equal to \a other; otherwise    returns false.    \sa lessThan(), equal()*//*!    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::isValid() const{    return d != 0;}#endif // QT_NO_URLINFO

⌨️ 快捷键说明

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