#include <kurifilter.h>
Public Member Functions | |
~KURIFilter () | |
bool | filterURI (KURIFilterData &data, const TQStringList &filters=TQStringList()) |
bool | filterURI (KURL &uri, const TQStringList &filters=TQStringList()) |
bool | filterURI (TQString &uri, const TQStringList &filters=TQStringList()) |
KURL | filteredURI (const KURL &uri, const TQStringList &filters=TQStringList()) |
TQString | filteredURI (const TQString &uri, const TQStringList &filters=TQStringList()) |
TQPtrListIterator< KURIFilterPlugin > | pluginsIterator () const |
TQStringList | pluginNames () const |
Static Public Member Functions | |
static KURIFilter * | self () |
Protected Member Functions | |
KURIFilter () | |
void | loadPlugins () |
Detailed Description
Manages the filtering of URIs.
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. 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:
You can alternatively use a KURL:
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:
You can also restrict the filter(s) to be used by supplying the name of the filter(s) to use. By defualt all available filters will be used. To use specific filters, add the names of the filters you want to use to a TQStringList and invoke the appropriate filtering function. The examples below show the use of specific filters. The first one uses a single filter called tdeshorturifilter while the second example uses multiple filters:
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.
Filters a given URL into its proper format whenever possible.
Definition at line 548 of file kurifilter.h.
Constructor & Destructor Documentation
◆ ~KURIFilter()
KURIFilter::~KURIFilter | ( | ) |
Destructor.
Definition at line 341 of file kurifilter.cpp.
◆ KURIFilter()
|
protected |
A protected constructor.
This constructor creates a KURIFilter and initializes all plugins it can find by invoking loadPlugins.
Definition at line 335 of file kurifilter.cpp.
Member Function Documentation
◆ filteredURI() [1/2]
KURL KURIFilter::filteredURI | ( | const KURL & | uri, |
const TQStringList & | filters = TQStringList() |
||
) |
Returns the filtered URI.
The given URL is filtered based on the specified list of filters. If the list is empty all available filters would be used.
- Parameters
-
uri The URI to filter. filters specify the list of filters to be used.
- Returns
- the filtered URI or null if it cannot be filtered
Definition at line 400 of file kurifilter.cpp.
◆ filteredURI() [2/2]
TQString KURIFilter::filteredURI | ( | const TQString & | uri, |
const TQStringList & | filters = TQStringList() |
||
) |
Return a filtered string representation of a URI.
The given URL is filtered based on the specified list of filters. If the list is empty all available filters would be used.
- Parameters
-
uri the URI to filter. filters specify the list of filters to be used.
- Returns
- the filtered URI or null if it cannot be filtered
Definition at line 407 of file kurifilter.cpp.
◆ filterURI() [1/3]
bool KURIFilter::filterURI | ( | KURIFilterData & | data, |
const TQStringList & | filters = TQStringList() |
||
) |
Filters the URI given by the object URIFilterData.
The given URL is filtered based on the specified list of filters. If the list is empty all available filters would be used.
- Parameters
-
data object that contains the URI to be filtered. filters specify the list of filters to be used.
- Returns
- a boolean indicating whether the URI has been changed
Definition at line 345 of file kurifilter.cpp.
◆ filterURI() [2/3]
bool KURIFilter::filterURI | ( | KURL & | uri, |
const TQStringList & | filters = TQStringList() |
||
) |
Filters the URI given by the URL.
The given URL is filtered based on the specified list of filters. If the list is empty all available filters would be used.
- Parameters
-
uri the URI to filter. filters specify the list of filters to be used.
- Returns
- a boolean indicating whether the URI has been changed
Definition at line 383 of file kurifilter.cpp.
◆ filterURI() [3/3]
bool KURIFilter::filterURI | ( | TQString & | uri, |
const TQStringList & | filters = TQStringList() |
||
) |
Filters a string representing a URI.
The given URL is filtered based on the specified list of filters. If the list is empty all available filters would be used.
- Parameters
-
uri The URI to filter. filters specify the list of filters to be used.
- Returns
- a boolean indicating whether the URI has been changed
Definition at line 391 of file kurifilter.cpp.
◆ loadPlugins()
|
protected |
Loads all allowed plugins.
This function loads all filters that have not been disbled.
Definition at line 427 of file kurifilter.cpp.
◆ pluginNames()
TQStringList KURIFilter::pluginNames | ( | ) | const |
Return a list of the names of all loaded plugins.
- Returns
- a TQStringList of plugin names
- Since
- 3.1
Definition at line 419 of file kurifilter.cpp.
◆ pluginsIterator()
TQPtrListIterator< KURIFilterPlugin > KURIFilter::pluginsIterator | ( | ) | const |
Return an iterator to iterate over all loaded plugins.
- Returns
- a plugin iterator.
Definition at line 414 of file kurifilter.cpp.
◆ self()
|
static |
Returns an instance of KURIFilter.
Definition at line 328 of file kurifilter.cpp.
The documentation for this class was generated from the following files: