[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/akregator/src/libsyndication/src/rdf
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2006-01-13 10:21:19
Message-ID: 1137147679.264795.14149.nullmailer () svn ! kde ! org
[Download RAW message or body]

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<StatementPtr> stmts = d->statements.values();
+    QList<StatementPtr>::ConstIterator it = stmts.begin();
+    QList<StatementPtr>::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<ResourcePtr> Model::resourcesWithType(ResourcePtr type) const
 {
     QList<ResourcePtr> 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<StatementPtr> statements() const;
-        
+
         // TODO: support inheritance
         /**
          * returns all resources of a given type.
@@ -119,7 +115,19 @@
          *
          */
         virtual QList<ResourcePtr> resourcesWithType(ResourcePtr type) const;
+
+        /**
+         * returns a list of the statements in this model.
+         * 
+         */
+        virtual QList<StatementPtr> 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.
          *
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic