]>
Commit | Line | Data |
---|---|---|
bd5b749c | 1 | /* |
8ca704e1 | 2 | * Copyright (c) 2011 Apple Inc. All rights reserved. |
bd5b749c A |
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 | */ | |
f64f9b69 | 23 | |
bd5b749c | 24 | /* CFCalendar.h |
8ca704e1 | 25 | Copyright (c) 2004-2011, Apple Inc. All rights reserved. |
bd5b749c A |
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 | ||
bd5b749c A |
36 | CF_EXTERN_C_BEGIN |
37 | ||
38 | typedef struct __CFCalendar * CFCalendarRef; | |
39 | ||
40 | CF_EXPORT | |
8ca704e1 | 41 | CFTypeID CFCalendarGetTypeID(void); |
bd5b749c A |
42 | |
43 | CF_EXPORT | |
8ca704e1 | 44 | CFCalendarRef CFCalendarCopyCurrent(void); |
bd5b749c A |
45 | |
46 | CF_EXPORT | |
8ca704e1 | 47 | CFCalendarRef CFCalendarCreateWithIdentifier(CFAllocatorRef allocator, CFStringRef identifier); |
bd5b749c A |
48 | // Create a calendar. The identifiers are the kCF*Calendar |
49 | // constants in CFLocale.h. | |
50 | ||
51 | CF_EXPORT | |
8ca704e1 | 52 | CFStringRef CFCalendarGetIdentifier(CFCalendarRef calendar); |
bd5b749c A |
53 | // Returns the calendar's identifier. |
54 | ||
55 | CF_EXPORT | |
8ca704e1 | 56 | CFLocaleRef CFCalendarCopyLocale(CFCalendarRef calendar); |
bd5b749c A |
57 | |
58 | CF_EXPORT | |
8ca704e1 | 59 | void CFCalendarSetLocale(CFCalendarRef calendar, CFLocaleRef locale); |
bd5b749c A |
60 | |
61 | CF_EXPORT | |
8ca704e1 | 62 | CFTimeZoneRef CFCalendarCopyTimeZone(CFCalendarRef calendar); |
bd5b749c A |
63 | |
64 | CF_EXPORT | |
8ca704e1 | 65 | void CFCalendarSetTimeZone(CFCalendarRef calendar, CFTimeZoneRef tz); |
bd5b749c A |
66 | |
67 | CF_EXPORT | |
8ca704e1 | 68 | CFIndex CFCalendarGetFirstWeekday(CFCalendarRef calendar); |
bd5b749c A |
69 | |
70 | CF_EXPORT | |
8ca704e1 | 71 | void CFCalendarSetFirstWeekday(CFCalendarRef calendar, CFIndex wkdy); |
bd5b749c A |
72 | |
73 | CF_EXPORT | |
8ca704e1 | 74 | CFIndex CFCalendarGetMinimumDaysInFirstWeek(CFCalendarRef calendar); |
bd5b749c A |
75 | |
76 | CF_EXPORT | |
8ca704e1 | 77 | void CFCalendarSetMinimumDaysInFirstWeek(CFCalendarRef calendar, CFIndex mwd); |
bd5b749c A |
78 | |
79 | ||
80 | enum { | |
cf7d2af9 A |
81 | kCFCalendarUnitEra = (1UL << 1), |
82 | kCFCalendarUnitYear = (1UL << 2), | |
83 | kCFCalendarUnitMonth = (1UL << 3), | |
84 | kCFCalendarUnitDay = (1UL << 4), | |
85 | kCFCalendarUnitHour = (1UL << 5), | |
86 | kCFCalendarUnitMinute = (1UL << 6), | |
87 | kCFCalendarUnitSecond = (1UL << 7), | |
8ca704e1 | 88 | kCFCalendarUnitWeek = (1UL << 8) /* CF_DEPRECATED(10_4, 10_7, 2_0, 5_0) */, |
cf7d2af9 A |
89 | kCFCalendarUnitWeekday = (1UL << 9), |
90 | kCFCalendarUnitWeekdayOrdinal = (1UL << 10), | |
8ca704e1 | 91 | #if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED |
cf7d2af9 A |
92 | kCFCalendarUnitQuarter = (1UL << 11), |
93 | #endif | |
8ca704e1 A |
94 | #if MAC_OS_X_VERSION_10_7 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_5_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED |
95 | kCFCalendarUnitWeekOfMonth = (1UL << 12), | |
96 | kCFCalendarUnitWeekOfYear = (1UL << 13), | |
97 | kCFCalendarUnitYearForWeekOfYear = (1UL << 14), | |
98 | #endif | |
bd5b749c A |
99 | }; |
100 | typedef CFOptionFlags CFCalendarUnit; | |
101 | ||
102 | CF_EXPORT | |
8ca704e1 | 103 | CFRange CFCalendarGetMinimumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit); |
bd5b749c A |
104 | |
105 | CF_EXPORT | |
8ca704e1 | 106 | CFRange CFCalendarGetMaximumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit); |
bd5b749c A |
107 | |
108 | CF_EXPORT | |
8ca704e1 | 109 | CFRange CFCalendarGetRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at); |
bd5b749c A |
110 | |
111 | CF_EXPORT | |
8ca704e1 | 112 | CFIndex CFCalendarGetOrdinalityOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at); |
bd5b749c A |
113 | |
114 | CF_EXPORT | |
8ca704e1 | 115 | Boolean CFCalendarGetTimeRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit, CFAbsoluteTime at, CFAbsoluteTime *startp, CFTimeInterval *tip) CF_AVAILABLE(10_5, 2_0); |
bd5b749c A |
116 | |
117 | CF_EXPORT | |
8ca704e1 | 118 | Boolean CFCalendarComposeAbsoluteTime(CFCalendarRef calendar, /* out */ CFAbsoluteTime *at, const char *componentDesc, ...); |
bd5b749c A |
119 | |
120 | CF_EXPORT | |
8ca704e1 | 121 | Boolean CFCalendarDecomposeAbsoluteTime(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, ...); |
bd5b749c A |
122 | |
123 | ||
124 | enum { | |
cf7d2af9 | 125 | kCFCalendarComponentsWrap = (1UL << 0) // option for adding |
bd5b749c A |
126 | }; |
127 | ||
128 | CF_EXPORT | |
8ca704e1 | 129 | Boolean CFCalendarAddComponents(CFCalendarRef calendar, /* inout */ CFAbsoluteTime *at, CFOptionFlags options, const char *componentDesc, ...); |
bd5b749c A |
130 | |
131 | CF_EXPORT | |
8ca704e1 | 132 | Boolean CFCalendarGetComponentDifference(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, ...); |
bd5b749c A |
133 | |
134 | ||
135 | CF_EXTERN_C_END | |
136 | ||
bd5b749c A |
137 | #endif /* ! __COREFOUNDATION_CFCALENDAR__ */ |
138 |