KArchive Class Reference
#include <karchive.h>
Inheritance diagram for KArchive:

Detailed Description
KArchive is a base class for reading and writing archives.generic class for reading/writing archives.
- Author:
- David Faure <faure@kde.org>
Definition at line 42 of file karchive.h.
Public Member Functions | |
virtual | ~KArchive () |
virtual bool | open (int mode) |
virtual void | close () |
bool | closeSucceeded () const |
bool | isOpened () const |
int | mode () const |
QIODevice * | device () const |
const KArchiveDirectory * | directory () const |
bool | addLocalFile (const QString &fileName, const QString &destName) |
bool | addLocalDirectory (const QString &path, const QString &destName) |
virtual bool | writeDir (const QString &name, const QString &user, const QString &group)=0 |
bool | writeDir (const QString &name, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
bool | writeSymLink (const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
virtual bool | writeFile (const QString &name, const QString &user, const QString &group, uint size, const char *data) |
bool | writeFile (const QString &name, const QString &user, const QString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime, const char *data) |
virtual bool | prepareWriting (const QString &name, const QString &user, const QString &group, uint size)=0 |
bool | prepareWriting (const QString &name, const QString &user, const QString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
bool | writeData (const char *data, uint size) |
virtual bool | doneWriting (uint size)=0 |
Protected Types | |
enum | { VIRTUAL_WRITE_DATA = 1, VIRTUAL_WRITE_SYMLINK, VIRTUAL_WRITE_DIR, VIRTUAL_WRITE_FILE, VIRTUAL_PREPARE_WRITING } |
Protected Member Functions | |
KArchive (QIODevice *dev) | |
virtual bool | openArchive (int mode)=0 |
virtual bool | closeArchive ()=0 |
virtual KArchiveDirectory * | rootDir () |
KArchiveDirectory * | findOrCreate (const QString &path) |
void | setDevice (QIODevice *dev) |
void | setRootDir (KArchiveDirectory *rootDir) |
virtual void | virtual_hook (int id, void *data) |
bool | prepareWriting_impl (const QString &name, const QString &user, const QString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
bool | writeFile_impl (const QString &name, const QString &user, const QString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime, const char *data) |
bool | writeDir_impl (const QString &name, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
bool | writeSymLink_impl (const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
bool | writeData_impl (const char *data, uint size) |
Classes | |
struct | PrepareWritingParams |
struct | WriteDataParams |
struct | WriteDirParams |
struct | WriteFileParams |
struct | WriteSymlinkParams |
Constructor & Destructor Documentation
|
Base constructor (protected since this is a pure virtual class).
Definition at line 75 of file karchive.cpp. |
Member Function Documentation
|
Writes a local directory into the archive, including all its contents, recursively. Calls addLocalFile for each file to be added.
Since KDE 3.2 it will also add a
Definition at line 200 of file karchive.cpp. |
|
Writes a local file into the archive. The main difference with writeFile, is that this method minimizes memory usage, by not loading the whole file into memory in one go.
If
Definition at line 136 of file karchive.cpp. |
|
Closes the archive. Inherited classes might want to reimplement closeArchive instead.
Definition at line 108 of file karchive.cpp. |
|
Closes the archive. Called by close. |
|
Use to check if close had any problem.
Definition at line 124 of file karchive.cpp. |
|
The underlying device.
Definition at line 96 of file karchive.h. |
|
If an archive is opened for reading, then the contents of the archive can be accessed via this function.
Definition at line 129 of file karchive.cpp. |
|
Call doneWriting after writing the data.
|
|
Ensures that This handles e.g. tar files missing directory entries, like mico-2.3.0.tar.gz :)
Definition at line 382 of file karchive.cpp. |
|
Checks whether the archive is open.
Definition at line 83 of file karchive.h. |
|
Returns the mode in which the archive was opened.
Definition at line 90 of file karchive.h. |
|
Opens the archive for reading or writing. Inherited classes might want to reimplement openArchive instead.
Definition at line 91 of file karchive.cpp. |
|
Opens an archive for reading or writing. Called by open.
|
|
Here's another way of writing a file into an archive: Call prepareWriting, then call writeData() as many times as wanted then call doneWriting( totalSize ). For tar.gz files, you need to know the size before hand, it is needed in the header! For zip files, size isn't used. This method also allows some file metadata to be set. However, depending on the archive type not all metadata might be regarded.
Reimplemented in KTar, and KZip. Definition at line 234 of file karchive.cpp. |
|
Here's another way of writing a file into an archive: Call prepareWriting, then call writeData() as many times as wanted then call doneWriting( totalSize ). For tar.gz files, you need to know the size before hand, since it is needed in the header. For zip files, size isn't used.
|
|
Retrieves or create the root directory. The default implementation assumes that openArchive() did the parsing, so it creates a dummy rootdir if none was set (write mode, or no '/' in the archive). Reimplement this to provide parsing/listing on demand.
Definition at line 367 of file karchive.cpp. |
|
Write data into the current file - to be called after calling prepareWriting.
Reimplemented in KZip. Definition at line 352 of file karchive.cpp. |
|
If an archive is opened for writing then you can add new directories using this function. KArchive won't write one directory twice. This method also allows some file metadata to be set. However, depending on the archive type not all metadata might be regarded.
Reimplemented in KTar. Definition at line 303 of file karchive.cpp. |
|
If an archive is opened for writing then you can add new directories using this function. KArchive won't write one directory twice.
|
|
If an archive is opened for writing then you can add a new file using this function. If the file name is for example "mydir/test1" then the directory "mydir" is automatically appended first if that did not happen yet. This method also allows some file metadata to be set. However, depending on the archive type not all metadata might be regarded.
Reimplemented in KZip. Definition at line 258 of file karchive.cpp. |
|
If an archive is opened for writing then you can add a new file using this function. If the file name is for example "mydir/test1" then the directory "mydir" is automatically appended first if that did not happen yet.
Reimplemented in KZip. Definition at line 227 of file karchive.cpp. |
|
Writes a symbolic link to the archive if the archive must be opened for writing.
Reimplemented in KTar, and KZip. Definition at line 326 of file karchive.cpp. |
The documentation for this class was generated from the following files: