]> git.saurik.com Git - apple/cf.git/blob - CFCalendar.h
CF-550.43.tar.gz
[apple/cf.git] / CFCalendar.h
1 /*
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /* CFCalendar.h
25 Copyright (c) 2004-2009, Apple Inc. All rights reserved.
26 */
27
28 #if !defined(__COREFOUNDATION_CFCALENDAR__)
29 #define __COREFOUNDATION_CFCALENDAR__ 1
30
31 #include <CoreFoundation/CFBase.h>
32 #include <CoreFoundation/CFLocale.h>
33 #include <CoreFoundation/CFDate.h>
34 #include <CoreFoundation/CFTimeZone.h>
35
36 #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
37
38 CF_EXTERN_C_BEGIN
39
40 typedef struct __CFCalendar * CFCalendarRef;
41
42 CF_EXPORT
43 CFTypeID CFCalendarGetTypeID(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
44
45 CF_EXPORT
46 CFCalendarRef CFCalendarCopyCurrent(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
47
48 CF_EXPORT
49 CFCalendarRef CFCalendarCreateWithIdentifier(CFAllocatorRef allocator, CFStringRef identifier) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
50 // Create a calendar. The identifiers are the kCF*Calendar
51 // constants in CFLocale.h.
52
53 CF_EXPORT
54 CFStringRef CFCalendarGetIdentifier(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
55 // Returns the calendar's identifier.
56
57 CF_EXPORT
58 CFLocaleRef CFCalendarCopyLocale(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
59
60 CF_EXPORT
61 void CFCalendarSetLocale(CFCalendarRef calendar, CFLocaleRef locale) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
62
63 CF_EXPORT
64 CFTimeZoneRef CFCalendarCopyTimeZone(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
65
66 CF_EXPORT
67 void CFCalendarSetTimeZone(CFCalendarRef calendar, CFTimeZoneRef tz) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
68
69 CF_EXPORT
70 CFIndex CFCalendarGetFirstWeekday(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
71
72 CF_EXPORT
73 void CFCalendarSetFirstWeekday(CFCalendarRef calendar, CFIndex wkdy) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
74
75 CF_EXPORT
76 CFIndex CFCalendarGetMinimumDaysInFirstWeek(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
77
78 CF_EXPORT
79 void CFCalendarSetMinimumDaysInFirstWeek(CFCalendarRef calendar, CFIndex mwd) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
80
81
82 enum {
83 kCFCalendarUnitEra = (1UL << 1),
84 kCFCalendarUnitYear = (1UL << 2),
85 kCFCalendarUnitMonth = (1UL << 3),
86 kCFCalendarUnitDay = (1UL << 4),
87 kCFCalendarUnitHour = (1UL << 5),
88 kCFCalendarUnitMinute = (1UL << 6),
89 kCFCalendarUnitSecond = (1UL << 7),
90 kCFCalendarUnitWeek = (1UL << 8),
91 kCFCalendarUnitWeekday = (1UL << 9),
92 kCFCalendarUnitWeekdayOrdinal = (1UL << 10),
93 #if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED
94 kCFCalendarUnitQuarter = (1UL << 11),
95 #endif
96 };
97 typedef CFOptionFlags CFCalendarUnit;
98
99 CF_EXPORT
100 CFRange CFCalendarGetMinimumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
101
102 CF_EXPORT
103 CFRange CFCalendarGetMaximumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
104
105 CF_EXPORT
106 CFRange CFCalendarGetRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
107
108 CF_EXPORT
109 CFIndex CFCalendarGetOrdinalityOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
110
111 CF_EXPORT
112 Boolean CFCalendarGetTimeRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit, CFAbsoluteTime at, CFAbsoluteTime *startp, CFTimeInterval *tip) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
113
114 CF_EXPORT
115 Boolean CFCalendarComposeAbsoluteTime(CFCalendarRef calendar, /* out */ CFAbsoluteTime *at, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
116
117 CF_EXPORT
118 Boolean CFCalendarDecomposeAbsoluteTime(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
119
120
121 enum {
122 kCFCalendarComponentsWrap = (1UL << 0) // option for adding
123 };
124
125 CF_EXPORT
126 Boolean CFCalendarAddComponents(CFCalendarRef calendar, /* inout */ CFAbsoluteTime *at, CFOptionFlags options, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
127
128 CF_EXPORT
129 Boolean CFCalendarGetComponentDifference(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
130
131
132 CF_EXTERN_C_END
133
134 #endif
135
136 #endif /* ! __COREFOUNDATION_CFCALENDAR__ */
137