\section{KURIFilter Class Reference}
\label{classKURIFilter}\index{KURIFilter@{KURIFilter}}
Manages the filtering of URIs. Filters a given URL into its proper format whenever possible.  


{\tt \#include $<$kurifilter.h$>$}

Collaboration diagram for KURIFilter:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=99pt]{classKURIFilter__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf $\sim$KURIFilter} ()
\item 
bool {\bf filter\-URI} ({\bf KURIFilter\-Data} \&data, const {\bf QString\-List} \&filters={\bf QString\-List}())
\item 
bool {\bf filter\-URI} ({\bf KURL} \&uri, const {\bf QString\-List} \&filters={\bf QString\-List}())
\item 
bool {\bf filter\-URI} ({\bf QString} \&uri, const {\bf QString\-List} \&filters={\bf QString\-List}())
\item 
{\bf KURL} {\bf filtered\-URI} (const {\bf KURL} \&uri, const {\bf QString\-List} \&filters={\bf QString\-List}())
\item 
{\bf QString} {\bf filtered\-URI} (const {\bf QString} \&uri, const {\bf QString\-List} \&filters={\bf QString\-List}())
\item 
{\bf QPtr\-List\-Iterator}$<$ {\bf KURIFilter\-Plugin} $>$ {\bf plugins\-Iterator} () const 
\item 
{\bf QString\-List} {\bf plugin\-Names} () const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KURIFilter} $\ast$ {\bf self} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KURIFilter} ()
\item 
void {\bf load\-Plugins} ()
\end{CompactItemize}


\subsection{Detailed Description}
Manages the filtering of URIs. 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 {\bf KURL} without modifying it directly. This way {\bf 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 {\bf KURIFilter\-Plugin}{\rm (p.\,\pageref{classKURIFilterPlugin})} and implementing the {\bf KURIFilter\-Plugin::filter\-URI}{\rm (p.\,\pageref{classKURIFilterPlugin_a3})} 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 {\tt {\bf KURIFilter::self()}{\rm (p.\,\pageref{classKURIFilter_e0})}} and use any of the public member functions to preform the filtering.

{\bf Example} 

To simply filter a given string:



\footnotesize\begin{verbatim} bool filtered = KURIFilter::self()->filterURI( "kde.org" );
\end{verbatim}
\normalsize


You can alternatively use a {\bf KURL}:



\footnotesize\begin{verbatim} KURL url = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( url );
\end{verbatim}
\normalsize


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:



\footnotesize\begin{verbatim} QString u = KURIFilter::self()->filteredURI( "kde.org" );
\end{verbatim}
\normalsize


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 {\bf QString\-List} and invoke the appropriate filtering function. The examples below show the use of specific filters. The first one uses a single filter called kshorturifilter while the second example uses multiple filters:



\footnotesize\begin{verbatim} QString text = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( text, "kshorturifilter" );
\end{verbatim}
\normalsize




\footnotesize\begin{verbatim} QStringList list;
 list << "kshorturifilter" << "localdomainfilter";
 bool filtered = KURIFilter::self()->filterURI( text, list );
\end{verbatim}
\normalsize


KURIFilter also allows richer data exchange through a simple meta-object called {\tt {\bf KURIFilter\-Data}{\rm (p.\,\pageref{classKURIFilterData})}}. Using this meta-object you can find out more information about the URL you want to filter. See {\bf KURIFilter\-Data}{\rm (p.\,\pageref{classKURIFilterData})} for examples and details.



Definition at line 528 of file kurifilter.h.

\subsection{Constructor \& Destructor Documentation}
\index{KURIFilter@{KURIFilter}!~KURIFilter@{$\sim$KURIFilter}}
\index{~KURIFilter@{$\sim$KURIFilter}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURIFilter::$\sim${\bf KURIFilter} ()}\label{classKURIFilter_a0}


Destructor. 



Definition at line 222 of file kurifilter.cpp.\index{KURIFilter@{KURIFilter}!KURIFilter@{KURIFilter}}
\index{KURIFilter@{KURIFilter}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURIFilter::KURIFilter ()\hspace{0.3cm}{\tt  [protected]}}\label{classKURIFilter_b0}


A protected constructor. 

This constructor creates a KURIFilter and initializes all plugins it can find by invoking load\-Plugins. 

Definition at line 216 of file kurifilter.cpp.

References load\-Plugins(), and QPtr\-List::set\-Auto\-Delete().

\subsection{Member Function Documentation}
\index{KURIFilter@{KURIFilter}!self@{self}}
\index{self@{self}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURIFilter} $\ast$ KURIFilter::self ()\hspace{0.3cm}{\tt  [static]}}\label{classKURIFilter_e0}


Returns an instance of KURIFilter. 



Definition at line 209 of file kurifilter.cpp.

References KStatic\-Deleter$<$ type $>$::set\-Object().\index{KURIFilter@{KURIFilter}!filterURI@{filterURI}}
\index{filterURI@{filterURI}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURIFilter::filter\-URI ({\bf KURIFilter\-Data} \& {\em data}, const {\bf QString\-List} \& {\em filters} = {\tt {\bf QString\-List}()})}\label{classKURIFilter_a1}


Filters the URI given by the object URIFilter\-Data. 

The given URL is filtered based on the specified list of filters. If the list is empty all available filters would be used.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]object that contains the URI to be filtered. \item[{\em filters}]specify the list of filters to be used.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a boolean indicating whether the URI has been changed \end{Desc}


Definition at line 227 of file kurifilter.cpp.

References QPtr\-List::append(), and QPtr\-List\-Iterator::current().

Referenced by filtered\-URI(), and filter\-URI().\index{KURIFilter@{KURIFilter}!filterURI@{filterURI}}
\index{filterURI@{filterURI}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURIFilter::filter\-URI ({\bf KURL} \& {\em uri}, const {\bf QString\-List} \& {\em filters} = {\tt {\bf QString\-List}()})}\label{classKURIFilter_a2}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]the URI to filter. \item[{\em filters}]specify the list of filters to be used.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a boolean indicating whether the URI has been changed \end{Desc}


Definition at line 265 of file kurifilter.cpp.

References filter\-URI(), and KURIFilter\-Data::uri().\index{KURIFilter@{KURIFilter}!filterURI@{filterURI}}
\index{filterURI@{filterURI}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURIFilter::filter\-URI ({\bf QString} \& {\em uri}, const {\bf QString\-List} \& {\em filters} = {\tt {\bf QString\-List}()})}\label{classKURIFilter_a3}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]The URI to filter. \item[{\em filters}]specify the list of filters to be used.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a boolean indicating whether the URI has been changed \end{Desc}


Definition at line 273 of file kurifilter.cpp.

References filter\-URI(), KURIFilter\-Data::uri(), and KURL::url().\index{KURIFilter@{KURIFilter}!filteredURI@{filteredURI}}
\index{filteredURI@{filteredURI}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL} KURIFilter::filtered\-URI (const {\bf KURL} \& {\em uri}, const {\bf QString\-List} \& {\em filters} = {\tt {\bf QString\-List}()})}\label{classKURIFilter_a4}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]The URI to filter. \item[{\em filters}]specify the list of filters to be used.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the filtered URI or null if it cannot be filtered \end{Desc}


Definition at line 282 of file kurifilter.cpp.

References filter\-URI(), and KURIFilter\-Data::uri().\index{KURIFilter@{KURIFilter}!filteredURI@{filteredURI}}
\index{filteredURI@{filteredURI}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURIFilter::filtered\-URI (const {\bf QString} \& {\em uri}, const {\bf QString\-List} \& {\em filters} = {\tt {\bf QString\-List}()})}\label{classKURIFilter_a5}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]the URI to filter. \item[{\em filters}]specify the list of filters to be used.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the filtered URI or null if it cannot be filtered \end{Desc}


Definition at line 289 of file kurifilter.cpp.

References filter\-URI(), KURIFilter\-Data::uri(), and KURL::url().\index{KURIFilter@{KURIFilter}!pluginsIterator@{pluginsIterator}}
\index{pluginsIterator@{pluginsIterator}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List\-Iterator}$<$ {\bf KURIFilter\-Plugin} $>$ KURIFilter::plugins\-Iterator () const}\label{classKURIFilter_a6}


Return an iterator to iterate over all loaded plugins. 

\begin{Desc}
\item[Returns:]a plugin iterator. \end{Desc}


Definition at line 296 of file kurifilter.cpp.

Referenced by plugin\-Names().\index{KURIFilter@{KURIFilter}!pluginNames@{pluginNames}}
\index{pluginNames@{pluginNames}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KURIFilter::plugin\-Names () const}\label{classKURIFilter_a7}


Return a list of the names of all loaded plugins. 

\begin{Desc}
\item[Returns:]a {\bf QString\-List} of plugin names \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 301 of file kurifilter.cpp.

References plugins\-Iterator().\index{KURIFilter@{KURIFilter}!loadPlugins@{loadPlugins}}
\index{loadPlugins@{loadPlugins}!KURIFilter@{KURIFilter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURIFilter::load\-Plugins ()\hspace{0.3cm}{\tt  [protected]}}\label{classKURIFilter_b1}


Loads all allowed plugins. 

This function loads all filters that have not been disbled. 

Definition at line 309 of file kurifilter.cpp.

References QPtr\-List::append(), QValue\-List::begin(), QValue\-List::end(), KTrader::query(), and KTrader::self().

Referenced by KURIFilter().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kurifilter.h\item 
kurifilter.cpp\end{CompactItemize}
