class KURIFilter

Filters a given URL to a proper and valid format. 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 extend the functionality of KURL w/o 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 if successful. The filters are implemented using plugins to provide easy extensibility of the filtering mechanism. Any new filters can be added in the future without having to modify this manager by simply inheriting from KURIFilterPlugin.

Use of this plugin is simple and straight. Since KURIFilter is a Singleton object, you obtain an instance of it by doing

KURIFilter::self()</pre>.  Then you can use any of the
 public member functions to preform the filtering.  
 
 @sect Example

 To simply filter a given string

 <pre>
 bool filtered = KURIFilter::self()->filterURI( "kde.org" ); // should return "http://kde.org"

You can alternatively use a KURL


 KURL url = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( url ); // should also return "http://kde.org"

If you have a constant string or url simply invoke the corresponding function that return the filtered string or URL instead of a boolean flag:


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

With any of the filter functions you can specify which specific filter(s) are supposed to be applied by supplying the a single or a list of filter name(s) as a second argument. By defualt all filters that are found are loded when the KURIFilter object is created. The names of the filters are those used in the .desktop files of the specific filters. This information can alsp be easily obtained from the control panel. 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 KURIFilterData. Using this message object you can find out more information about the URL you want to filter. See KURIFilterData for examples and details.

KURIFilter*  self ()

[static]

Return a static instance of KURIFilter.

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

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() )

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() )

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() )

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() )

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

QListIterator<KURIFilterPlugin>  pluginsIterator ()

[const]

Return an iterator to iterate over all loaded plugins.

Returns: a plugin iterator.

 KURIFilter ()

[protected]

A protected constructor.

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

void  loadPlugins ()

[protected]

Loads all allowed plugins.

This function loads all filters that have not been dis


Generated by: root@porky.devel.redhat.com on Wed May 10 08:56:52 2000, using kdoc 2.0a35.