[gnome-db] [PATCH] gda-value.c #2



This one adds a new function, gda_value_is_unsigned, a compliment to
gda_value_is_number.

Bob

-- 
Bob Ham <rah bash sh>
Index: gda-value.h
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-value.h,v
retrieving revision 1.41
diff -u -p -r1.41 gda-value.h
--- gda-value.h	21 Sep 2005 20:05:04 -0000	1.41
+++ gda-value.h	23 Nov 2005 19:03:50 -0000
@@ -186,6 +186,7 @@ void                              gda_va
 
 gboolean                          gda_value_is_null (GdaValue *value);
 gboolean                          gda_value_is_number (GdaValue *value);
+gboolean                          gda_value_is_unsigned (GdaValue *value);
 GdaValue                         *gda_value_copy (GdaValue *value);
 
 gint64                            gda_value_get_bigint (GdaValue *value);
Index: gda-value.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-value.c,v
retrieving revision 1.76
diff -u -p -r1.76 gda-value.c
--- gda-value.c	7 Oct 2005 13:15:12 -0000	1.76
+++ gda-value.c	23 Nov 2005 19:03:51 -0000
@@ -1286,6 +1286,35 @@ gda_value_is_number (GdaValue *value)
 }
 
 /**
+ * gda_value_is_unsigned
+ * @value: a #GdaValue.
+ *
+ * Gets whether the value stored in the given #GdaValue is an
+ * unsigned numeric type or not.
+ *
+ * Returns: %TRUE if an unsigned number, %FALSE otherwise.
+ */
+gboolean
+gda_value_is_unsigned (GdaValue *value)
+{
+	g_return_val_if_fail (value && G_IS_VALUE(value), FALSE);
+	GdaValueType type;
+	
+	type = GDA_VALUE_TYPE(value);
+	switch (type) {
+	case GDA_VALUE_TYPE_BIGUINT:
+	case GDA_VALUE_TYPE_UINTEGER:
+	case GDA_VALUE_TYPE_SMALLUINT:
+	case GDA_VALUE_TYPE_TINYUINT:
+		return TRUE;
+	    break;
+	
+	default:	
+		return FALSE;
+    }
+}
+
+/**
  * gda_value_copy
  * @value: value to get a copy from.
  *

Attachment: signature.asc
Description: This is a digitally signed message part



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