lib Library API Documentation

KoFilter Class Reference

The base class for import and export filters. More...

#include <koFilter.h>

Inheritance diagram for KoFilter:

KoEmbeddingFilter List of all members.

Public Types

enum  ConversionStatus {
  OK, StupidError, UsageError, CreationError,
  FileNotFound, StorageCreationError, BadMimeType, BadConversionGraph,
  EmbeddedDocError, WrongFormat, NotImplemented, ParsingError,
  InternalError, UnexpectedEOF, UnexpectedOpcode, UserCancelled,
  OutOfMemory, JustInCaseSomeBrokenCompilerUsesLessThanAByte = 255
}

Signals

void sigProgress (int value)

Public Member Functions

virtual ConversionStatus convert (const QCString &from, const QCString &to)=0

Protected Member Functions

 KoFilter ()

Protected Attributes

KoFilterChainm_chain

Friends

class KoFilterChain

Detailed Description

The base class for import and export filters.

Derive your filter class from this base class and implement the convert() method. Don't forget to specify the Q_OBJECT macro in your class even if you don't use signals or slots. This is needed as filters are created on the fly. The m_chain member allows access to the KoFilterChain which invokes the filter to query for input/output.

Take care: The m_chain pointer is invalid while the constructor runs due to the implementation -- don't use it in the constructor. After the constructor, when running the convert() method it's guaranteed to be valid, so no need to check against 0.

Author:
Werner Trobin <trobin@kde.org>

Definition at line 47 of file koFilter.h.


Member Enumeration Documentation

enum KoFilter::ConversionStatus
 

This enum is used to signal the return state of your filter.

Return OK in convert() in case everything worked as expected. Feel free to add some more error conditions before the last item if it's needed.

Definition at line 61 of file koFilter.h.


Constructor & Destructor Documentation

KoFilter::KoFilter  )  [protected]
 

This is the constructor your filter has to call, obviously.

Definition at line 31 of file koFilter.cc.


Member Function Documentation

virtual ConversionStatus KoFilter::convert const QCString &  from,
const QCString &  to
[pure virtual]
 

The filter chain calls this method to perform the actual conversion.

The passed mimetypes should be a pair of those you specified in your .desktop file. You have to implement this method to make the filter work.

Parameters:
from The mimetype of the source file/document
to The mimetype of the destination file/document
Returns:
The error status, see the ConversionStatus enum. KoFilter::OK means that everything is alright.

void KoFilter::sigProgress int  value  )  [signal]
 

Emit this signal with a value in the range of 1...100 to have some progress feedback for the user in the statusbar of the application.

Parameters:
value The actual progress state. Should always remain in the range 1..100.


Member Data Documentation

KoFilterChain* KoFilter::m_chain [protected]
 

Use this pointer to access all information about input/output during the conversion.

Don't use it in the constructor - it's invalid while constructing the object!

Definition at line 104 of file koFilter.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:30 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003