class KArchive

generic class for reading/writing archives. More...

Contains pure virtuals
Definition#include <karchive.h>
Inherited byKTar
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods


Detailed Description

 KArchive ( QIODevice * dev )

KArchive

[protected]

Base constructor (protected since this is a pure virtual class).

Parameters:
devthe I/O device where the archive reads its data Note that this can be a file, but also a data buffer, a compression filter, etc.

 ~KArchive ()

~KArchive

[protected virtual]

bool  open ( int mode )

open

[virtual]

Opens the archive for reading or writing.

Parameters:
modemay be IO_ReadOnly or IO_WriteOnly Inherited classes might want to reimplement openArchive instead.

See also: close

void  close ()

close

[virtual]

Closes the archive. Inherited classes might want to reimplement openArchive instead.

See also: open

bool  isOpened ()

isOpened

[const]

Returns: true if the archive is opened

int  mode ()

mode

[const]

Returns: the mode in which the archive was opened (IO_ReadOnly or IO_WriteOnly)

QIODevice *  device ()

device

[const]

The underlying device.

const KArchiveDirectory*  directory ()

directory

[const]

If an archive is opened for reading, then the contents of the archive can be accessed via this function.

bool  writeDir ( const QString& name, const QString& user, const QString& group )

writeDir

[pure virtual]

If an archive is opened for writing then you can add new directories using this function. KArchive won't write one directory twice.

bool  writeFile ( const QString& name, const QString& user, const QString& group, uint size, const char* data )

writeFile

[virtual]

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.

bool  prepareWriting ( const QString& name, const QString& user, const QString& group, uint size )

prepareWriting

[pure virtual]

Here's another way of writing a file into an archive: Call prepareWriting, then call write as many times as wanted, then call doneWriting( totalSize ) You need to know the size before hand, it is needed in the header!

bool  doneWriting ( uint size )

doneWriting

[pure virtual]

Call doneWriting after writing the data.

See also: prepareWriting

bool  openArchive ( int mode )

openArchive

[protected pure virtual]

Opens an archive for reading or writing. Called by open.

bool  closeArchive ()

closeArchive

[protected pure virtual]

Closes the archive. Called by close.

KArchiveDirectory*  rootDir ()

rootDir

[protected virtual]

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.

KArchiveDirectory *  findOrCreate ( const QString & path )

findOrCreate

[protected]

Ensures that path exists, create otherwise. This handles e.g. tar files missing directory entries, like mico-2.3.0.tar.gz :)

void  setDevice ( QIODevice *dev )

setDevice

[protected]

void  setRootDir ( KArchiveDirectory *rootDir )

setRootDir

[protected]

void  virtual_hook ( int id, void* data )

virtual_hook

[protected virtual]