From kde-commits Fri Jan 13 10:21:19 2006 From: Frank Osterfeld Date: Fri, 13 Jan 2006 10:21:19 +0000 To: kde-commits Subject: KDE/kdepim/akregator/src/libsyndication/src/rdf Message-Id: <1137147679.264795.14149.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=113714775806883 SVN commit 497605 by osterfeld: add debuginfo(), remove createResource(ResourcePtr) M +26 -5 model.cpp M +18 -10 model.h --- trunk/KDE/kdepim/akregator/src/libsyndication/src/rdf/model.cpp #497604:497605 @@ -166,11 +166,6 @@ return *d == *(other.d); } -ResourcePtr Model::createResource(ResourcePtr resource) -{ - return createResource(resource->uri()); -} - PropertyPtr Model::createProperty(const QString& uri) { PropertyPtr prop; @@ -348,6 +343,32 @@ return d->statements.values(); } +QString Model::debugInfo() const +{ + QString info; + + QList stmts = d->statements.values(); + QList::ConstIterator it = stmts.begin(); + QList::ConstIterator end = stmts.end(); + + for ( ; it != end; ++it) + { + info += QString("<%1> <%2> ").arg((*it)->subject()->uri()).arg((*it)->predicate()->uri()); + + if ((*it)->object()->isLiteral()) + { + info += QString("\"%1\"\n").arg((*it)->asString()); + } + else + { + info += QString("<%1>\n").arg((*it)->asResource()->uri()); + } + + } + + return info; +} + QList Model::resourcesWithType(ResourcePtr type) const { QList list; --- trunk/KDE/kdepim/akregator/src/libsyndication/src/rdf/model.h #497604:497605 @@ -37,7 +37,11 @@ namespace LibSyndication { namespace RDF { - +/** + * TODO + * + * @author Frank Osterfeld + */ class Model { public: @@ -49,8 +53,6 @@ Model& operator=(const Model& other); bool operator==(const Model& other) const; - - virtual ResourcePtr createResource(ResourcePtr resource); /** * creates a resource and associates it with this model. If the model @@ -104,13 +106,7 @@ * returns whether this model is empty, i.e. contains no statements. */ virtual bool isEmpty() const; - - virtual bool resourceHasProperty(const Resource* resource, PropertyPtr property) const; - - virtual StatementPtr resourceProperty(const Resource* resource, PropertyPtr property) const; - - virtual QList statements() const; - + // TODO: support inheritance /** * returns all resources of a given type. @@ -119,7 +115,19 @@ * */ virtual QList resourcesWithType(ResourcePtr type) const; + + /** + * returns a list of the statements in this model. + * + */ + virtual QList statements() const; + virtual QString debugInfo() const; + + virtual bool resourceHasProperty(const Resource* resource, PropertyPtr property) const; + + virtual StatementPtr resourceProperty(const Resource* resource, PropertyPtr property) const; + /** * searches the model for a node by ID. *