#include <kurifilter.h>
Public Methods | |
| ~KURIFilter () | |
| bool | filterURI (KURIFilterData &data, const QStringList &filters=QStringList()) |
| bool | filterURI (KURL &uri, const QStringList &filters=QStringList()) |
| bool | filterURI (QString &uri, const QStringList &filters=QStringList()) |
| KURL | filteredURI (const KURL &uri, const QStringList &filters=QStringList()) |
| QString | filteredURI (const QString &uri, const QStringList &filters=QStringList()) |
| QPtrListIterator< KURIFilterPlugin > | pluginsIterator () const |
| QStringList | pluginNames () const |
Static Public Methods | |
| KURIFilter * | self () |
Protected Methods | |
| KURIFilter () | |
| void | loadPlugins () |
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.
@sect 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.
Definition at line 469 of file kurifilter.h.
|
|
Destructor |
|
|
A protected constructor. This constructor creates a KURIFilter and initializes all plugins it can find by invoking loadPlugins. |
|
||||||||||||
|
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.
|
|
||||||||||||
|
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.
|
|
||||||||||||
|
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.
|
|
||||||||||||
|
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.
|
|
||||||||||||
|
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.
|
|
|
Loads all allowed plugins. This function loads all filters that have not been dis |
|
|
Return a list of the names of all loaded plugins
|
|
|
Return an iterator to iterate over all loaded plugins.
|
|
|
Return a static instance of KURIFilter. |
1.2.18