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

📄 qfileinfo.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/*!    Use absoluteDir() or the dir() overload that takes no parameters    instead.*/QDir QFileInfo::dir(bool absPath) const{    if(absPath)        return absoluteDir();    return dir();}#endif //QT3_SUPPORT/*!    Returns true if the user can read the file; otherwise returns false.    \sa isWritable(), isExecutable(), permission()*/boolQFileInfo::isReadable() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->hasAccess(QFileInfoPrivate::ReadAccess);}/*!    Returns true if the user can write to the file; otherwise returns false.    \sa isReadable(), isExecutable(), permission()*/boolQFileInfo::isWritable() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->hasAccess(QFileInfoPrivate::WriteAccess);}/*!    Returns true if the file is executable; otherwise returns false.    \sa isReadable(), isWritable(), permission()*/boolQFileInfo::isExecutable() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->hasAccess(QFileInfoPrivate::ExecuteAccess);}/*!    Returns true if this is a `hidden' file; otherwise returns false.    \bold{Note:} This function returns true for the special entries    "." and ".." on Unix, even though QDir::entryList threats them as shown.*/boolQFileInfo::isHidden() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->getFileFlags(QAbstractFileEngine::HiddenFlag);}/*!    Returns true if this object points to a file or to a symbolic    link to a file. Returns false if the    object points to something which isn't a file, such as a directory.    \sa isDir(), isSymLink(), isBundle()*/boolQFileInfo::isFile() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->getFileFlags(QAbstractFileEngine::FileType);}/*!    Returns true if this object points to a directory or to a symbolic    link to a directory; otherwise returns false.    \sa isFile(), isSymLink(), isBundle()*/boolQFileInfo::isDir() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->getFileFlags(QAbstractFileEngine::DirectoryType);}/*!    \since 4.3    Returns true if this object points to a bundle or to a symbolic    link to a bundle on Mac OS X; otherwise returns false.    \sa isDir(), isSymLink(), isFile()*/boolQFileInfo::isBundle() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->getFileFlags(QAbstractFileEngine::BundleType);}/*!    Returns true if this object points to a symbolic link (or to a    shortcut on Windows); otherwise returns false.    On Unix (including Mac OS X), opening a symlink effectively opens    the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c    .lnk file itself.    Example:    \code        QFileInfo info(fileName);        if (info.isSymLink())            fileName = info.symLinkTarget();    \endcode    \sa isFile(), isDir(), symLinkTarget()*/boolQFileInfo::isSymLink() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->getFileFlags(QAbstractFileEngine::LinkType);}/*!  Returns true if the object points to a directory or to a symbolic  link to a directory, and that directory is the root directory; otherwise  returns false.*/boolQFileInfo::isRoot() const{    Q_D(const QFileInfo);    if (!d->data->fileEngine)        return true;    return d->getFileFlags(QAbstractFileEngine::RootFlag);}/*!    \fn QString QFileInfo::symLinkTarget() const    \since 4.2    Returns the absolute path to the file or directory a symlink (or shortcut    on Windows) points to, or a an empty string if the object isn't a symbolic    link.    This name may not represent an existing file; it is only a string.    QFileInfo::exists() returns true if the symlink points to an    existing file.    \sa exists(), isSymLink(), isDir(), isFile()*//*!    \obsolete    Use symLinkTarget() instead.*/QStringQFileInfo::readLink() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return QLatin1String("");    return d->getFileName(QAbstractFileEngine::LinkName);}/*!    Returns the owner of the file. On systems where files    do not have owners, or if an error occurs, an empty string is    returned.    This function can be time consuming under Unix (in the order of    milliseconds).    \sa ownerId(), group(), groupId()*/QStringQFileInfo::owner() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return QLatin1String("");    return d->data->fileEngine->owner(QAbstractFileEngine::OwnerUser);}/*!    Returns the id of the owner of the file.    On Windows and on systems where files do not have owners this    function returns ((uint) -2).    \sa owner(), group(), groupId()*/uintQFileInfo::ownerId() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return 0;    return d->data->fileEngine->ownerId(QAbstractFileEngine::OwnerUser);}/*!    Returns the group of the file. On Windows, on systems where files    do not have groups, or if an error occurs, an empty string is    returned.    This function can be time consuming under Unix (in the order of    milliseconds).    \sa groupId(), owner(), ownerId()*/QStringQFileInfo::group() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return QLatin1String("");    return d->data->fileEngine->owner(QAbstractFileEngine::OwnerGroup);}/*!    Returns the id of the group the file belongs to.    On Windows and on systems where files do not have groups this    function always returns (uint) -2.    \sa group(), owner(), ownerId()*/uintQFileInfo::groupId() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return 0;    return d->data->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup);}/*!    Tests for file permissions. The \a permissions argument can be    several flags of type QFile::Permissions OR-ed together to check    for permission combinations.    On systems where files do not have permissions this function    always returns true.    Example:    \code        QFileInfo fi("/tmp/archive.tar.gz");        if (fi.permission(QFile::WriteUser | QFile::ReadGroup))            qWarning("I can change the file; my group can read the file");        if (fi.permission(QFile::WriteGroup | QFile::WriteOther))            qWarning("The group or others can change the file");    \endcode    \sa isReadable(), isWritable(), isExecutable()*/boolQFileInfo::permission(QFile::Permissions permissions) const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return false;    return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions;}/*!    Returns the complete OR-ed together combination of    QFile::Permissions for the file.*/QFile::PermissionsQFileInfo::permissions() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return 0;    return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask);}/*!    Returns the file size in bytes. If the file does not exist or cannot be    fetched, 0 is returned.    \sa exists()*/qint64QFileInfo::size() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return 0;    if(!d->data->getCachedFlag(QFileInfoPrivate::CachedSize)) {        d->data->setCachedFlag(QFileInfoPrivate::CachedSize);        d->data->fileSize = d->data->fileEngine->size();    }    return d->data->fileSize;}/*!    Returns the date and time when the file was created.    On most Unix systems, this function returns the time of the last    status change. A status change occurs when the file is created,    but it also occurs whenever the user writes or sets inode    information (for example, changing the file permissions).    If neither creation time nor "last status change" time are not    available, returns the same as lastModified().    \sa lastModified() lastRead()*/QDateTimeQFileInfo::created() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return QDateTime();    return d->getFileTime(QAbstractFileEngine::CreationTime);}/*!    Returns the date and time when the file was last modified.    \sa created() lastRead()*/QDateTimeQFileInfo::lastModified() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return QDateTime();    return d->getFileTime(QAbstractFileEngine::ModificationTime);}/*!    Returns the date and time when the file was last read (accessed).    On platforms where this information is not available, returns the    same as lastModified().    \sa created() lastModified()*/QDateTimeQFileInfo::lastRead() const{    Q_D(const QFileInfo);    if(!d->data->fileEngine)        return QDateTime();    return d->getFileTime(QAbstractFileEngine::AccessTime);}/*! \internal    Detaches all internal data.*/voidQFileInfo::detach(){    Q_D(QFileInfo);    d->detach();}/*!    Returns true if caching is enabled; otherwise returns false.    \sa setCaching(), refresh()*/bool QFileInfo::caching() const{    Q_D(const QFileInfo);    return d->data->cache_enabled;}/*!    If \a enable is true, enables caching of file information. If \a    enable is false caching is disabled.    When caching is enabled, QFileInfo reads the file information from    the file system the first time it's needed, but generally not    later.    Caching is enabled by default.    \sa refresh(), caching()*/voidQFileInfo::setCaching(bool enable){    Q_D(QFileInfo);    detach();    d->data->cache_enabled = enable;}/*!    \fn QString QFileInfo::baseName(bool complete)    Use completeBaseName() or the baseName() overload that takes no    parameters instead.*//*!    \fn QString QFileInfo::extension(bool complete = true) const    Use completeSuffix() or suffix() instead.*//*!    \fn QString QFileInfo::absFilePath() const    Use absoluteFilePath() instead.*//*!    \fn bool QFileInfo::convertToAbs()    Use makeAbsolute() instead.*//*!    \enum QFileInfo::Permission    \compat    \value ReadOwner    \value WriteOwner    \value ExeOwner    \value ReadUser    \value WriteUser    \value ExeUser    \value ReadGroup    \value WriteGroup    \value ExeGroup    \value ReadOther    \value WriteOther    \value ExeOther*//*!    \fn bool QFileInfo::permission(PermissionSpec permissions) const    \compat    Use permission() instead.*//*!    \typedef QFileInfoList    \relates QFileInfo    Synonym for QList<QFileInfo>.*/

⌨️ 快捷键说明

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