/***************************************************************************
                            kde_KURIFilter.h -  description
                             -------------------
    begin                : Wed Feb  6 15:12:26 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Feb  6 15:12:26 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#ifndef KDE_KURIFILTER
#define KDE_KURIFILTER

#include <qtc/qtc_types.h>

#include <kdec/kde_types.h>

/**

 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 @ref KURIFilterPlugin and
 implementing the @ref 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 @p KURIFilter::self() and use any of the public member
 functions to preform the filtering.

 To simply filter a given string:
 <pre>
 bool filtered = KURIFilter::self()->filterURI( "kde.org" );
 </pre>

 You can alternatively use a KURL:
 <pre>
 KURL url = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( url );
 </pre>

 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:
 <pre>
 QString u = KURIFilter::self()->filteredURI( "kde.org" );
 </pre>

 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:
 <pre>
 QString text = "kde.org";
 bool filtered = KURIFilter::self()->filterURI( text, "KShortURIFilter" );

 QStringList list;
 list << "KShortURIFilter" << "MyFilter";
 bool filtered = KURIFilter::self()->filterURI( text, list );
 </pre>

 KURIFilter also allows richer data exchange through a simple
 meta-object called @p KURIFilterData.  Using this meta-object
 you can find out more information about the URL you want to
 filter.  See @ref KURIFilterData for examples and details.

 @short Filters a given URL into its proper format whenever possible.
 
*/

/** 
 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.

*/
int kde_KURIFilter_filterURI(kde_KURIFilter* instPointer,kde_KURIFilterData* data, qt_QStringList* filters);

/** 
 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.

*/
int kde_KURIFilter_filterURI1(kde_KURIFilter* instPointer,kde_KURL* uri, qt_QStringList* filters);

/** 
 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.

*/
int kde_KURIFilter_filterURI2(kde_KURIFilter* instPointer,qt_QString * uri, qt_QStringList* filters);

/** 
 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.

*/
kde_KURL* kde_KURIFilter_filteredURI(kde_KURIFilter* instPointer,kde_KURL* uri, qt_QStringList* filters);

/** 
 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.

*/
qt_QString * kde_KURIFilter_filteredURI1(kde_KURIFilter* instPointer,qt_QString * uri, qt_QStringList* filters);

/** 
 Return a static instance of KURIFilter.
     
*/
kde_KURIFilter* kde_KURIFilter_self( );

/** 
 A protected constructor.

 This constructor creates a KURIFilter and
 initializes all plugins it can find by invoking
 @ref loadPlugins.
     
*/
kde_KURIFilter * kde_new_KURIFilter();

/** 
 Loads all allowed plugins.

 This function loads all filters that have not
 been dis
     
*/
void kde_KURIFilter_loadPlugins(kde_KURIFilter* instPointer);

#endif
