#include <glib.h>
#include <atompub/atom.h>
-gchar *giochannel_iri_to_filename (AtomCtx *ctx, IRI *iri)
+static gchar *
+giochannel_iri_to_filename (AtomCtx *ctx, IRI *iri)
{
gchar *root = atom_config_get_str (ctx, "giochannel", "root");
gchar *path = iri_get_path (iri);
return filename;
}
-Atom * giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
+static Atom *
+giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
{
gchar *filename;
GIOChannel *channel;
g_free (data);
return atom;
}
+
+AtomBackend *
+giochannel_backend (void)
+{
+ AtomBackend *backend;
+ backend = atom_backend_new ();
+ atom_backend_retrieve_resource_set (backend,
+ giochannel_atom_retrieve_resource);
+ return backend;
+}
#include <gio/gio.h>
#include <atompub/atom.h>
-GFile *gio_iri_to_file (AtomCtx *ctx, IRI *iri)
+static GFile *
+gio_iri_to_file (AtomCtx *ctx, IRI *iri)
{
gchar *root = atom_config_get_str (ctx, "gio", "root");
gchar *path = iri_get_path (iri);
return file;
}
-Atom * gio_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
+static Atom *
+gio_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
{
GFile *file;
GError *error = NULL;
g_free (data);
return atom;
}
+
+AtomBackend *
+gio_backend (void)
+{
+ AtomBackend *backend;
+ backend = atom_backend_new ();
+ atom_backend_retrieve_resource_set (backend, gio_atom_retrieve_resource);
+ return backend;
+}
typedef struct _atom_backend AtomBackend;
+AtomBackend *atom_backend_new (void);
+void atom_backend_retrieve_resource_set (AtomBackend *,
+ Atom * (AtomCtx *, IRI *));
Atom * atom_retrieve_resource (AtomCtx *, IRI *);
AtomBackend * atom_backend (AtomCtx *);
void atom_backend_set (AtomCtx *, AtomBackend *);
Atom * (*retrieve_resource) (AtomCtx *, IRI *);
};
+AtomBackend *
+atom_backend_new ()
+{
+ AtomBackend *backend;
+ backend = g_slice_new (AtomBackend);
+ backend->retrieve_resource = NULL;
+ return backend;
+}
+
+void
+atom_backend_retrieve_resource_set (AtomBackend *backend,
+ Atom *retrieve_resource (AtomCtx *,
+ IRI *))
+{
+ backend->retrieve_resource = retrieve_resource;
+}
Atom *
atom_retrieve_resource (AtomCtx *ctx, IRI *iri)