goffice r2345 - in trunk: . goffice/utils



Author: mortenw
Date: Wed Mar 25 19:30:36 2009
New Revision: 2345
URL: http://svn.gnome.org/viewvc/goffice?rev=2345&view=rev

Log:
2009-03-25  Morten Welinder  <terra gnome org>

	* goffice/utils/go-format.c (go_format_is_time): New function.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/goffice/utils/go-format.c
   trunk/goffice/utils/go-format.h

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Wed Mar 25 19:30:36 2009
@@ -1,5 +1,8 @@
 goffice 0.7.5:
 
+Morten:
+	* Add new go_format_is_time function.
+
 --------------------------------------------------------------------------
 goffice 0.7.4:
 

Modified: trunk/goffice/utils/go-format.c
==============================================================================
--- trunk/goffice/utils/go-format.c	(original)
+++ trunk/goffice/utils/go-format.c	Wed Mar 25 19:30:36 2009
@@ -292,6 +292,7 @@
 			unsigned int date_dbm    : 1;  /* day, then month.  */
 			unsigned int has_time    : 1;
 			unsigned int has_hour    : 1;
+			unsigned int has_elapsed : 1;
 			unsigned int fraction    : 1;
 			unsigned int scale_is_2  : 1;
 			unsigned int has_general : 1;
@@ -1460,6 +1461,7 @@
 			*p++ = op;
 			fmt->u.number.has_time = TRUE;
 			fmt->u.number.has_hour = seen_hour;
+			fmt->u.number.has_elapsed = seen_elapsed;
 		}
 		if (pstate->has_general) {
 			ADD_OP (OP_NUM_GENERAL_DO);
@@ -4370,6 +4372,27 @@
 
 #ifdef DEFINE_COMMON
 /**
+ * go_format_is_time:
+ * @fmt: Format to query
+ *
+ * Returns:
+ *   +2 if the format is a time format with elapsed hour/minute/second
+ *   +1 if the format is any other time format
+ *    0 if the format is not a time format
+ *   -1	if the format is inconsistent.
+ **/
+int
+go_format_is_time (GOFormat const *fmt)
+{
+	g_return_val_if_fail (fmt != NULL, -1);
+	if (go_format_get_family (fmt) != GO_FORMAT_TIME)
+		return 0;
+	return fmt->u.number.has_elapsed ? +2 : +1;
+}
+#endif
+
+#ifdef DEFINE_COMMON
+/**
  * go_format_month_before_day:
  * @fmt: Format to query
  *

Modified: trunk/goffice/utils/go-format.h
==============================================================================
--- trunk/goffice/utils/go-format.h	(original)
+++ trunk/goffice/utils/go-format.h	Wed Mar 25 19:30:36 2009
@@ -118,6 +118,7 @@
 gboolean  go_format_is_text             (GOFormat const *fmt);
 gboolean  go_format_is_var_width        (GOFormat const *fmt);
 int       go_format_is_date             (GOFormat const *fmt);
+int       go_format_is_time             (GOFormat const *fmt);
 
 int       go_format_month_before_day    (GOFormat const *fmt);
 gboolean  go_format_has_hour            (GOFormat const *fmt);



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