KURIFilter Class Reference
Manages the filtering of a URI. Filters a given URL into its proper format whenever possible. More...
#include <kurifilter.h>
Public Member Functions | |
~KURIFilter () | |
Destructor. | |
bool | filterURI (KURIFilterData &data, const QStringList &filters=QStringList()) |
Filters the URI given by the object URIFilterData. | |
bool | filterURI (KURL &uri, const QStringList &filters=QStringList()) |
Filters the URI given by the URL. | |
bool | filterURI (QString &uri, const QStringList &filters=QStringList()) |
Filters a string representing a URI. | |
KURL | filteredURI (const KURL &uri, const QStringList &filters=QStringList()) |
Returns the filtered URI. | |
QString | filteredURI (const QString &uri, const QStringList &filters=QStringList()) |
Return a filtered string representation of a URI. | |
QPtrListIterator< KURIFilterPlugin > | pluginsIterator () const |
Return an iterator to iterate over all loaded plugins. | |
QStringList | pluginNames () const |
Return a list of the names of all loaded plugins. | |
Static Public Member Functions | |
KURIFilter * | self () |
Return a static instance of KURIFilter. | |
Protected Member Functions | |
KURIFilter () | |
A protected constructor. | |
void | loadPlugins () |
Loads all allowed plugins. |
Detailed Description
Manages the filtering of a URI. Filters a given URL into its proper format whenever possible.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:
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 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:
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.
Constructor & Destructor Documentation
|
Destructor.
Definition at line 188 of file kurifilter.cpp. |
|
A protected constructor. This constructor creates a KURIFilter and initializes all plugins it can find by invoking loadPlugins. Definition at line 182 of file kurifilter.cpp. References loadPlugins(). |
Member Function Documentation
|
Return a static instance of KURIFilter.
Definition at line 175 of file kurifilter.cpp. |
|
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.
Definition at line 193 of file kurifilter.cpp. References QPtrListIterator::current(). Referenced by filteredURI(), and 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.
Definition at line 232 of file kurifilter.cpp. References filterURI(), and KURIFilterData::uri(). |
|
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.
Definition at line 240 of file kurifilter.cpp. References filterURI(), KURIFilterData::uri(), and KURL::url(). |
|
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.
Definition at line 249 of file kurifilter.cpp. References filterURI(), and KURIFilterData::uri(). |
|
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.
Definition at line 256 of file kurifilter.cpp. References filterURI(), KURIFilterData::uri(), and KURL::url(). |
|
Return an iterator to iterate over all loaded plugins.
Definition at line 263 of file kurifilter.cpp. Referenced by pluginNames(). |
|
Return a list of the names of all loaded plugins.
Definition at line 268 of file kurifilter.cpp. References pluginsIterator(). |
|
Loads all allowed plugins. This function loads all filters that have not been dis Definition at line 276 of file kurifilter.cpp. References QValueList::begin(), QValueList::end(), KStdAccel::end(), KTrader::OfferList, KTrader::query(), and KTrader::self(). Referenced by KURIFilter(). |
The documentation for this class was generated from the following files: