1 /* iCalByDayMask.h - this file is part of SOPE
2  *
3  * Copyright (C) 2010 Wolfgang Sourdeau
4  *
5  * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
6  *
7  * This file is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This file is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 
23 #ifndef ICALBYDAYMASK_H
24 #define ICALBYDAYMASK_H
25 
26 #import <Foundation/NSObject.h>
27 
28 #import "iCalRecurrenceRule.h"
29 
30 typedef enum {
31   iCalWeekOccurrenceFirst      = 0x001, // order
32   iCalWeekOccurrenceSecond     = 0x002, // 2^(order - 1)
33   iCalWeekOccurrenceThird      = 0x004,
34   iCalWeekOccurrenceFourth     = 0x008,
35   iCalWeekOccurrenceFifth      = 0x010,
36   iCalWeekOccurrenceAll        = 0x3ff,
37   iCalWeekOccurrenceLast       = 0x020, // 2^(order - 1) >> 5
38   iCalWeekOccurrenceSecondLast = 0x040,
39   iCalWeekOccurrenceThirdLast  = 0x080,
40   iCalWeekOccurrenceFourthLast = 0x100,
41   iCalWeekOccurrenceFifthLast  = 0x200,
42 } iCalWeekOccurrence;
43 
44 typedef iCalWeekOccurrence iCalWeekOccurrences[7];
45 
46 // extern NSString *iCalWeekOccurrenceString[];
47 
48 @interface iCalByDayMask : NSObject
49 {
50   iCalWeekOccurrences days;
51 }
52 
53 + (id) byDayMaskWithDays: (iCalWeekOccurrences) theDays;
54 + (id) byDayMaskWithWeekDays;
55 - (id) initWithDays: (iCalWeekOccurrences) theDays;
56 + (id) byDayMaskWithRuleString: (NSString *) byDayRule;
57 - (id) initWithRuleString: (NSString *) byDayRule;
58 
59 - (BOOL) occursOnDay: (iCalWeekDay) weekDay;
60 - (BOOL) occursOnDay: (iCalWeekDay) weekDay
61   withWeekOccurrence: (iCalWeekOccurrence) occurrence;
62 - (BOOL) occursOnDay: (iCalWeekDay) weekDay
63       withWeekNumber: (int) week;
64 - (BOOL) isWeekDays;
65 
66 //- (iCalWeekOccurrences *) allDays;
67 - (iCalWeekDay) firstDay;
68 - (int) firstOccurrence;
69 
70 - (iCalWeekOccurrences *) weekDayOccurrences;
71 
72 - (NSString *) asRuleString;
73 - (NSString *) asRuleStringWithIntegers;
74 
75 @end
76 
77 #endif /* ICALBYDAYMASK_H */
78