From 10e4e8dc54f63f5516acffdf5e28b39d7a549843 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Wed, 31 May 2000 22:09:33 +0000 Subject: added test-recur test program. 2000-05-31 Damon Chaplin * cal-util/Makefile.am: added test-recur test program. * cal-util/test-recur.c: new file to test the recurrence code. * cal-util/.cvsignore: added test-recur. * cal-util/cal-recur.c: updated. svn path=/trunk/; revision=3315 --- calendar/cal-util/cal-recur.h | 62 +++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 23 deletions(-) (limited to 'calendar/cal-util/cal-recur.h') diff --git a/calendar/cal-util/cal-recur.h b/calendar/cal-util/cal-recur.h index 340b897417..6069ff5f75 100644 --- a/calendar/cal-util/cal-recur.h +++ b/calendar/cal-util/cal-recur.h @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef CAL_RECURL_H +#ifndef CAL_RECUR_H #define CAL_RECUR_H #include @@ -34,31 +34,49 @@ BEGIN_GNOME_DECLS the ones in calobj.h don't support all of iCalendar. Hopefully Seth will update those soon and these can be removed. */ -enum RecurType { - RECUR_YEARLY, - RECUR_MONTHLY, - RECUR_WEEKLY, - RECUR_DAILY, - RECUR_HOURLY, - RECUR_MINUTELY, - RECUR_SECONDLY, -}; +typedef enum { + CAL_RECUR_YEARLY, + CAL_RECUR_MONTHLY, + CAL_RECUR_WEEKLY, + CAL_RECUR_DAILY, + CAL_RECUR_HOURLY, + CAL_RECUR_MINUTELY, + CAL_RECUR_SECONDLY +} CalObjRecurType; typedef struct { - enum RecurType type; + CalObjRecurType type; int interval; - int weekday; + /* Specifies the end of the recurrence. No occurrences are generated + after this date. If it is 0, the event recurs forever. */ + time_t enddate; - int month_pos; + /* WKST property - the week start day: 0 = Monday to 6 = Sunday. */ + gint week_start_day; - int month_day; + /* NOTE: I've used GList's here, but it doesn't matter if we use + other data structures like arrays. The code should be easy to + change. So long as it is easy to see if the modifier is set. */ /* For BYMONTH modifier. A list of GINT_TO_POINTERs, 0-11. */ GList *bymonth; + /* For BYWEEKNO modifier. A list of GINT_TO_POINTERs, [+-]1-53. */ + GList *byweekno; + + /* For BYYEARDAY modifier. A list of GINT_TO_POINTERs, [+-]1-366. */ + GList *byyearday; + + /* For BYMONTHDAY modifier. A list of GINT_TO_POINTERs, [+-]1-31. */ + GList *bymonthday; + + /* For BYDAY modifier. A list of GINT_TO_POINTERs, in pairs. + The first of each pair is the weekday, 0 = Monday to 6 = Sunday. + The second of each pair is the week number [+-]0-53. */ + GList *byday; /* For BYHOUR modifier. A list of GINT_TO_POINTERs, 0-23. */ GList *byhour; @@ -69,7 +87,10 @@ typedef struct { /* For BYSECOND modifier. A list of GINT_TO_POINTERs, 0-60. */ GList *bysecond; -} Recurrence; + /* For BYSETPOS modifier. A list of GINT_TO_POINTERs, +ve or -ve. */ + GList *bysetpos; +} CalObjRecurrence; + @@ -86,17 +107,12 @@ struct _CalObjTime { -/* Returns an unsorted array of time_t's resulting from expanding the - recurrence within the given interval. Each iCalendar event can have any - number of recurrence rules specifying occurrences of the event, as well as - any number of recurrence rules specifying exceptions. */ -GArray* -cal_obj_expand_recurrence (CalObjTime *event_start, - CalObjTime *event_end, - Recurrence *recur, +GArray* cal_obj_expand_recurrence (CalObjTime *event_start, + CalObjRecurrence *recur, CalObjTime *interval_start, CalObjTime *interval_end); + END_GNOME_DECLS #endif -- cgit v1.2.3