lib

#include <KoFilter.h>

Inheritance diagram for KoFilter:
KoEmbeddingFilter

Public Types

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 ConversionStatus convert (const TQCString &from, const TQCString &to)=0
 

Protected Member Functions

 KoFilter ()
 

Protected Attributes

KoFilterChain * m_chain
 

Friends

class KoFilterEntry
 
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 TQ_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 trobi.nosp@m.n@kd.nosp@m.e.org
Todo:
the class has no constructor and therefore cannot initialize its private class

Definition at line 49 of file KoFilter.h.

Member Enumeration Documentation

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

Constructor & Destructor Documentation

◆ ~KoFilter()

KoFilter::~KoFilter ( )
virtual

Definition at line 35 of file KoFilter.cpp.

◆ KoFilter()

KoFilter::KoFilter ( )
protected

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

Definition at line 31 of file KoFilter.cpp.

Member Function Documentation

◆ convert()

virtual ConversionStatus KoFilter::convert ( const TQCString &  from,
const TQCString &  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
fromThe mimetype of the source file/document
toThe mimetype of the destination file/document
Returns
The error status, see the ConversionStatus enum. KoFilter::OK means that everything is alright.

◆ sigProgress

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
valueThe actual progress state. Should always remain in the range 1..100.

Friends And Related Symbol Documentation

◆ KoFilterChain

friend class KoFilterChain
friend

Definition at line 55 of file KoFilter.h.

◆ KoFilterEntry

friend class KoFilterEntry
friend

Definition at line 54 of file KoFilter.h.

Member Data Documentation

◆ m_chain

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


The documentation for this class was generated from the following files: