Dataquay::Uri Class Reference

Uri represents a single URI. More...

#include <Uri.h>

List of all members.

Public Member Functions

 Uri ()
 Construct an empty (invalid, null) URI.
 Uri (const QString &s)
 Construct a URI from the given string, which is expected to contain the text of a complete well-formed URI.
 Uri (const QUrl &u)
 Construct a URI from the given QUrl, which is expected to contain a complete well-formed URI.
 ~Uri ()
QString toString () const
QUrl toUrl () const
int length () const
QString scheme () const
bool operator== (const Uri &u) const
bool operator!= (const Uri &u) const
bool operator< (const Uri &u) const
bool operator> (const Uri &u) const

Static Public Member Functions

static QString metaTypeName ()
static int metaTypeId ()
static bool isUri (const QVariant &)

Detailed Description

Uri represents a single URI.

It is a very thin wrapper around a string. Its purpose is to allow us to distinguish between abbreviated URIs (CURIEs) which may be subject to prefix expansion (represented by strings) and full URIs (represented by Uri).

In terms of the Turtle syntax, anything written within angle brackets is a Uri, while a bare string in URI context is not: it should be stored as a QString and converted to a Uri using Store::expand(). For example, <http://xmlns.com/foaf/0.1/name> is a Uri, while foaf:name is just a string. Never store the latter form in a Uri object without expanding it first.

(Wherever a method in Dataquay accepts a URI as a QString type, it is safe to assume that it will expand any prefixes used in the URI before use. Some methods may exist in alternative forms with Uri or QString arguments; in this case the QString form does prefix expansion, while the Uri form does not.)

Dataquay uses Uri in preference to QUrl because the latter is relatively slow to convert to and from string forms. Uri imposes no overhead over a string, it simply aids type safety.

Definition at line 82 of file Uri.h.


Constructor & Destructor Documentation

Dataquay::Uri::Uri (  )  [inline]

Construct an empty (invalid, null) URI.

Definition at line 88 of file Uri.h.

Dataquay::Uri::Uri ( const QString &  s  )  [inline, explicit]

Construct a URI from the given string, which is expected to contain the text of a complete well-formed URI.

To construct a Uri from an abbreviated URI via prefix expansion, use Store::expand() instead. This constructor is intentionally marked explicit; no silent conversion is available.

Definition at line 98 of file Uri.h.

Dataquay::Uri::Uri ( const QUrl &  u  )  [inline, explicit]

Construct a URI from the given QUrl, which is expected to contain a complete well-formed URI.

Definition at line 108 of file Uri.h.

Dataquay::Uri::~Uri (  )  [inline]

Definition at line 113 of file Uri.h.


Member Function Documentation

QString Dataquay::Uri::toString (  )  const [inline]

Definition at line 116 of file Uri.h.

Referenced by Dataquay::PropertyObject::getPropertyUri(), and qHash().

QUrl Dataquay::Uri::toUrl (  )  const [inline]

Definition at line 117 of file Uri.h.

int Dataquay::Uri::length (  )  const [inline]

Definition at line 118 of file Uri.h.

Referenced by operator==().

QString Dataquay::Uri::scheme (  )  const

Definition at line 110 of file Uri.cpp.

bool Dataquay::Uri::operator== ( const Uri u  )  const

Definition at line 118 of file Uri.cpp.

References length().

Referenced by operator!=().

bool Dataquay::Uri::operator!= ( const Uri u  )  const [inline]

Definition at line 123 of file Uri.h.

References operator==().

bool Dataquay::Uri::operator< ( const Uri u  )  const [inline]

Definition at line 124 of file Uri.h.

bool Dataquay::Uri::operator> ( const Uri u  )  const [inline]

Definition at line 125 of file Uri.h.

QString Dataquay::Uri::metaTypeName (  )  [static]

Definition at line 80 of file Uri.cpp.

int Dataquay::Uri::metaTypeId (  )  [static]

Definition at line 86 of file Uri.cpp.

References DEBUG.

Referenced by isUri().

bool Dataquay::Uri::isUri ( const QVariant &  v  )  [static]

Definition at line 130 of file Uri.cpp.

References metaTypeId().

Referenced by Dataquay::Node::fromVariant().


The documentation for this class was generated from the following files:
Generated on Thu May 17 22:54:21 2012 for Dataquay by  doxygen 1.6.3