[libgda] Fixing documentation, apply coding style from maintainer and add missing symbols in libgda.symbols



commit dda8de22e9f0b2e173694c34a154041a4c92acd3
Author: Daniel Espinosa <despinosa src gnome org>
Date:   Fri Nov 11 11:31:21 2011 -0600

    Fixing documentation, apply coding style from maintainer and add missing symbols in libgda.symbols

 doc/C/libgda-sections.txt |   10 ++++++
 libgda/gda-value.c        |   68 +++++++++++++++++++++++++++++----------------
 libgda/gda-value.h        |    5 ++-
 libgda/libgda.symbols     |    9 ++++++
 4 files changed, 67 insertions(+), 25 deletions(-)
---
diff --git a/doc/C/libgda-sections.txt b/doc/C/libgda-sections.txt
index 7f6c5f9..eaafa91 100644
--- a/doc/C/libgda-sections.txt
+++ b/doc/C/libgda-sections.txt
@@ -901,8 +901,18 @@ gda_value_get_geometric_point
 gda_value_set_geometric_point
 <SUBSECTION>
 GdaNumeric
+gda_numeric_new
+gda_numeric_copy
 gda_numeric_copy
 gda_numeric_free
+gda_numeric_get_string
+gda_numeric_get_double
+gda_numeric_get_precision
+gda_numeric_get_width
+gda_numeric_set_double
+gda_numeric_set_from_string
+gda_numeric_set_precision
+gda_numeric_set_width
 gda_value_get_numeric
 gda_value_set_numeric
 <SUBSECTION>
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index 7b345d2..c70d0bd 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -864,12 +864,16 @@ gda_numeric_free (gpointer boxed)
 /**
  * gda_numeric_new:
  *
+ * Creates a new #GdaNumeric with defaults.
+ *
+ * Returns: (transfer full): a new #GdaNumeric.
+ * Since: 5.0.2
  */
 GdaNumeric*
-gda_numeric_new() 
+gda_numeric_new (void)
 {
-	GdaNumeric *n = g_new0(GdaNumeric, 1);
-	n->number = g_strdup_printf("0.0");
+	GdaNumeric *n = g_new0 (GdaNumeric, 1);
+	n->number = g_strdup_printf ("0.0");
 	return n;
 }
 
@@ -878,16 +882,18 @@ gda_numeric_new()
  * @numeric: a #GdaNumeric
  * @number: a string representing a number
  *
+ * Sets @numeric with a number represented by @str.
  *
+ * * Since: 5.0.2
  */
 void
 gda_numeric_set_from_string (GdaNumeric *numeric, const gchar* str)
 {
-	g_return_if_fail(numeric);
-	g_return_if_fail(str);
-	if(numeric->number)
-		g_free(numeric->number);
-	numeric->number = g_strdup(str); // FIXME: May a pre-verification is required in order to check string validity
+	g_return_if_fail (numeric);
+	g_return_if_fail (str);
+	if (numeric->number)
+		g_free (numeric->number);
+	numeric->number = g_strdup (str); // FIXME: May a pre-verification is required in order to check string validity
 }
 
 
@@ -896,16 +902,18 @@ gda_numeric_set_from_string (GdaNumeric *numeric, const gchar* str)
  * @numeric: a #GdaNumeric
  * @number: a #gdouble
  *
+ * Sets @numeric using a #gdouble represented by @number.
  *
+ * Since: 5.0.2
  */
 void
 gda_numeric_set_double (GdaNumeric *numeric, gdouble number)
 {
-	g_return_if_fail(numeric);
-	g_return_if_fail(number);
-	if(numeric->number)
-		g_free(numeric->number);
-	numeric->number = g_strdup_printf("%lf", number);
+	g_return_if_fail (numeric);
+	g_return_if_fail (number);
+	if (numeric->number)
+		g_free (numeric->number);
+	numeric->number = g_strdup_printf ("%lf", number);
 }
 
 /**
@@ -913,13 +921,14 @@ gda_numeric_set_double (GdaNumeric *numeric, gdouble number)
  * @numeric: a #GdaNumeric
  *
  * Returns: a #gdouble representation of @numeric
+ * Since: 5.0.2
  */
 gdouble
 gda_numeric_get_double (GdaNumeric *numeric)
 {
-	g_return_val_if_fail(numeric, 0.0);
-	if(numeric->number)
-		return atof(numeric->number);
+	g_return_val_if_fail (numeric, 0.0);
+	if (numeric->number)
+		return atof (numeric->number);
 	else
 		return 0.0;
 }
@@ -929,12 +938,14 @@ gda_numeric_get_double (GdaNumeric *numeric)
  * @numeric: a #GdaNumeric
  * @number: a #glong
  *
+ * Sets the width of a #GdaNumeric. (Not yet implemented).
  *
+ * Since: 5.0.2
  */
 void
 gda_numeric_set_width (GdaNumeric *numeric, glong width)
 {
-	g_return_if_fail(numeric);
+	g_return_if_fail (numeric);
 	numeric->width = width;
 }
 
@@ -942,12 +953,15 @@ gda_numeric_set_width (GdaNumeric *numeric, glong width)
  * gda_numeric_get_width:
  * @numeric: a #GdaNumeric
  *
- * Returns: a #gdouble representation of @numeric
+ * Gets the width of a #GdaNumeric. (Not yet implemented).
+ *
+ * Returns: an integer with the width of a #GdaNumeric. (Not jet implemented).
+ * Since: 5.0.2
  */
 glong
 gda_numeric_get_width (GdaNumeric *numeric)
 {
-	g_return_val_if_fail(numeric, 0.0);
+	g_return_val_if_fail (numeric, 0.0);
 	return numeric->width;
 }
 
@@ -956,12 +970,14 @@ gda_numeric_get_width (GdaNumeric *numeric)
  * @numeric: a #GdaNumeric
  * @number: a #glong
  *
+ * Sets the precision of a #GdaNumeric.
  *
+ * Since: 5.0.2
  */
 void
 gda_numeric_set_precision (GdaNumeric *numeric, glong precision)
 {
-	g_return_if_fail(numeric);
+	g_return_if_fail (numeric);
 	numeric->precision = precision;
 }
 
@@ -969,12 +985,15 @@ gda_numeric_set_precision (GdaNumeric *numeric, glong precision)
  * gda_numeric_get_precision:
  * @numeric: a #GdaNumeric
  *
- * Returns: a #gdouble representation of @numeric
+ * Gets the precision of a #GdaNumeric.
+ *
+ * Returns: an integer with the precision of a #GdaNumeric.
+ * Since: 5.0.2
  */
 glong
 gda_numeric_get_precision (GdaNumeric *numeric)
 {
-	g_return_val_if_fail(numeric, -1);
+	g_return_val_if_fail (numeric, -1);
 	return numeric->precision;
 }
 /**
@@ -984,12 +1003,13 @@ gda_numeric_get_precision (GdaNumeric *numeric)
  * Get the string representation of @numeric.
  *
  * Returns: (transfer full) (allow-none): a new string representing the stored valued in @numeric
+ * Since: 5.0.2
  */
 gchar*
 gda_numeric_get_string (GdaNumeric *numeric)
 {
-	g_return_val_if_fail(numeric, NULL);
-	return g_strdup(numeric->number);
+	g_return_val_if_fail (numeric, NULL);
+	return g_strdup (numeric->number);
 }
 
 /*
diff --git a/libgda/gda-value.h b/libgda/gda-value.h
index cf78bd9..98fb8b9 100644
--- a/libgda/gda-value.h
+++ b/libgda/gda-value.h
@@ -82,6 +82,9 @@ typedef struct {
  *
  * Holds numbers represented as strings.
  *
+ * This struct must be considered as opaque. Any access to its members must use its
+ * accessors added since version 5.0.2.
+ *
  * Set value func: gda_value_set_numeric
  * Get value func: gda_value_get_numeric
  */
@@ -260,7 +263,7 @@ GdaBlob                          *gda_string_to_blob (const gchar *str);
 GType                             gda_null_get_type (void) G_GNUC_CONST;
 GType                             gda_default_get_type (void) G_GNUC_CONST;
 GType                             gda_numeric_get_type (void) G_GNUC_CONST;
-GdaNumeric*                       gda_numeric_new();
+GdaNumeric*                       gda_numeric_new (void);
 gpointer                          gda_numeric_copy (gpointer boxed);
 void                              gda_numeric_set_from_string (GdaNumeric *numeric, const gchar* str);
 void                              gda_numeric_set_double (GdaNumeric *numeric, gdouble number);
diff --git a/libgda/libgda.symbols b/libgda/libgda.symbols
index 5094075..5568c18 100644
--- a/libgda/libgda.symbols
+++ b/libgda/libgda.symbols
@@ -492,8 +492,17 @@
 	gda_null_get_type
 	gda_numeric_copy
 	gda_numeric_free
+	gda_numeric_get_double
+	gda_numeric_get_precision
 	gda_numeric_get_type
+	gda_numeric_get_string
+	gda_numeric_get_width
 	gda_numeric_locale
+	gda_numeric_new
+	gda_numeric_set_double
+	gda_numeric_set_from_string
+	gda_numeric_set_precision
+	gda_numeric_set_width
 	gda_paramlist_dtd
 	gda_parse_iso8601_date
 	gda_parse_iso8601_time



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