Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

QAbstractUriResolver Class Reference
[
QtXmlPatterns module]

The QAbstractUriResolver class provides a callback interface that is used to rewrite one URI as another. More...

 #include <QAbstractUriResolver>

Inherits QObject.

Note: All the functions in this class are reentrant.

This class was introduced in Qt 4.4.

Public Functions

Additional Inherited Members


Detailed Description

The QAbstractUriResolver class provides a callback interface that is used to rewrite one URI as another.

Uniform Resource Identifiers, URIs, are strings that identify or name a resource. That URIs are not more specific than that, makes them versatelite, global identifiers.

However, in some circumstances it can be useful to turn a URI that identifies something logical, into a URI that locates something physical(an URL), or to simply rewrite one URI into a completely different. QAbstractUriResolver offers this functionality through its resolve() function.

For instance, one could write a QAbstractUriResolver subclass that rewrites urn:isbn:0-345-33973-8 into an actual file: file:///books/returnOfTheKing.doc. Or a web browser could disallow certain URIs, as part of protecting the user's private files from malicious scripts.

See also Wikipedia, Uniform Resource Identifier.


Member Function Documentation

QAbstractUriResolver::QAbstractUriResolver ( QObject * parent = 0 )

Constructs a QAbstractUriResolver instance.

The argument parent is sent to the QObject's constructor.

QAbstractUriResolver::~QAbstractUriResolver ()   [virtual]

Destructs this QAbstractUriResolver instance.

QUrl QAbstractUriResolver::resolve ( const QUrl & relative, const QUrl & baseURI ) const   [pure virtual]

Given relative and baseURI, returns the URI that actually should be used.

baseURI is the URI that the caller would use for resolving relative into an absolute URI.

The caller guarantees that baseURI is valid and absolute, and that relative is valid or empty and may be relative or absolute.

The implementation guarantees that the returned QUrl is absolute or a default constructed QUrl. In other cases, effects are undefined. If a default constructed QUrl is returned, it signals that this QAbstractUriResolver did not accept the URI requested to be resolved.

This means if this QAbstractUriResolvers has no particular task to do with the URI, it should simply return relative resolved against baseURI, which is done by:

 return baseURI.resolved(relative);

See also QUrl::isRelative() and QUrl::isValid().


Copyright © 2007 Trolltech Trademarks
Qt 4.4.0-tp1