• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KURIFilter Class Reference

#include <kurifilter.h>

Public Member Functions

 ~KURIFilter ()
 
bool filterURI (KURIFilterData &data, const TQStringList &filters=TQStringList())
 
bool filterURI (KURL &uri, const TQStringList &filters=TQStringList())
 
bool filterURI (TQString &uri, const TQStringList &filters=TQStringList())
 
KURL filteredURI (const KURL &uri, const TQStringList &filters=TQStringList())
 
TQString filteredURI (const TQString &uri, const TQStringList &filters=TQStringList())
 
TQPtrListIterator< KURIFilterPlugin > pluginsIterator () const
 
TQStringList pluginNames () const
 

Static Public Member Functions

static KURIFilter * self ()
 

Protected Member Functions

 KURIFilter ()
 
void loadPlugins ()
 

Detailed Description

Manages the filtering of URIs.

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. 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:

bool filtered = KURIFilter::self()->filterURI( "kde.org" );
KURIFilter::filterURI
bool filterURI(KURIFilterData &data, const TQStringList &filters=TQStringList())
Filters the URI given by the object URIFilterData.
Definition: kurifilter.cpp:345
KURIFilter::self
static KURIFilter * self()
Returns an instance of KURIFilter.
Definition: kurifilter.cpp:328

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:

TQString u = KURIFilter::self()->filteredURI( "kde.org" );
KURIFilter::filteredURI
KURL filteredURI(const KURL &uri, const TQStringList &filters=TQStringList())
Returns the filtered URI.
Definition: kurifilter.cpp:400

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 TQStringList and invoke the appropriate filtering function. The examples below show the use of specific filters. The first one uses a single filter called tdeshorturifilter while the second example uses multiple filters:

TQString text = "kde.org";
bool filtered = KURIFilter::self()->filterURI( text, "tdeshorturifilter" );
TQStringList list;
list << "tdeshorturifilter" << "localdomainfilter";
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.

Filters a given URL into its proper format whenever possible.

Definition at line 548 of file kurifilter.h.

Constructor & Destructor Documentation

◆ ~KURIFilter()

KURIFilter::~KURIFilter ( )

Destructor.

Definition at line 341 of file kurifilter.cpp.

◆ KURIFilter()

KURIFilter::KURIFilter ( )
protected

A protected constructor.

This constructor creates a KURIFilter and initializes all plugins it can find by invoking loadPlugins.

Definition at line 335 of file kurifilter.cpp.

Member Function Documentation

◆ filteredURI() [1/2]

KURL KURIFilter::filteredURI ( const KURL &  uri,
const TQStringList &  filters = TQStringList() 
)

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.

Parameters
uriThe URI to filter.
filtersspecify the list of filters to be used.
Returns
the filtered URI or null if it cannot be filtered

Definition at line 400 of file kurifilter.cpp.

◆ filteredURI() [2/2]

TQString KURIFilter::filteredURI ( const TQString &  uri,
const TQStringList &  filters = TQStringList() 
)

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.

Parameters
urithe URI to filter.
filtersspecify the list of filters to be used.
Returns
the filtered URI or null if it cannot be filtered

Definition at line 407 of file kurifilter.cpp.

◆ filterURI() [1/3]

bool KURIFilter::filterURI ( KURIFilterData &  data,
const TQStringList &  filters = TQStringList() 
)

Filters the URI given by the object URIFilterData.

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

Parameters
dataobject that contains the URI to be filtered.
filtersspecify the list of filters to be used.
Returns
a boolean indicating whether the URI has been changed

Definition at line 345 of file kurifilter.cpp.

◆ filterURI() [2/3]

bool KURIFilter::filterURI ( KURL &  uri,
const TQStringList &  filters = TQStringList() 
)

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.

Parameters
urithe URI to filter.
filtersspecify the list of filters to be used.
Returns
a boolean indicating whether the URI has been changed

Definition at line 383 of file kurifilter.cpp.

◆ filterURI() [3/3]

bool KURIFilter::filterURI ( TQString &  uri,
const TQStringList &  filters = TQStringList() 
)

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.

Parameters
uriThe URI to filter.
filtersspecify the list of filters to be used.
Returns
a boolean indicating whether the URI has been changed

Definition at line 391 of file kurifilter.cpp.

◆ loadPlugins()

void KURIFilter::loadPlugins ( )
protected

Loads all allowed plugins.

This function loads all filters that have not been disbled.

Definition at line 427 of file kurifilter.cpp.

◆ pluginNames()

TQStringList KURIFilter::pluginNames ( ) const

Return a list of the names of all loaded plugins.

Returns
a TQStringList of plugin names
Since
3.1

Definition at line 419 of file kurifilter.cpp.

◆ pluginsIterator()

TQPtrListIterator< KURIFilterPlugin > KURIFilter::pluginsIterator ( ) const

Return an iterator to iterate over all loaded plugins.

Returns
a plugin iterator.

Definition at line 414 of file kurifilter.cpp.

◆ self()

KURIFilter * KURIFilter::self ( )
static

Returns an instance of KURIFilter.

Definition at line 328 of file kurifilter.cpp.


The documentation for this class was generated from the following files:
  • kurifilter.h
  • kurifilter.cpp

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.