class KURIFilter

Filters a given URL into its proper format whenever possible. More...

Definition#include <kurifilter.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Protected Methods


Detailed Description

Manages the filtering of a URI.

The intention of this plugin class is to allow people to extend the functionality of KURL without modifying it directly. This way KURL will remain a generic parser capable of parsing any generic URL that adheres to specifications.

The KURIFilter class applies a number of filters to a URI, and returns the filtered version whenever possible. The filters are implemented using plugins to provide easy extensibility of the filtering mechanism. That is, new filters can be added in the future by simply inheriting from KURIFilterPlugin and implementing the KURIFilterPlugin::filterURI method.

Use of this plugin-manager class is straight forward. Since it is a singleton object, all you have to do is obtain an instance by doing KURIFilter::self() and use any of the public member functions to preform the filtering.

Example

To simply filter a given string:


 bool filtered = KURIFilter::self()->filterURI( "kde.org" );

You can alternatively use a KURL:


 KURL url = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( url );

If you have a constant string or a constant URL, simply invoke the corresponding function to obtain the filtered string or URL instead of a boolean flag:


 QString u = KURIFilter::self()->filteredURI( "kde.org" );

You can also specify only specific filter(s) to be applied by supplying the name(s) of the filter(s). By defualt all filters that are found are loaded when the KURIFilter object is created will be used. These names are taken from the enteries in the \".desktop\" files. Here are a couple of examples:


 QString text = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( text, "KShortURIFilter" );

 QStringList list;
 list << "KShortURIFilter" << "MyFilter";
 bool filtered = KURIFilter::self()->filterURI( text, list );

KURIFilter also allows richer data exchange through a simple meta-object called KURIFilterData. Using this meta-object you can find out more information about the URL you want to filter. See KURIFilterData for examples and details.

 ~KURIFilter ()

~KURIFilter

Destructor

KURIFilter*  self ()

self

[static]

Return a static instance of KURIFilter.

bool  filterURI ( KURIFilterData& data, const QStringList& filters = QStringList() )

filterURI

Filters the URI given by the object URIFilterData.

This filters the given data based on the specified filter list. If the list is empty all avaliable filter plugins would be used. If not, only those given in the list are used.

Parameters:
dataobject that contains the URI to be filtered.
filtersspecify the list filters to be used

Returns: a boolean indicating whether the URI has been changed

bool  filterURI ( KURL &uri, const QStringList& filters = QStringList() )

filterURI

Filters the URI given by the URL.

This filters the given URL based on the specified filter list. If the list is empty all avaliable filter plugins would be used. If not, only those given in the list are used.

Parameters:
urithe URI to filter.
filtersspecify the list of filters to be used

Returns: a boolean indicating whether the URI has been changed

bool  filterURI ( QString &uri, const QStringList& filters = QStringList() )

filterURI

Filters a string representing a URI.

This filters the given string based on the specified filter list. If the list is empty all avaliable filter plugins would be used. If not, only those given in the list are used.

Parameters:
uriThe URI to filter.
filtersspecify the list filters to be used

Returns: a boolean indicating whether the URI has been changed

KURL  filteredURI ( const KURL &uri, const QStringList& filters = QStringList() )

filteredURI

Returns the filtered URI.

This filters the given URL based on the specified filter list. If the list is empty all avaliable filter plugins would be used. If not, only those given in the list are used.

Parameters:
uriThe URI to filter.
filtersspecify the list filters to be used

Returns: the filtered URI or null if it cannot be filtered

QString  filteredURI ( const QString &uri, const QStringList& filters = QStringList() )

filteredURI

Return a filtered string representation of a URI.

This filters the given URL based on the specified filter list. If the list is empty all avaliable filter plugins would be used. If not, only those given in the list are used.

Parameters:
urithe URI to filter.
filtersspecify the list filters to be used

Returns: the filtered URI or null if it cannot be filtered

QPtrListIterator<KURIFilterPlugin>  pluginsIterator ()

pluginsIterator

[const]

Return an iterator to iterate over all loaded plugins.

Returns: a plugin iterator.

 KURIFilter ()

KURIFilter

[protected]

A protected constructor.

This constructor creates a KURIFilter and initializes all plugins it can find by invoking loadPlugins.

void  loadPlugins ()

loadPlugins

[protected]

Loads all allowed plugins.

This function loads all filters that have not been dis


Generated by: dfaure on faure on Tue Apr 16 08:49:48 2002, using kdoc 2.0a53.