lib

KoFilter Class Reference

#include <KoFilter.h>

Inheritance diagram for KoFilter:

KoEmbeddingFilter List of all members.

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.

Note:
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>
Todo:
the class has no constructor and therefore cannot initialize its private class

Definition at line 48 of file KoFilter.h.


Public Types

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

Signals

void sigProgress (int value)

Public Member Functions

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

Protected Member Functions

 KoFilter ()

Protected Attributes

KoFilterChainm_chain

Friends

class KoFilterEntry
class KoFilterChain

Member Enumeration Documentation

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 62 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.cpp.


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

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 106 of file KoFilter.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys