• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

Public Member Functions | Protected Member Functions | List of all members
KTar Class Reference

#include <ktar.h>

Inheritance diagram for KTar:
KArchive

Public Member Functions

 KTar (const TQString &filename, const TQString &mimetype=TQString::null)
 
 KTar (TQIODevice *dev)
 
virtual ~KTar ()
 
TQString fileName ()
 
void setOrigFileName (const TQCString &fileName)
 
bool writeSymLink (const TQString &name, const TQString &target, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
virtual bool writeDir (const TQString &name, const TQString &user, const TQString &group)
 
bool writeDir (const TQString &name, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
virtual bool prepareWriting (const TQString &name, const TQString &user, const TQString &group, uint size)
 
bool prepareWriting (const TQString &name, const TQString &user, const TQString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
virtual bool doneWriting (uint size)
 
- Public Member Functions inherited from KArchive
virtual bool open (int mode)
 
virtual void close ()
 
bool closeSucceeded () const
 
bool isOpened () const
 
int mode () const
 
TQIODevice * device () const
 
const KArchiveDirectory * directory () const
 
bool addLocalFile (const TQString &fileName, const TQString &destName)
 
bool addLocalDirectory (const TQString &path, const TQString &destName)
 
bool writeDir (const TQString &name, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeSymLink (const TQString &name, const TQString &target, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
virtual bool writeFile (const TQString &name, const TQString &user, const TQString &group, uint size, const char *data)
 
bool writeFile (const TQString &name, const TQString &user, const TQString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime, const char *data)
 
bool prepareWriting (const TQString &name, const TQString &user, const TQString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeData (const char *data, uint size)
 

Protected Member Functions

virtual bool openArchive (int mode)
 
virtual bool closeArchive ()
 
virtual void virtual_hook (int id, void *data)
 
bool prepareWriting_impl (const TQString &name, const TQString &user, const TQString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeDir_impl (const TQString &name, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeSymLink_impl (const TQString &name, const TQString &target, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
- Protected Member Functions inherited from KArchive
 KArchive (TQIODevice *dev)
 
virtual KArchiveDirectory * rootDir ()
 
KArchiveDirectory * findOrCreate (const TQString &path)
 
void setDevice (TQIODevice *dev)
 
void setRootDir (KArchiveDirectory *rootDir)
 
bool prepareWriting_impl (const TQString &name, const TQString &user, const TQString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeFile_impl (const TQString &name, const TQString &user, const TQString &group, uint size, mode_t perm, time_t atime, time_t mtime, time_t ctime, const char *data)
 
bool writeDir_impl (const TQString &name, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeSymLink_impl (const TQString &name, const TQString &target, const TQString &user, const TQString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
 
bool writeData_impl (const char *data, uint size)
 

Additional Inherited Members

- Protected Types inherited from KArchive
enum  {
  VIRTUAL_WRITE_DATA = 1 , VIRTUAL_WRITE_SYMLINK , VIRTUAL_WRITE_DIR , VIRTUAL_WRITE_FILE ,
  VIRTUAL_PREPARE_WRITING
}
 

Detailed Description

A class for reading / writing (optionally compressed) tar archives.

KTar allows you to read and write tar archives, including those that are compressed using gzip, bzip2, or xz.

Author
Torben Weis weis@.nosp@m.kde..nosp@m.org, David Faure faure.nosp@m.@kde.nosp@m..org

Definition at line 40 of file ktar.h.

Constructor & Destructor Documentation

◆ KTar() [1/2]

KTar::KTar ( const TQString &  filename,
const TQString &  mimetype = TQString::null 
)

Creates an instance that operates on the given filename using the compression filter associated to given mimetype.

Parameters
filenameis a local path (e.g. "/home/weis/myfile.tgz")
mimetype"application/x-gzip", "application/x-bzip2", or "application/x-xz" Do not use application/x-tgz or similar - you only need to specify the compression layer ! If the mimetype is omitted, it will be determined from the filename.

Definition at line 59 of file ktar.cpp.

◆ KTar() [2/2]

KTar::KTar ( TQIODevice *  dev)

Creates an instance that operates on the given device.

The device can be compressed (KFilterDev) or not (TQFile, etc.).

Warning
Do not assume that giving a TQFile here will decompress the file, in case it's compressed!
Parameters
devthe device to read from. If the source is compressed, the TQIODevice must take care of decompression

Definition at line 156 of file ktar.cpp.

◆ ~KTar()

KTar::~KTar ( )
virtual

If the tar ball is still opened, then it will be closed automatically by the destructor.

Definition at line 163 of file ktar.cpp.

Member Function Documentation

◆ closeArchive()

bool KTar::closeArchive ( )
protectedvirtual

Closes the archive.

Called by close.

Implements KArchive.

Definition at line 551 of file ktar.cpp.

◆ doneWriting()

bool KTar::doneWriting ( uint  size)
virtual

Call doneWriting after writing the data.

Parameters
sizethe size of the file
See also
prepareWriting()

Implements KArchive.

Definition at line 634 of file ktar.cpp.

◆ fileName()

TQString KTar::fileName ( )
inline

The name of the tar file, as passed to the constructor Null if you used the TQIODevice constructor.

Returns
the name of the file, or TQString::null if unknown

Definition at line 77 of file ktar.h.

◆ openArchive()

bool KTar::openArchive ( int  mode)
protectedvirtual

Opens the archive for reading.

Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries.

Parameters
modethe mode of the file

Implements KArchive.

Definition at line 346 of file ktar.cpp.

◆ prepareWriting()

bool KTar::prepareWriting ( const TQString &  name,
const TQString &  user,
const TQString &  group,
uint  size 
)
virtual

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.

Parameters
namethe name of the file
userthe user that owns the file
groupthe group that owns the file
sizethe size of the file
Todo:
TODO(BIC): make this a thin non-virtual wrapper around prepareWriting(name,user,group,size,perm,atime,mtime,ctime) or eliminate it.

Implements KArchive.

Definition at line 626 of file ktar.cpp.

◆ setOrigFileName()

void KTar::setOrigFileName ( const TQCString &  fileName)

Special function for setting the "original file name" in the gzip header, when writing a tar.gz file.

It appears when using in the "file" command, for instance. Should only be called if the underlying device is a KFilterDev!

Parameters
fileNamethe original file name

Definition at line 178 of file ktar.cpp.

◆ writeDir()

bool KTar::writeDir ( const TQString &  name,
const TQString &  user,
const TQString &  group 
)
virtual

If an archive is opened for writing then you can add new directories using this function.

KArchive won't write one directory twice.

Parameters
namethe name of the directory
userthe user that owns the directory
groupthe group that owns the directory
Todo:
TODO(BIC): make this a thin wrapper around writeDir(name,user,group,perm,atime,mtime,ctime) or eliminate it

Implements KArchive.

Definition at line 564 of file ktar.cpp.


The documentation for this class was generated from the following files:
  • ktar.h
  • ktar.cpp

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.