lib_LTLIBRARIES = libatom.la
libatom_la_SOURCES = id.c entry.c person.c feed.c resource.c \
- config.c ctx.c backend.c error.c
+ config.c ctx.c backend.c error.c frontend.c
libatom_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
libatom_la_CFLAGS += $(XML_CFLAGS) $(GIO_CFLAGS)
libatom_la_LIBADD = $(GIO_LIBS) $(GLIB_LIBS) $(XML_LIBS)
AtomError *error;
gpointer config_data;
AtomBackend *backend;
+ AtomFrontend *frontend;
GHashTable *bemap;
};
ctx->error = NULL;
ctx->config_data = NULL;
ctx->backend = NULL;
+ ctx->frontend = NULL;
ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
return ctx;
atom_error_delete (ctx->error);
if (ctx->backend)
atom_backend_delete (ctx->backend);
+ if (ctx->frontend)
+ atom_frontend_delete (ctx->frontend);
if (ctx->bemap)
g_hash_table_destroy (ctx->bemap);
g_slice_free (AtomCtx, ctx);
ctx->backend = backend;
}
+AtomFrontend *
+atom_frontend (AtomCtx *ctx)
+{
+ return ctx->frontend;
+}
+
+void
+atom_frontend_set (AtomCtx *ctx, AtomFrontend *frontend)
+{
+ ctx->frontend = frontend;
+}
+
void
atom_map_backend_requests (AtomCtx *ctx, char **reqs,
AtomEntry **entries, size_t len)
--- /dev/null
+/*
+ * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include <atompub/atom.h>
+
+#include <glib.h>
+
+#include <string.h>
+
+struct _atom_frontend
+{
+ void (*map_entries) (AtomCtx *, char **, AtomEntry **, size_t);
+};
+
+AtomFrontend *
+atom_frontend_new ()
+{
+ AtomFrontend *frontend;
+ frontend = g_slice_new (AtomFrontend);
+ frontend->map_entries = NULL;
+ return frontend;
+}
+
+void
+atom_frontend_delete (AtomFrontend *frontend)
+{
+ g_slice_free (AtomFrontend, frontend);
+}
+
+void
+atom_frontend_map_entries_set (AtomFrontend *frontend,
+ void map_entries (AtomCtx *,
+ char **,
+ AtomEntry **,
+ size_t))
+{
+ frontend->map_entries = map_entries;
+}
+
+void
+atom_frontend_map_entries (AtomCtx *ctx, char ** reqs,
+ AtomEntry ** entries, size_t len)
+{
+ AtomFrontend *frontend;
+ frontend = atom_frontend (ctx);
+ if (frontend && frontend->map_entries)
+ {
+ frontend->map_entries (ctx, reqs, entries, len);
+ }
+}
pkginclude_HEADERS = atom.h config.h ctx.h entry.h person.h error.h feed.h \
id.h iri.h backend.h atom-glib.h error-glib.h atom-xml.h \
entry-xml.h person-xml.h feed-xml.h globals.h resource.h \
- map.h
+ map.h frontend.h
#include <atompub/resource.h>
#include <atompub/backend.h>
#include <atompub/map.h>
+#include <atompub/frontend.h>
#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#ifndef ATOMPUB_FRONTEND_H
+#define ATOMPUB_FRONTEND_H
+
+#include <atompub/ctx.h>
+
+typedef struct _atom_frontend AtomFrontend;
+
+AtomFrontend *atom_frontend_new (void);
+void atom_frontend_delete (AtomFrontend *);
+void atom_frontend_map_entries_set (AtomFrontend *,
+ void (AtomCtx *, char **,
+ AtomEntry **, size_t));
+void atom_map_entries (AtomCtx *, char **, AtomEntry **, size_t);
+AtomFrontend * atom_frontend (AtomCtx *);
+void atom_frontend_set (AtomCtx *, AtomFrontend *);
+
+#endif