]> git.saurik.com Git - apple/cf.git/blame - CFCalendar.h
CF-635.15.tar.gz
[apple/cf.git] / CFCalendar.h
CommitLineData
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
36CF_EXTERN_C_BEGIN
37
38typedef struct __CFCalendar * CFCalendarRef;
39
40CF_EXPORT
8ca704e1 41CFTypeID CFCalendarGetTypeID(void);
bd5b749c
A
42
43CF_EXPORT
8ca704e1 44CFCalendarRef CFCalendarCopyCurrent(void);
bd5b749c
A
45
46CF_EXPORT
8ca704e1 47CFCalendarRef CFCalendarCreateWithIdentifier(CFAllocatorRef allocator, CFStringRef identifier);
bd5b749c
A
48 // Create a calendar. The identifiers are the kCF*Calendar
49 // constants in CFLocale.h.
50
51CF_EXPORT
8ca704e1 52CFStringRef CFCalendarGetIdentifier(CFCalendarRef calendar);
bd5b749c
A
53 // Returns the calendar's identifier.
54
55CF_EXPORT
8ca704e1 56CFLocaleRef CFCalendarCopyLocale(CFCalendarRef calendar);
bd5b749c
A
57
58CF_EXPORT
8ca704e1 59void CFCalendarSetLocale(CFCalendarRef calendar, CFLocaleRef locale);
bd5b749c
A
60
61CF_EXPORT
8ca704e1 62CFTimeZoneRef CFCalendarCopyTimeZone(CFCalendarRef calendar);
bd5b749c
A
63
64CF_EXPORT
8ca704e1 65void CFCalendarSetTimeZone(CFCalendarRef calendar, CFTimeZoneRef tz);
bd5b749c
A
66
67CF_EXPORT
8ca704e1 68CFIndex CFCalendarGetFirstWeekday(CFCalendarRef calendar);
bd5b749c
A
69
70CF_EXPORT
8ca704e1 71void CFCalendarSetFirstWeekday(CFCalendarRef calendar, CFIndex wkdy);
bd5b749c
A
72
73CF_EXPORT
8ca704e1 74CFIndex CFCalendarGetMinimumDaysInFirstWeek(CFCalendarRef calendar);
bd5b749c
A
75
76CF_EXPORT
8ca704e1 77void CFCalendarSetMinimumDaysInFirstWeek(CFCalendarRef calendar, CFIndex mwd);
bd5b749c
A
78
79
80enum {
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};
100typedef CFOptionFlags CFCalendarUnit;
101
102CF_EXPORT
8ca704e1 103CFRange CFCalendarGetMinimumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit);
bd5b749c
A
104
105CF_EXPORT
8ca704e1 106CFRange CFCalendarGetMaximumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit);
bd5b749c
A
107
108CF_EXPORT
8ca704e1 109CFRange CFCalendarGetRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at);
bd5b749c
A
110
111CF_EXPORT
8ca704e1 112CFIndex CFCalendarGetOrdinalityOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at);
bd5b749c
A
113
114CF_EXPORT
8ca704e1 115Boolean CFCalendarGetTimeRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit, CFAbsoluteTime at, CFAbsoluteTime *startp, CFTimeInterval *tip) CF_AVAILABLE(10_5, 2_0);
bd5b749c
A
116
117CF_EXPORT
8ca704e1 118Boolean CFCalendarComposeAbsoluteTime(CFCalendarRef calendar, /* out */ CFAbsoluteTime *at, const char *componentDesc, ...);
bd5b749c
A
119
120CF_EXPORT
8ca704e1 121Boolean CFCalendarDecomposeAbsoluteTime(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, ...);
bd5b749c
A
122
123
124enum {
cf7d2af9 125 kCFCalendarComponentsWrap = (1UL << 0) // option for adding
bd5b749c
A
126};
127
128CF_EXPORT
8ca704e1 129Boolean CFCalendarAddComponents(CFCalendarRef calendar, /* inout */ CFAbsoluteTime *at, CFOptionFlags options, const char *componentDesc, ...);
bd5b749c
A
130
131CF_EXPORT
8ca704e1 132Boolean CFCalendarGetComponentDifference(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, ...);
bd5b749c
A
133
134
135CF_EXTERN_C_END
136
bd5b749c
A
137#endif /* ! __COREFOUNDATION_CFCALENDAR__ */
138