KDECore
karchive.cpp
Go to the documentation of this file.
140 kWarning() << "KSaveFile creation for " << d->fileName << " failed, " << d->saveFile->errorString();
401 d->rootDir = new KArchiveDirectory( this, QLatin1String("/"), (int)(0777 + S_IFDIR), 0, username, groupname, QString() );
409 if ( path.isEmpty() || path == QLatin1String("/") || path == QLatin1String(".") ) // root dir => found
447 //kDebug() << "found parent " << parent->name() << " adding " << dirname << " to ensure " << path;
825 kDebug() << "symlink(" << curEntry->symLinkTarget() << ',' << linkName << ") failed:" << strerror(errno);
850 qSort( fileList.begin(), fileList.end(), sortByPosition ); // sort on d->pos, so we have a linear access
852 for ( QList<const KArchiveFile*>::const_iterator it = fileList.constBegin(), end = fileList.constEnd() ;
virtual bool writeDir(const QString &name, const QString &user, const QString &group, mode_t perm=040755, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime)
If an archive is opened for writing then you can add new directories using this function.
Definition: karchive.cpp:359
KArchiveEntry(KArchive *archive, const QString &name, int access, int date, const QString &user, const QString &group, const QString &symlink)
Creates a new entry.
Definition: karchive.cpp:527
virtual KArchiveDirectory * rootDir()
Retrieves or create the root directory.
Definition: karchive.cpp:391
virtual bool isDirectory() const
Checks whether the entry is a directory.
Definition: karchive.cpp:581
KArchive(const QString &fileName)
Base constructor (protected since this is a pure virtual class).
Definition: karchive.cpp:81
virtual bool createDevice(QIODevice::OpenMode mode)
Can be reimplemented in order to change the creation of the device (when using the fileName construct...
Definition: karchive.cpp:131
Definition: kmacroexpander_unix.cpp:34
virtual bool isDirectory() const
Checks whether this entry is a directory.
Definition: karchive.cpp:791
Class to allow for atomic file I/O, as well as utility functions.
Definition: ksavefile.h:96
void setSize(qint64 s)
Set size of data, usually after writing the file.
Definition: karchive.cpp:630
virtual bool openArchive(QIODevice::OpenMode mode)=0
Opens an archive for reading or writing.
QIODevice::OpenMode mode() const
Returns the mode in which the archive was opened.
Definition: karchive.cpp:470
virtual bool writeFile(const QString &name, const QString &user, const QString &group, const char *data, qint64 size, mode_t perm=0100644, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime)
If an archive is opened for writing then you can add a new file using this function.
Definition: karchive.cpp:319
qint64 position() const
Position of the data in the [uncompressed] archive.
Definition: karchive.cpp:620
KArchiveFile(KArchive *archive, const QString &name, int access, int date, const QString &user, const QString &group, const QString &symlink, qint64 pos, qint64 size)
Creates a new file entry.
Definition: karchive.cpp:606
virtual bool writeData(const char *data, qint64 size)
Write data into the current file - to be called after calling prepareWriting.
Definition: karchive.cpp:345
virtual bool prepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm=0100644, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime)
Here's another way of writing a file into an archive: Call prepareWriting(), then call writeData() as...
Definition: karchive.cpp:375
virtual bool open(QIODevice::OpenMode mode)
Opens the archive for reading or writing.
Definition: karchive.cpp:104
static bool sortByPosition(const KArchiveFile *file1, const KArchiveFile *file2)
Definition: karchive.cpp:796
virtual QIODevice * createDevice() const
This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice...
Definition: karchive.cpp:652
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:485
virtual bool finishWriting(qint64 size)
Call finishWriting after writing the data.
Definition: karchive.cpp:386
void copyTo(const QString &dest) const
Extracts the file to the directory dest.
Definition: karchive.cpp:662
A readonly device that reads from an underlying device from a given point to another (e...
Definition: klimitediodevice_p.h:31
KArchiveDirectory(KArchive *archive, const QString &name, int access, int date, const QString &user, const QString &group, const QString &symlink)
Creates a new directory entry.
Definition: karchive.cpp:702
virtual bool doWriteSymLink(const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)=0
Writes a symbolic link to the archive.
bool addLocalFile(const QString &fileName, const QString &destName)
Writes a local file into the archive.
Definition: karchive.cpp:205
virtual bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)=0
Write a directory to the archive.
void copyTo(const QString &dest, bool recursive=true) const
Extracts all entries in this archive directory to the directory dest.
Definition: karchive.cpp:800
const KArchiveEntry * entry(const QString &name) const
Returns the entry with the given name.
Definition: karchive.cpp:721
virtual bool doPrepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, time_t atime, time_t mtime, time_t ctime)=0
This virtual method must be implemented by subclasses.
KArchiveDirectory * findOrCreate(const QString &path)
Ensures that path exists, create otherwise.
Definition: karchive.cpp:406
virtual bool writeSymLink(const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm=0120755, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime)
Writes a symbolic link to the archive if supported.
Definition: karchive.cpp:366
void setRootDir(KArchiveDirectory *rootDir)
Derived classes call setRootDir from openArchive, to set the root directory after parsing an existing...
Definition: karchive.cpp:464
const KArchiveDirectory * directory() const
If an archive is opened for reading, then the contents of the archive can be accessed via this functi...
Definition: karchive.cpp:198
virtual void virtual_hook(int id, void *data)
Definition: karchive.cpp:869
void setDevice(QIODevice *dev)
Can be called by derived classes in order to set the underlying device.
Definition: karchive.cpp:456
bool addLocalDirectory(const QString &path, const QString &destName)
Writes a local directory into the archive, including all its contents, recursively.
Definition: karchive.cpp:293
mode_t permissions() const
The permissions and mode flags as returned by the stat() function in st_mode.
Definition: karchive.cpp:556
Definition: kaboutdata.h:33
virtual void virtual_hook(int id, void *data)
Definition: karchive.cpp:863
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.