diff options
Diffstat (limited to 'libical/src/libical/icalrecur.h')
-rw-r--r-- | libical/src/libical/icalrecur.h | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/libical/src/libical/icalrecur.h b/libical/src/libical/icalrecur.h index fe82ff960c..a4880d7de1 100644 --- a/libical/src/libical/icalrecur.h +++ b/libical/src/libical/icalrecur.h @@ -26,7 +26,6 @@ #include <time.h> #include "icaltime.h" - /*********************************************************************** * Recurrance enumerations **********************************************************************/ @@ -65,7 +64,9 @@ enum { }; const char* icalrecur_recurrence_to_string(icalrecurrencetype_frequency kind); +icalrecurrencetype_frequency icalrecur_string_to_recurrence(const char* str); const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind); +icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str); /********************** Recurrence type routines **************/ @@ -73,6 +74,15 @@ const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind); /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of the values and fields in struct icalrecurrencetype */ +#define ICAL_BY_SECOND_SIZE 61 +#define ICAL_BY_MINUTE_SIZE 61 +#define ICAL_BY_HOUR_SIZE 25 +#define ICAL_BY_DAY_SIZE 364 /* 7 days * 52 weeks */ +#define ICAL_BY_MONTHDAY_SIZE 32 +#define ICAL_BY_YEARDAY_SIZE 367 +#define ICAL_BY_WEEKNO_SIZE 54 +#define ICAL_BY_MONTH_SIZE 13 +#define ICAL_BY_SETPOS_SIZE 367 struct icalrecurrencetype { @@ -80,7 +90,7 @@ struct icalrecurrencetype /* until and count are mutually exclusive. */ - struct icaltimetype until; /* Hack. Must be time_t for general use */ + struct icaltimetype until; int count; short interval; @@ -93,24 +103,24 @@ struct icalrecurrencetype * value more than once. * Each of the lists is terminated with the value - * ICALRECURRENCE_ARRAY_MAX unless the the list is full. + * ICAL_RECURRENCE_ARRAY_MAX unless the the list is full. */ - short by_second[61]; - short by_minute[61]; - short by_hour[25]; - short by_day[8]; /* Encoded value, see below */ - short by_month_day[32]; - short by_year_day[367]; - short by_week_no[54]; - short by_month[13]; - short by_set_pos[367]; + short by_second[ICAL_BY_SECOND_SIZE]; + short by_minute[ICAL_BY_MINUTE_SIZE]; + short by_hour[ICAL_BY_HOUR_SIZE]; + short by_day[ICAL_BY_DAY_SIZE]; /* Encoded value, see below */ + short by_month_day[ICAL_BY_MONTHDAY_SIZE]; + short by_year_day[ ICAL_BY_YEARDAY_SIZE]; + short by_week_no[ICAL_BY_WEEKNO_SIZE]; + short by_month[ICAL_BY_MONTH_SIZE]; + short by_set_pos[ICAL_BY_SETPOS_SIZE]; }; void icalrecurrencetype_clear(struct icalrecurrencetype *r); -/* The 'day' element of icalrecurrencetype_weekday is encoded to allow +/* The 'day' element of the by_day array is encoded to allow representation of both the day of the week ( Monday, Tueday), but also the Nth day of the week ( First tuesday of the month, last thursday of the year) These routines decode the day values */ @@ -131,6 +141,13 @@ struct icaltimetype icalrecurrencetype_next_occurance( typedef void icalrecur_iterator; void icalrecurrencetype_test(); +/*********************************************************************** + * Recurrance rule parser +**********************************************************************/ + +struct icalrecurrencetype icalrecurrencetype_from_string(const char* str); +char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur); + /********** recurrence routines ********************/ @@ -142,5 +159,10 @@ int icalrecur_iterator_count(icalrecur_iterator*); void icalrecur_iterator_free(icalrecur_iterator*); +/* Fills array up with at most 'count' time_t values, each + representing an occurrence time in seconds past the POSIX epoch */ +int icalrecur_expand_recurrence(char* rule, time_t start, + int count, time_t* array); + #endif |