2 * Copyright (c) 2008 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 Copyright (c) 2004-2007, Apple Inc. All rights reserved.
27 #if !defined(__COREFOUNDATION_CFCALENDAR__)
28 #define __COREFOUNDATION_CFCALENDAR__ 1
30 #include <CoreFoundation/CFBase.h>
31 #include <CoreFoundation/CFLocale.h>
32 #include <CoreFoundation/CFDate.h>
33 #include <CoreFoundation/CFTimeZone.h>
35 #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
39 typedef struct __CFCalendar
* CFCalendarRef
;
42 CFTypeID
CFCalendarGetTypeID(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
45 CFCalendarRef
CFCalendarCopyCurrent(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
48 CFCalendarRef
CFCalendarCreateWithIdentifier(CFAllocatorRef allocator
, CFStringRef identifier
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
49 // Create a calendar. The identifiers are the kCF*Calendar
50 // constants in CFLocale.h.
53 CFStringRef
CFCalendarGetIdentifier(CFCalendarRef calendar
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
54 // Returns the calendar's identifier.
57 CFLocaleRef
CFCalendarCopyLocale(CFCalendarRef calendar
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
60 void CFCalendarSetLocale(CFCalendarRef calendar
, CFLocaleRef locale
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
63 CFTimeZoneRef
CFCalendarCopyTimeZone(CFCalendarRef calendar
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
66 void CFCalendarSetTimeZone(CFCalendarRef calendar
, CFTimeZoneRef tz
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
69 CFIndex
CFCalendarGetFirstWeekday(CFCalendarRef calendar
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
72 void CFCalendarSetFirstWeekday(CFCalendarRef calendar
, CFIndex wkdy
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
75 CFIndex
CFCalendarGetMinimumDaysInFirstWeek(CFCalendarRef calendar
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
78 void CFCalendarSetMinimumDaysInFirstWeek(CFCalendarRef calendar
, CFIndex mwd
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
82 kCFCalendarUnitEra
= (1 << 1),
83 kCFCalendarUnitYear
= (1 << 2),
84 kCFCalendarUnitMonth
= (1 << 3),
85 kCFCalendarUnitDay
= (1 << 4),
86 kCFCalendarUnitHour
= (1 << 5),
87 kCFCalendarUnitMinute
= (1 << 6),
88 kCFCalendarUnitSecond
= (1 << 7),
89 kCFCalendarUnitWeek
= (1 << 8),
90 kCFCalendarUnitWeekday
= (1 << 9),
91 kCFCalendarUnitWeekdayOrdinal
= (1 << 10)
93 typedef CFOptionFlags CFCalendarUnit
;
96 CFRange
CFCalendarGetMinimumRangeOfUnit(CFCalendarRef calendar
, CFCalendarUnit unit
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
99 CFRange
CFCalendarGetMaximumRangeOfUnit(CFCalendarRef calendar
, CFCalendarUnit unit
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
102 CFRange
CFCalendarGetRangeOfUnit(CFCalendarRef calendar
, CFCalendarUnit smallerUnit
, CFCalendarUnit biggerUnit
, CFAbsoluteTime at
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
105 CFIndex
CFCalendarGetOrdinalityOfUnit(CFCalendarRef calendar
, CFCalendarUnit smallerUnit
, CFCalendarUnit biggerUnit
, CFAbsoluteTime at
) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
108 Boolean
CFCalendarGetTimeRangeOfUnit(CFCalendarRef calendar
, CFCalendarUnit unit
, CFAbsoluteTime at
, CFAbsoluteTime
*startp
, CFTimeInterval
*tip
) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
;
111 Boolean
CFCalendarComposeAbsoluteTime(CFCalendarRef calendar
, /* out */ CFAbsoluteTime
*at
, const char *componentDesc
, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
114 Boolean
CFCalendarDecomposeAbsoluteTime(CFCalendarRef calendar
, CFAbsoluteTime at
, const char *componentDesc
, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
118 kCFCalendarComponentsWrap
= (1 << 0) // option for adding
122 Boolean
CFCalendarAddComponents(CFCalendarRef calendar
, /* inout */ CFAbsoluteTime
*at
, CFOptionFlags options
, const char *componentDesc
, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
125 Boolean
CFCalendarGetComponentDifference(CFCalendarRef calendar
, CFAbsoluteTime startingAT
, CFAbsoluteTime resultAT
, CFOptionFlags options
, const char *componentDesc
, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
;
132 #endif /* ! __COREFOUNDATION_CFCALENDAR__ */