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

📄 quazipfile.h

📁 以mplayer为后端的QT gui播放器。
💻 H
📖 第 1 页 / 共 2 页
字号:
     * (this is the case when you did not used setFileName() or     * constructor above).     *     * \sa getFileName     **/    QuaZip::CaseSensitivity getCaseSensitivity()const {return caseSensitivity;}    /// Returns the actual file name in the archive.    /** This is \em not a ZIP archive file name, but a name of file inside     * archive. It is not necessary the same name that you have passed     * to the     * QuaZipFile(const QString&,const QString&,QuaZip::CaseSensitivity,QObject*),     * setFileName() or QuaZip::setCurrentFile() - this is the real file     * name inside archive, so it may differ in case if the file name     * search was case-insensitive.     *     * Equivalent to calling getCurrentFileName() on the associated     * QuaZip object. Returns null string if there is no associated     * QuaZip object or if it does not have a current file yet. And this     * is the case if you called setFileName() but did not open the     * file yet. So this is perfectly fine:     * \code     * QuaZipFile file("somezip.zip");     * file.setFileName("somefile");     * QString name=file.getName(); // name=="somefile"     * QString actual=file.getActualFileName(); // actual is null string     * file.open(QIODevice::ReadOnly);     * QString actual=file.getActualFileName(); // actual can be "SoMeFiLe" on Windows     * \endcode     *     * \sa getZipName(), getFileName(), QuaZip::CaseSensitivity     **/    QString getActualFileName()const;    /// Sets the ZIP archive file name.    /** Automatically creates internal QuaZip object and destroys     * previously created internal QuaZip object, if any.     *     * Will do nothing if this file is already open. You must close() it     * first.     **/    void setZipName(const QString& zipName);    /// Returns \c true if the file was opened in raw mode.    /** If the file is not open, the returned value is undefined.     *     * \sa open(OpenMode,int*,int*,bool,const char*)     **/    bool isRaw()const {return raw;}    /// Binds to the existing QuaZip instance.    /** This function destroys internal QuaZip object, if any, and makes     * this QuaZipFile to use current file in the \a zip object for any     * further operations. See QuaZipFile(QuaZip*,QObject*) for the     * possible pitfalls.     *     * Will do nothing if the file is currently open. You must close()     * it first.     **/    void setZip(QuaZip *zip);    /// Sets the file name.    /** Will do nothing if at least one of the following conditions is     * met:     * - ZIP name has not been set yet (getZipName() returns null     *   string).     * - This QuaZipFile is associated with external QuaZip. In this     *   case you should call that QuaZip's setCurrentFile() function     *   instead!     * - File is already open so setting the name is meaningless.     *     * \sa QuaZip::setCurrentFile     **/    void setFileName(const QString& fileName, QuaZip::CaseSensitivity cs =QuaZip::csDefault);    /// Opens a file for reading.    /** Returns \c true on success, \c false otherwise.     * Call getZipError() to get error code.     *     * \note Since ZIP/UNZIP API provides buffered reading only,     * QuaZipFile does not support unbuffered reading. So do not pass     * QIODevice::Unbuffered flag in \a mode, or open will fail.     **/    virtual bool open(OpenMode mode);    /// Opens a file for reading.    /** \overload     * Argument \a password specifies a password to decrypt the file. If     * it is NULL then this function behaves just like open(OpenMode).     **/    bool open(OpenMode mode, const char *password)    {return open(mode, NULL, NULL, false, password);}    /// Opens a file for reading.    /** \overload     * Argument \a password specifies a password to decrypt the file.     *     * An integers pointed by \a method and \a level will receive codes     * of the compression method and level used. See unzip.h.     *     * If raw is \c true then no decompression is performed.     *     * \a method should not be \c NULL. \a level can be \c NULL if you     * don't want to know the compression level.     **/    bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =NULL);    /// Opens a file for writing.    /** \a info argument specifies information about file. It should at     * least specify a correct file name. Also, it is a good idea to     * specify correct timestamp (by default, current time will be     * used). See QuaZipNewInfo.     *     * Arguments \a password and \a crc provide necessary information     * for crypting. Note that you should specify both of them if you     * need crypting. If you do not, pass \c NULL as password, but you     * still need to specify \a crc if you are going to use raw mode     * (see below).     *     * Arguments \a method and \a level specify compression method and     * level.     *     * If \a raw is \c true, no compression is performed. In this case,     * \a crc and uncompressedSize field of the \a info are required.     *     * Arguments \a windowBits, \a memLevel, \a strategy provide zlib     * algorithms tuning. See deflateInit2() in zlib.     **/    bool open(OpenMode mode, const QuaZipNewInfo& info,        const char *password =NULL, quint32 crc =0,        int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false,        int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY);    /// Returns \c true, but \ref quazipfile-sequential "beware"!    virtual bool isSequential()const;    /// Returns current position in the file.    /** Implementation of the QIODevice::pos(). When reading, this     * function is a wrapper to the ZIP/UNZIP unztell(), therefore it is     * unable to keep track of the ungetChar() calls (which is     * non-virtual and therefore is dangerous to reimplement). So if you     * are using ungetChar() feature of the QIODevice, this function     * reports incorrect value until you get back characters which you     * ungot.     *     * When writing, pos() returns number of bytes already written     * (uncompressed unless you use raw mode).     *     * \note Although     * \ref quazipfile-sequential "QuaZipFile is a sequential device"     * and therefore pos() should always return zero, it does not,     * because it would be misguiding. Keep this in mind.     *     * This function returns -1 if the file or archive is not open.     *     * Error code returned by getZipError() is not affected by this     * function call.     **/    virtual qint64 pos()const;    /// Returns \c true if the end of file was reached.    /** This function returns \c false in the case of error. This means     * that you called this function on either not open file, or a file     * in the not open archive or even on a QuaZipFile instance that     * does not even have QuaZip instance associated. Do not do that     * because there is no means to determine whether \c false is     * returned because of error or because end of file was reached.     * Well, on the other side you may interpret \c false return value     * as "there is no file open to check for end of file and there is     * no end of file therefore".     *     * When writing, this function always returns \c true (because you     * are always writing to the end of file).     *     * Error code returned by getZipError() is not affected by this     * function call.     **/    virtual bool atEnd()const;    /// Returns file size.    /** This function returns csize() if the file is open for reading in     * raw mode, usize() if it is open for reading in normal mode and     * pos() if it is open for writing.     *     * Returns -1 on error, call getZipError() to get error code.     *     * \note This function returns file size despite that     * \ref quazipfile-sequential "QuaZipFile is considered to be sequential device",     * for which size() should return bytesAvailable() instead. But its     * name would be very misguiding otherwise, so just keep in mind     * this inconsistence.     **/    virtual qint64 size()const;    /// Returns compressed file size.    /** Equivalent to calling getFileInfo() and then getting     * compressedSize field, but more convenient and faster.     *     * File must be open for reading before calling this function.     *     * Returns -1 on error, call getZipError() to get error code.     **/    qint64 csize()const;    /// Returns uncompressed file size.    /** Equivalent to calling getFileInfo() and then getting     * uncompressedSize field, but more convenient and faster. See     * getFileInfo() for a warning.     *     * File must be open for reading before calling this function.     *     * Returns -1 on error, call getZipError() to get error code.     **/    qint64 usize()const;    /// Gets information about current file.    /** This function does the same thing as calling     * QuaZip::getCurrentFileInfo() on the associated QuaZip object,     * but you can not call getCurrentFileInfo() if the associated     * QuaZip is internal (because you do not have access to it), while     * you still can call this function in that case.     *     * File must be open for reading before calling this function.     *     * Returns \c false in the case of an error.     **/    bool getFileInfo(QuaZipFileInfo *info);    /// Closes the file.    /** Call getZipError() to determine if the close was successful.     **/    virtual void close();    /// Returns the error code returned by the last ZIP/UNZIP API call.    int getZipError()const {return zipError;}};#endif

⌨️ 快捷键说明

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