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

tdeio/tdeio

Public Member Functions | Static Public Member Functions | List of all members
KFilterDev Class Reference

#include <kfilterdev.h>

Inherits TQIODevice.

Public Member Functions

 KFilterDev (KFilterBase *filter, bool autoDeleteFilterBase=false)
 
virtual ~KFilterDev ()
 
virtual bool open (int mode)
 
virtual void close ()
 
virtual void flush ()
 
void setOrigFileName (const TQCString &fileName)
 
void setSkipHeaders ()
 
virtual TQIODevice::Offset size () const
 
virtual TQIODevice::Offset at () const
 
virtual bool at (TQIODevice::Offset)
 
virtual bool atEnd () const
 
virtual TQ_LONG readBlock (char *data, TQ_ULONG maxlen)
 
virtual TQ_LONG writeBlock (const char *data, TQ_ULONG len)
 
virtual int getch ()
 
virtual int putch (int)
 
virtual int ungetch (int)
 

Static Public Member Functions

static TQIODevice * createFilterDevice (KFilterBase *base, TQFile *file) TDE_DEPRECATED
 
static TQIODevice * deviceForFile (const TQString &fileName, const TQString &mimetype=TQString::null, bool forceFilter=false)
 
static TQIODevice * device (TQIODevice *inDevice, const TQString &mimetype)
 
static TQIODevice * device (TQIODevice *inDevice, const TQString &mimetype, bool autoDeleteInDevice)
 

Detailed Description

A class for reading and writing compressed data onto a device (e.g.

file, but other usages are possible, like a buffer or a socket).

To simply read/write compressed files, see deviceForFile.

Author
David Faure faure.nosp@m.@kde.nosp@m..org

Definition at line 36 of file kfilterdev.h.

Constructor & Destructor Documentation

◆ KFilterDev()

KFilterDev::KFilterDev ( KFilterBase *  filter,
bool  autoDeleteFilterBase = false 
)

Constructs a KFilterDev for a given filter (e.g.

gzip, bzip2 etc.).

Parameters
filterthe KFilterBase to use
autoDeleteFilterBasewhen true this object will become the owner of filter.

Definition at line 46 of file kfilterdev.cpp.

◆ ~KFilterDev()

KFilterDev::~KFilterDev ( )
virtual

Destructs the KFilterDev.

Calls close() if the filter device is still open.

Definition at line 54 of file kfilterdev.cpp.

Member Function Documentation

◆ at()

bool KFilterDev::at ( TQIODevice::Offset  pos)
virtual

That one can be quite slow, when going back.

Use with care.

Definition at line 190 of file kfilterdev.cpp.

◆ close()

void KFilterDev::close ( )
virtual

Close after reading or writing.

If the KFilterBase's device was opened by open(), it will be closed.

Definition at line 149 of file kfilterdev.cpp.

◆ createFilterDevice()

TQIODevice * KFilterDev::createFilterDevice ( KFilterBase *  base,
TQFile *  file 
)
static

Call this to create the appropriate filter device for base working on file .

The returned TQIODevice has to be deleted after using.

Deprecated:
. Use deviceForFile instead. To be removed in KDE 3.0

Definition at line 66 of file kfilterdev.cpp.

◆ device() [1/2]

TQIODevice * KFilterDev::device ( TQIODevice *  inDevice,
const TQString &  mimetype 
)
static

Creates an i/o device that is able to read from the TQIODevice inDevice, whether the data is compressed or not.

Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined mimetype . Pass "application/x-gzip" or "application/x-bzip2" to use the corresponding decompression filter.

Warning: application/x-bzip2 may not be available. In that case 0 will be returned !

The returned TQIODevice has to be deleted after using.

Parameters
inDeviceinput device, becomes owned by this device! Automatically deleted!
mimetypethe mime type for the filter
Returns
a TQIODevice that filters the original stream. Must be deleted after using

Definition at line 101 of file kfilterdev.cpp.

◆ device() [2/2]

TQIODevice * KFilterDev::device ( TQIODevice *  inDevice,
const TQString &  mimetype,
bool  autoDeleteInDevice 
)
static

Creates an i/o device that is able to read from the TQIODevice inDevice, whether the data is compressed or not.

Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined mimetype . Pass "application/x-gzip" or "application/x-bzip2" to use the corresponding decompression filter.

Warning: application/x-bzip2 may not be available. In that case 0 will be returned !

The returned TQIODevice has to be deleted after using.

Parameters
inDeviceinput device. Won't be deleted if autoDeleteInDevice = false
mimetypethe mime type for the filter
autoDeleteInDeviceif true, inDevice will be deleted automatically
Returns
a TQIODevice that filters the original stream. Must be deleted after using
Since
3.1

Definition at line 106 of file kfilterdev.cpp.

◆ deviceForFile()

TQIODevice * KFilterDev::deviceForFile ( const TQString &  fileName,
const TQString &  mimetype = TQString::null,
bool  forceFilter = false 
)
static

Creates an i/o device that is able to read from fileName, whether it's compressed or not.

Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined from the fileName if mimetype is empty. Pass "application/x-gzip" or "application/x-bzip2" to force the corresponding decompression filter, if available.

Warning: application/x-bzip2 may not be available. In that case a TQFile opened on the compressed data will be returned ! Use KFilterBase::findFilterByMimeType and code similar to what deviceForFile is doing, to better control what's happening.

The returned TQIODevice has to be deleted after using.

Parameters
fileNamethe name of the file to filter
mimetypethe mime type of the file to filter, or TQString::null if unknown
forceFilterif true, the function will either find a compression filter, or return 0. If false, it will always return a TQIODevice. If no filter is available it will return a simple TQFile. This can be useful if the file is usable without a filter.
Returns
if a filter has been found, the TQIODevice for the filter. If the filter does not exist, the return value depends on forceFilter. The returned TQIODevice has to be deleted after using.

Definition at line 81 of file kfilterdev.cpp.

◆ open()

bool KFilterDev::open ( int  mode)
virtual

Open for reading or writing.

If the KFilterBase's device is not opened, it will be opened.

Definition at line 119 of file kfilterdev.cpp.

◆ setOrigFileName()

void KFilterDev::setOrigFileName ( const TQCString &  fileName)

For writing gzip compressed files only: set the name of the original file, to be used in the gzip header.

Parameters
fileNamethe name of the original file

Definition at line 472 of file kfilterdev.cpp.

◆ setSkipHeaders()

void KFilterDev::setSkipHeaders ( )

Call this let this device skip the gzip headers when reading/writing.

This way KFilterDev (with gzip filter) can be used as a direct wrapper around zlib - this is used by KZip.

Since
3.1

Definition at line 477 of file kfilterdev.cpp.


The documentation for this class was generated from the following files:
  • kfilterdev.h
  • kfilterdev.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.