Create feed using entries from backend
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 9 Aug 2008 22:18:03 +0000 (19:18 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 9 Aug 2008 22:18:03 +0000 (19:18 -0300)
include/atompub/backend.h
src/backend.c

index e242105..9a84f2f 100644 (file)
@@ -23,6 +23,7 @@
 #include <atompub/ctx.h>
 #include <atompub/entry.h>
 #include <atompub/iri.h>
+#include <atompub/feed.h>
 
 typedef struct _atom_backend AtomBackend;
 
@@ -34,6 +35,7 @@ void atom_backend_enumerate_entries_set (AtomBackend *,
                                         void (AtomCtx *, AtomEntry ***, size_t *));
 AtomEntry * atom_retrieve_resource (AtomCtx *, IRI *);
 void atom_enumerate_entries (AtomCtx *, AtomEntry ***, size_t *);
+AtomFeed * atom_retrieve_feed (AtomCtx *);
 AtomBackend * atom_backend (AtomCtx *);
 void atom_backend_set (AtomCtx *, AtomBackend *);
 
index f6051be..223fcee 100644 (file)
@@ -79,3 +79,15 @@ atom_backend_enumerate_entries (AtomCtx *ctx, AtomEntry *** entries, size_t *len
       return;
     }
 }
+
+AtomFeed *
+atom_retrieve_feed (AtomCtx *ctx)
+{
+  AtomFeed *feed;
+  AtomEntry **entries;
+  size_t len;
+  atom_backend_enumerate_entries (ctx, &entries, &len);
+  feed = atom_feed_new ();
+  atom_feed_entry_append_array (feed, entries, len);
+  return feed;
+}