\section{KURIFilter Class Reference}
\label{classKURIFilter}\index{KURIFilter@{KURIFilter}}
Manages the filtering of a URI. 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=82pt]{classKURIFilter__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf $\sim$KURIFilter} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
bool {\bf filter\-URI} ({\bf KURIFilter\-Data} \&data, const  {\bf QString\-List} \&filters={\bf QString\-List}())
\begin{CompactList}\small\item\em Filters the URI given by the object URIFilter\-Data. \item\end{CompactList}\item 
bool {\bf filter\-URI} ({\bf KURL} \&uri, const  {\bf QString\-List} \&filters={\bf QString\-List}())
\begin{CompactList}\small\item\em Filters the URI given by the URL. \item\end{CompactList}\item 
bool {\bf filter\-URI} ({\bf QString} \&uri, const  {\bf QString\-List} \&filters={\bf QString\-List}())
\begin{CompactList}\small\item\em Filters a string representing a URI. \item\end{CompactList}\item 
{\bf KURL} {\bf filtered\-URI} (const  {\bf KURL} \&uri, const  {\bf QString\-List} \&filters={\bf QString\-List}())
\begin{CompactList}\small\item\em Returns the filtered URI. \item\end{CompactList}\item 
{\bf QString} {\bf filtered\-URI} (const  {\bf QString} \&uri, const  {\bf QString\-List} \&filters={\bf QString\-List}())
\begin{CompactList}\small\item\em Return a filtered string representation of a URI. \item\end{CompactList}\item 
{\bf QPtr\-List\-Iterator}$<$ {\bf KURIFilter\-Plugin} $>$ {\bf plugins\-Iterator} () const 
\begin{CompactList}\small\item\em Return an iterator to iterate over all loaded plugins. \item\end{CompactList}\item 
{\bf QString\-List} {\bf plugin\-Names} () const 
\begin{CompactList}\small\item\em Return a list of the names of all loaded plugins. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KURIFilter} $\ast$ {\bf self} ()
\begin{CompactList}\small\item\em Return a static instance of KURIFilter. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KURIFilter} ()
\begin{CompactList}\small\item\em A protected constructor. \item\end{CompactList}\item 
void {\bf load\-Plugins} ()
\begin{CompactList}\small\item\em Loads all allowed plugins. \item\end{CompactList}\end{CompactItemize}


\subsection{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 {\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. That is, 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}

{\bf  To simply filter a given string: \small\begin{alltt}
 bool filtered = {\bf KURIFilter::self()}{\rm (p.\,\pageref{classKURIFilter_e0})}-$>$filterURI( "kde.org" );
 \end{alltt}\normalsize 
}

{\bf  You can alternatively use a {\bf KURL}: \small\begin{alltt}
 {\bf KURL} url = "kde.org";
 bool filtered = {\bf KURIFilter::self()}{\rm (p.\,\pageref{classKURIFilter_e0})}-$>$filterURI( url );
 \end{alltt}\normalsize 
}

{\bf  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: \small\begin{alltt}
 {\bf QString} u = {\bf KURIFilter::self()}{\rm (p.\,\pageref{classKURIFilter_e0})}-$>$filteredURI( "kde.org" );
 \end{alltt}\normalsize 
}

{\bf  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 $\backslash$\char`\"{}.desktop$\backslash$\char`\"{} files. Here are a couple of examples: \small\begin{alltt}
 {\bf QString} text = "kde.org";
 bool filtered = {\bf KURIFilter::self()}{\rm (p.\,\pageref{classKURIFilter_e0})}-$>$filterURI( text, "KShortURIFilter" );\end{alltt}\normalsize 
}

{\bf \small\begin{alltt} {\bf QStringList} list;
 list $<$$<$ "KShortURIFilter" $<$$<$ "MyFilter";
 bool filtered = {\bf KURIFilter::self()}{\rm (p.\,\pageref{classKURIFilter_e0})}-$>$filterURI( text, list );
 \end{alltt}\normalsize 
}

{\bf  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.}

{\bf }

{\bf  }



Definition at line 469 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 188 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 {\bf load\-Plugins}{\rm (p.\,\pageref{classKURIFilter_b1})}. 

Definition at line 182 of file kurifilter.cpp.

References load\-Plugins().

\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}


Return a static instance of KURIFilter. 



Definition at line 175 of file kurifilter.cpp.\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} = {\bf QString\-List}())}\label{classKURIFilter_a1}


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

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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]object that contains the URI to be filtered. \item[{\em filters}]specify the list 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 193 of file kurifilter.cpp.

References 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} = {\bf QString\-List}())}\label{classKURIFilter_a2}


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.

\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 232 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} = {\bf QString\-List}())}\label{classKURIFilter_a3}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]The URI to filter. \item[{\em filters}]specify the list 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 240 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} = {\bf QString\-List}())}\label{classKURIFilter_a4}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]The URI to filter. \item[{\em filters}]specify the list 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 249 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} = {\bf QString\-List}())}\label{classKURIFilter_a5}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em uri}]the URI to filter. \item[{\em filters}]specify the list 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 256 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 263 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[Since:]3.1\end{Desc}
\begin{Desc}
\item[Returns:]a {\bf QString\-List} of plugin names \end{Desc}


Definition at line 268 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 dis 

Definition at line 276 of file kurifilter.cpp.

References QValue\-List::begin(), QValue\-List::end(), KStd\-Accel::end(), KTrader::Offer\-List, 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}
