KArchive
kzip.cpp
129 pfi.mtime = uint((uchar)buffer[0] | (uchar)buffer[1] << 8 | (uchar)buffer[2] << 16 | (uchar)buffer[3] << 24);
145 pfi.atime = uint((uchar)buffer[0] | (uchar)buffer[1] << 8 | (uchar)buffer[2] << 16 | (uchar)buffer[3] << 24);
155 pfi.ctime = uint((uchar)buffer[0] | (uchar)buffer[1] << 8 | (uchar)buffer[2] << 16 | (uchar)buffer[3] << 24);
183 pfi.atime = uint((uchar)buffer[0] | (uchar)buffer[1] << 8 | (uchar)buffer[2] << 16 | (uchar)buffer[3] << 24);
185 pfi.mtime = uint((uchar)buffer[0] | (uchar)buffer[1] << 8 | (uchar)buffer[2] << 16 | (uchar)buffer[3] << 24);
390 QList<KZipFileEntry *> m_fileList; // flat list of all files, for the index (saves a recursive method ;)
477 const qint64 compr_size = uint(uchar(buffer[12])) | uint(uchar(buffer[13])) << 8 | uint(uchar(buffer[14])) << 16 | uint(uchar(buffer[15])) << 24;
478 const qint64 uncomp_size = uint(uchar(buffer[16])) | uint(uchar(buffer[17])) << 8 | uint(uchar(buffer[18])) << 16 | uint(uchar(buffer[19])) << 24;
536 // qCDebug(KArchiveLog) << "general purpose bit flag indicates, that local file header contains valid size";
611 setErrorString(tr("Invalid ZIP file, central entry too short (not long enough for valid entry)"));
645 uint crc32 = (uchar)buffer[19] << 24 | (uchar)buffer[18] << 16 | (uchar)buffer[17] << 8 | (uchar)buffer[16];
648 uint ucsize = (uchar)buffer[27] << 24 | (uchar)buffer[26] << 16 | (uchar)buffer[25] << 8 | (uchar)buffer[24];
650 uint csize = (uchar)buffer[23] << 24 | (uchar)buffer[22] << 16 | (uchar)buffer[21] << 8 | (uchar)buffer[20];
653 uint localheaderoffset = (uchar)buffer[45] << 24 | (uchar)buffer[44] << 16 | (uchar)buffer[43] << 8 | (uchar)buffer[42];
665 uint dataoffset = localheaderoffset + 30 + localextralen + namelen; // comment only in central header
709 entry = new KArchiveDirectory(this, entryName, access, mtime, rootDir()->user(), rootDir()->group(), QString());
710 // qCDebug(KArchiveLog) << "KArchiveDirectory created, entryName= " << entryName << ", name=" << name;
719 new KZipFileEntry(this, entryName, access, mtime, rootDir()->user(), rootDir()->group(), symlink, name, dataoffset, ucsize, cmethod, csize);
722 // qCDebug(KArchiveLog) << "KZipFileEntry created, entryName= " << entryName << ", name=" << name;
737 setErrorString(tr("File %1 is in folder %2, but %3 is actually a file.").arg(entryName, path, path));
1011 // However, to support empty directories, we must create a dummy file entry which ends with '/'.
1209 setErrorString(tr("Could not open compression device: %1").arg(d->m_currentDev->errorString()));
1235 int csize = device()->pos() - d->m_currentFile->headerStart() - 30 - encodedName.length() - extra_field_len;
1433 // qCDebug(KArchiveLog) << "creating iodevice limited to pos=" << position() << ", csize=" << compressedSize();
1435 KLimitedIODevice *limitedDev = new KLimitedIODevice(archive()->device(), position(), compressedSize());
1442 KCompressionDevice *filterDev = new KCompressionDevice(limitedDev, true, KCompressionDevice::GZip);
KZipFileEntry(KZip *zip, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink, const QString &path, qint64 start, qint64 uncompressedSize, int encoding, qint64 compressedSize)
Creates a new zip file entry.
Definition: kzip.cpp:1355
bool writeData(const char *data, qint64 size) override
Write data to a file that has been created using prepareWriting().
Definition: kzip.cpp:1291
const T value(const Key &key) const const
int month() const const
T & value()
typedef OpenMode
int size() const const
bool doPrepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &creationTime) override
Reimplemented from KArchive.
Definition: kzip.cpp:1019
QDateTime currentDateTime()
Definition: kcompressiondevice.h:30
QByteArray encodeName(const QString &fileName)
QTime time() const const
int year() const const
Q_SCRIPTABLE Q_NOREPLY void start()
virtual bool seek(qint64 pos)
bool doFinishWriting(qint64 size) override
Write data to a file that has been created using prepareWriting().
Definition: kzip.cpp:1215
virtual KArchiveDirectory * rootDir()
Retrieves or create the root directory.
Definition: karchive.cpp:500
void setSkipHeaders()
Call this let this device skip the gzip headers when reading/writing.
Definition: kcompressiondevice.cpp:507
QHash::iterator insert(const Key &key, const T &value)
T & next()
void remove()
bool doWriteSymLink(const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
Reimplemented from KArchive.
Definition: kzip.cpp:1251
void setCompression(Compression c)
Call this before writeFile or prepareWriting, to define whether the next files to be written should b...
Definition: kzip.cpp:1315
void setExtraField(ExtraField ef)
Call this before writeFile or prepareWriting, to define what the next file to be written should have ...
Definition: kzip.cpp:1325
bool hasNext() const const
virtual qint64 pos() const const
QString fileName() const
The name of the archive file, as passed to the constructor that takes a fileName, or an empty string ...
Definition: karchive.cpp:619
virtual qint64 size() const const
bool isEmpty() const const
KZip(const QString &filename)
Creates an instance that operates on the given filename.
Definition: kzip.cpp:400
bool finishWriting(qint64 size)
Call finishWriting after writing the data.
Definition: karchive.cpp:460
int hour() const const
QIODevice::OpenMode mode() const
Returns the mode in which the archive was opened.
Definition: karchive.cpp:604
QString cleanPath(const QString &path)
qint64 read(char *data, qint64 maxSize)
const QString & path() const
Name with complete path - KArchiveFile::name() is the filename only (no path)
Definition: kzip.cpp:1415
qint64 toSecsSinceEpoch() const const
bool open(QIODevice::OpenMode mode) override
Open for reading or writing.
Definition: kcompressiondevice.cpp:230
const char * constData() const const
int second() const const
QDate date() const const
Definition: kzipfileentry.h:18
bool isValid() const const
~KZip() override
If the zip file is still opened, then it will be closed automatically by the destructor.
Definition: kzip.cpp:412
int size() const const
bool openArchive(QIODevice::OpenMode mode) override
Opens the archive for reading.
Definition: kzip.cpp:421
bool writeFile(const QString &name, const QString &user, const QString &group, const char *data, qint64 size, mode_t perm=0100644, const QDateTime &atime=QDateTime(), const QDateTime &mtime=QDateTime(), const QDateTime &ctime=QDateTime())
Definition: karchive.h:199
QByteArray readAll()
int length() const const
bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
Reimplemented from KArchive.
Definition: kzip.cpp:1001
Compression compression() const
The current compression mode that will be used for new files.
Definition: kzip.cpp:1320
KArchiveDirectory * findOrCreate(const QString &path)
Ensures that path exists, create otherwise.
Definition: karchive.cpp:512
qint64 position() const
Position of the data in the [uncompressed] archive.
Definition: karchive.cpp:771
void toFront()
int minute() const const
void setHeaderStart(qint64 headerstart)
Header start: only used when writing.
Definition: kzip.cpp:1395
QString & append(QChar ch)
virtual bool isDirectory() const
Checks whether the entry is a directory.
Definition: karchive.cpp:726
const KArchiveEntry * entry(const QString &name) const
Returns the entry in the archive with the given name.
Definition: karchive.cpp:888
ExtraField extraField() const
The current type of "extra field" that will be used for new files.
Definition: kzip.cpp:1330
QIODevice * createDevice() const override
This method returns a QIODevice to read the file contents.
Definition: kzip.cpp:1431
ExtraField
Describes the contents of the "extra field" for a given file in the Zip archive.
Definition: kzip.h:68
int access(const QString &path, int mode)
qint64 write(const char *data, qint64 maxSize)
QString decodeName(const QByteArray &localFileName)
int day() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 04:04:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 04:04:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.