+++ /dev/null
-/*
- * Copyright (C) 2007 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>
-
-struct _atom_ctx
-{
- AtomError *error;
- gpointer config_data;
- AtomBackend *backend;
- GHashTable *bemap;
-};
-
-AtomCtx *
-atom_ctx_new ()
-{
- AtomCtx *ctx;
- ctx = g_slice_new (AtomCtx);
- ctx->error = NULL;
- ctx->config_data = NULL;
- ctx->backend = NULL;
- ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_free);
- return ctx;
-}
-
-void
-atom_ctx_delete (AtomCtx *ctx)
-{
- if (ctx->error)
- atom_error_delete (ctx->error);
- if (ctx->backend)
- atom_backend_delete (ctx->backend);
- if (ctx->bemap)
- g_hash_table_destroy (ctx->bemap);
- g_slice_free (AtomCtx, ctx);
-}
-
-void
-atom_error_set (AtomCtx *ctx, AtomError *error)
-{
- if (ctx->error)
- atom_error_delete (ctx->error);
- ctx->error = error;
-}
-
-AtomError *
-atom_error_get (AtomCtx *ctx)
-{
- return ctx->error;
-}
-
-void *
-atom_config_data (AtomCtx *ctx)
-{
- return ctx->config_data;
-}
-
-void
-atom_config_data_set (AtomCtx *ctx, void *data)
-{
- ctx->config_data = data;
-}
-
-AtomBackend *
-atom_backend (AtomCtx *ctx)
-{
- return ctx->backend;
-}
-
-void
-atom_backend_set (AtomCtx *ctx, AtomBackend *backend)
-{
- ctx->backend = backend;
-}
-
-void
-atom_map_backend_requests (AtomCtx *ctx, char **reqs,
- AtomEntry **entries, size_t len)
-{
- int i;
- for (i = 0; i < len; i++)
- {
- char *key = g_strdup (atom_entry_id (entries[i]));
- char *val = g_strdup (reqs[i]);
- g_hash_table_replace (ctx->bemap, key, val);
- }
-}