LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IDataFilter Class Referenceabstract

Base interface for data filter plugins. More...

#include "idatafilter.h"

Classes

struct  FilterVariant
 Describes a single filter variant supported by this data filter. More...
 

Public Member Functions

virtual ~IDataFilter ()
 
virtual QString GetFilterVerb () const =0
 Returns the string describing the data filter. More...
 
virtual QList< FilterVariantGetFilterVariants () const =0
 Returns the list of concrete data filter variants. More...
 

Detailed Description

Base interface for data filter plugins.

Data filter plugins provide some means to manipulate and alter data. Examples of such plugins are image uploaders to various image bins, text finders, etc.

A single data filter plugin can support multiple data filter variants, like particular image bins supported by an image uploader or particular OpenSearch engines supported by an OpenSearch handler. The list of possible data filter variants is returned from the GetFilterVariants() function. The list can be dynamic (that is, different in different calls).

Plugins implementing this interface are also expected to implement IEntityHandler, considering (and accepting) entities with MIME "x-leechcraft/data-filter-request". Such entities will contain the entity to filter (like, a piece of text or an image) in the LeechCraft::Entity::Entity_ field and may contain the "DataFilter" key in the LeechCraft::Entity::Additional_ map with the ID of the exact filter variant to use (if user has already selected it).

The result of the data filter, if any, can be passed to the plugin emitting the entity. For this the emitting plugin shall set the callback function as the value of the DataFilterCallback LeechCraft::Entity::Additional_ map. The function is expected to be an object of type DataFilterCallback_f.

Note
Not all data filter plugins support callbacks. For example, it doesn't make sense for a Google web search data filter to pass the results page contents or URL to the callback. The behavior is expected to be sane enough, though, for the combination of the filtered entity and callback semantics to make sense.
See also
LeechCraft::Entity, IEntityHandler
DataFilterCallback_f

Definition at line 90 of file idatafilter.h.

Constructor & Destructor Documentation

virtual IDataFilter::~IDataFilter ( )
inlinevirtual

Definition at line 118 of file idatafilter.h.

Member Function Documentation

virtual QList<FilterVariant> IDataFilter::GetFilterVariants ( ) const
pure virtual

Returns the list of concrete data filter variants.

Returns
The list of exact data filter variants.

Referenced by LeechCraft::Util::StdDataFilterMenuCreator::StdDataFilterMenuCreator().

+ Here is the caller graph for this function:

virtual QString IDataFilter::GetFilterVerb ( ) const
pure virtual

Returns the string describing the data filter.

This function should return the human-readable string describing the data filter plugin in general in an imperative form, like "Upload image to" for an image uploader or "Search in" for a text searcher.

Returns
The human-readable string like "Search in".

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