[libgda] Added gda_meta_context_copy()



commit 2f36cd16bd405f30dad46d0244a2b6400fa65ba5
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Mar 11 22:01:18 2013 +0100

    Added gda_meta_context_copy()

 doc/C/libgda-sections.txt |    1 +
 libgda/gda-meta-store.c   |   40 ++++++++++++++++++++++++++++------------
 libgda/gda-meta-store.h   |    2 ++
 libgda/libgda.symbols     |    1 +
 4 files changed, 32 insertions(+), 12 deletions(-)
---
diff --git a/doc/C/libgda-sections.txt b/doc/C/libgda-sections.txt
index 83d580f..1d6acbe 100644
--- a/doc/C/libgda-sections.txt
+++ b/doc/C/libgda-sections.txt
@@ -1468,6 +1468,7 @@ gda_meta_store_undeclare_foreign_key
 <SUBSECTION>
 gda_meta_context_get_type
 gda_meta_context_new
+gda_meta_context_copy
 gda_meta_context_set_table
 gda_meta_context_get_table
 gda_meta_context_set_column
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 181ecc6..56be4cb 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -65,15 +65,6 @@
 #include "gda-types.h"
 #include "gda-data-meta-wrapper.h"
 
-static GdaMetaContext* 
-gda_meta_context_copy (GdaMetaContext *ctx)
-{
-       GdaMetaContext *n = gda_meta_context_new ();
-       gda_meta_context_set_table (n, ctx->table_name);
-       gda_meta_context_set_columns (n, ctx->columns, NULL);
-       return n;
-}
-
 /*
    Register GdaMetaContext type
 */
@@ -130,6 +121,29 @@ gda_meta_context_new (void)
 }
 
 /**
+ * gda_meta_context_copy:
+ * @ctx: a #GdaMetaContext
+ *
+ * Copy constructor.
+ *
+ * Returns: a new #GdaMetaContext
+ *
+ * Since: 5.2
+ */
+GdaMetaContext *
+gda_meta_context_copy (GdaMetaContext *ctx)
+{
+       g_return_val_if_fail (ctx, NULL);
+
+       GdaMetaContext *n;
+       n = gda_meta_context_new ();
+       gda_meta_context_set_table (n, gda_meta_context_get_table (ctx));
+       gda_meta_context_set_columns (n, ctx->columns, NULL);
+
+       return n;
+}
+
+/**
  * gda_meta_context_set_table:
  * @ctx: a #GdaMetaContext struct to set table to
  * @table: a string with the table's name to use in context
@@ -246,16 +260,18 @@ gda_meta_context_set_columns (GdaMetaContext *ctx, GHashTable *columns, GdaConne
 
 /**
  * gda_meta_context_free:
- * @ctx: a #GdaMetaContext struct to free
+ * @ctx: (allow-none): a #GdaMetaContext struct to free
  * 
- * Frees any resources taken by @ctx struct.
+ * Frees any resources taken by @ctx struct. If @ctx is %NULL, then nothing happens.
  *
  * Since: 5.2
  */
 void
 gda_meta_context_free (GdaMetaContext *ctx)
 {
-       g_return_if_fail (ctx);
+       if (!ctx)
+               return;
+
        g_free (ctx->table_name);
        g_hash_table_unref (ctx->columns);
        g_free (ctx);
diff --git a/libgda/gda-meta-store.h b/libgda/gda-meta-store.h
index 3eda36d..d96ba36 100644
--- a/libgda/gda-meta-store.h
+++ b/libgda/gda-meta-store.h
@@ -209,6 +209,8 @@ gboolean          gda_meta_store_undeclare_foreign_key    (GdaMetaStore *store,
 
 GType             gda_meta_context_get_type               (void) G_GNUC_CONST;
 GdaMetaContext*   gda_meta_context_new                    (void);
+GdaMetaContext*   gda_meta_context_copy                   (GdaMetaContext *ctx);
+
 void              gda_meta_context_set_table              (GdaMetaContext *ctx, const gchar *table);
 const gchar*      gda_meta_context_get_table              (GdaMetaContext *ctx);
 void              gda_meta_context_set_column             (GdaMetaContext *ctx, const gchar* column, 
diff --git a/libgda/libgda.symbols b/libgda/libgda.symbols
index 5f7447a..47c686a 100644
--- a/libgda/libgda.symbols
+++ b/libgda/libgda.symbols
@@ -446,6 +446,7 @@
        gda_log_error
        gda_log_is_enabled
        gda_log_message
+       gda_meta_context_copy
        gda_meta_context_get_type
        gda_meta_context_new
        gda_meta_context_set_table


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]