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;
836 kDebug() << "symlink(" << curEntry->symLinkTarget() << ',' << linkName << ") failed:" << strerror(errno);
861 qSort( fileList.begin(), fileList.end(), sortByPosition ); // sort on d->pos, so we have a linear access
863 for ( QList<const KArchiveFile*>::const_iterator it = fileList.constBegin(), end = fileList.constEnd() ;
typedef OpenMode
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
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QString symLinkTarget() const
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
T pop()
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
virtual bool seek(qint64 pos)
Definition: kmacroexpander_unix.cpp:34
void push(const T &t)
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
bool isSymLink() const
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
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
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
void resize(int size)
bool isFile() const
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
void setFilter(QFlags< QDir::Filter > filters)
QString number(int n, int base)
bool exists() const
void append(const T &value)
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
bool isDir() 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:485
bool isEmpty() const
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
qint64 read(char *data, qint64 maxSize)
QString group() const
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
Definition: kaboutdata.h:33
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.
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
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.
iterator end()
const T value(const Key &key) const
qint64 size() const
QByteArray toLocal8Bit() const
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
QString owner() const
virtual void close()
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.
QString cleanPath(const QString &path)
KArchiveDirectory * findOrCreate(const QString &path)
Ensures that path exists, create otherwise.
Definition: karchive.cpp:406
QString mid(int position, int n) const
bool isEmpty() const
bool mkdir(const QString &dirName) const
QStringList entryList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
typedef ConstIterator
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
int length() const
char * data()
void setRootDir(KArchiveDirectory *rootDir)
Derived classes call setRootDir from openArchive, to set the root directory after parsing an existing...
Definition: karchive.cpp:464
QString left(int n) const
qint64 write(const char *data, qint64 maxSize)
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:880
iterator insert(const Key &key, const T &value)
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
const_iterator constEnd() const
const_iterator constBegin() const
int size() const
mode_t permissions() const
The permissions and mode flags as returned by the stat() function in st_mode.
Definition: karchive.cpp:556
iterator begin()
QByteArray encodeName(const QString &fileName)
QString decodeName(const QByteArray &localFileName)
void setTime_t(uint seconds)
virtual void virtual_hook(int id, void *data)
Definition: karchive.cpp:874
Filters filter() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.