CFCalendar.pas 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. { CFCalendar.h
  2. Copyright (c) 2004-2013, Apple Inc. All rights reserved.
  3. }
  4. {
  5. Modified for use with Free Pascal
  6. Version 308
  7. Please report any bugs to <[email protected]>
  8. }
  9. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  10. {$mode macpas}
  11. {$modeswitch cblocks}
  12. {$packenum 1}
  13. {$macro on}
  14. {$inline on}
  15. {$calling mwpascal}
  16. unit CFCalendar;
  17. interface
  18. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  19. {$setc GAP_INTERFACES_VERSION := $0308}
  20. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  21. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  22. {$endc}
  23. {$ifc defined CPUPOWERPC and defined CPUI386}
  24. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  25. {$endc}
  26. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  27. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  28. {$endc}
  29. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  30. {$setc __ppc__ := 1}
  31. {$elsec}
  32. {$setc __ppc__ := 0}
  33. {$endc}
  34. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  35. {$setc __ppc64__ := 1}
  36. {$elsec}
  37. {$setc __ppc64__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc not defined __x86_64__ and defined CPUX86_64}
  45. {$setc __x86_64__ := 1}
  46. {$elsec}
  47. {$setc __x86_64__ := 0}
  48. {$endc}
  49. {$ifc not defined __arm__ and defined CPUARM}
  50. {$setc __arm__ := 1}
  51. {$elsec}
  52. {$setc __arm__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm64__ and defined CPUAARCH64}
  55. {$setc __arm64__ := 1}
  56. {$elsec}
  57. {$setc __arm64__ := 0}
  58. {$endc}
  59. {$ifc defined cpu64}
  60. {$setc __LP64__ := 1}
  61. {$elsec}
  62. {$setc __LP64__ := 0}
  63. {$endc}
  64. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  65. {$error Conflicting definitions for __ppc__ and __i386__}
  66. {$endc}
  67. {$ifc defined __ppc__ and __ppc__}
  68. {$setc TARGET_CPU_PPC := TRUE}
  69. {$setc TARGET_CPU_PPC64 := FALSE}
  70. {$setc TARGET_CPU_X86 := FALSE}
  71. {$setc TARGET_CPU_X86_64 := FALSE}
  72. {$setc TARGET_CPU_ARM := FALSE}
  73. {$setc TARGET_CPU_ARM64 := FALSE}
  74. {$setc TARGET_OS_MAC := TRUE}
  75. {$setc TARGET_OS_IPHONE := FALSE}
  76. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  77. {$setc TARGET_OS_EMBEDDED := FALSE}
  78. {$elifc defined __ppc64__ and __ppc64__}
  79. {$setc TARGET_CPU_PPC := FALSE}
  80. {$setc TARGET_CPU_PPC64 := TRUE}
  81. {$setc TARGET_CPU_X86 := FALSE}
  82. {$setc TARGET_CPU_X86_64 := FALSE}
  83. {$setc TARGET_CPU_ARM := FALSE}
  84. {$setc TARGET_CPU_ARM64 := FALSE}
  85. {$setc TARGET_OS_MAC := TRUE}
  86. {$setc TARGET_OS_IPHONE := FALSE}
  87. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  88. {$setc TARGET_OS_EMBEDDED := FALSE}
  89. {$elifc defined __i386__ and __i386__}
  90. {$setc TARGET_CPU_PPC := FALSE}
  91. {$setc TARGET_CPU_PPC64 := FALSE}
  92. {$setc TARGET_CPU_X86 := TRUE}
  93. {$setc TARGET_CPU_X86_64 := FALSE}
  94. {$setc TARGET_CPU_ARM := FALSE}
  95. {$setc TARGET_CPU_ARM64 := FALSE}
  96. {$ifc defined iphonesim}
  97. {$setc TARGET_OS_MAC := FALSE}
  98. {$setc TARGET_OS_IPHONE := TRUE}
  99. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  100. {$elsec}
  101. {$setc TARGET_OS_MAC := TRUE}
  102. {$setc TARGET_OS_IPHONE := FALSE}
  103. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  104. {$endc}
  105. {$setc TARGET_OS_EMBEDDED := FALSE}
  106. {$elifc defined __x86_64__ and __x86_64__}
  107. {$setc TARGET_CPU_PPC := FALSE}
  108. {$setc TARGET_CPU_PPC64 := FALSE}
  109. {$setc TARGET_CPU_X86 := FALSE}
  110. {$setc TARGET_CPU_X86_64 := TRUE}
  111. {$setc TARGET_CPU_ARM := FALSE}
  112. {$setc TARGET_CPU_ARM64 := FALSE}
  113. {$ifc defined iphonesim}
  114. {$setc TARGET_OS_MAC := FALSE}
  115. {$setc TARGET_OS_IPHONE := TRUE}
  116. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  117. {$elsec}
  118. {$setc TARGET_OS_MAC := TRUE}
  119. {$setc TARGET_OS_IPHONE := FALSE}
  120. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  121. {$endc}
  122. {$setc TARGET_OS_EMBEDDED := FALSE}
  123. {$elifc defined __arm__ and __arm__}
  124. {$setc TARGET_CPU_PPC := FALSE}
  125. {$setc TARGET_CPU_PPC64 := FALSE}
  126. {$setc TARGET_CPU_X86 := FALSE}
  127. {$setc TARGET_CPU_X86_64 := FALSE}
  128. {$setc TARGET_CPU_ARM := TRUE}
  129. {$setc TARGET_CPU_ARM64 := FALSE}
  130. {$setc TARGET_OS_MAC := FALSE}
  131. {$setc TARGET_OS_IPHONE := TRUE}
  132. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  133. {$setc TARGET_OS_EMBEDDED := TRUE}
  134. {$elifc defined __arm64__ and __arm64__}
  135. {$setc TARGET_CPU_PPC := FALSE}
  136. {$setc TARGET_CPU_PPC64 := FALSE}
  137. {$setc TARGET_CPU_X86 := FALSE}
  138. {$setc TARGET_CPU_X86_64 := FALSE}
  139. {$setc TARGET_CPU_ARM := FALSE}
  140. {$setc TARGET_CPU_ARM64 := TRUE}
  141. {$ifc defined ios}
  142. {$setc TARGET_OS_MAC := FALSE}
  143. {$setc TARGET_OS_IPHONE := TRUE}
  144. {$setc TARGET_OS_EMBEDDED := TRUE}
  145. {$elsec}
  146. {$setc TARGET_OS_MAC := TRUE}
  147. {$setc TARGET_OS_IPHONE := FALSE}
  148. {$setc TARGET_OS_EMBEDDED := FALSE}
  149. {$endc}
  150. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  151. {$elsec}
  152. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  153. {$endc}
  154. {$ifc defined __LP64__ and __LP64__ }
  155. {$setc TARGET_CPU_64 := TRUE}
  156. {$elsec}
  157. {$setc TARGET_CPU_64 := FALSE}
  158. {$endc}
  159. {$ifc defined FPC_BIG_ENDIAN}
  160. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  161. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  162. {$elifc defined FPC_LITTLE_ENDIAN}
  163. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  164. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  165. {$elsec}
  166. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  167. {$endc}
  168. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  169. {$setc CALL_NOT_IN_CARBON := FALSE}
  170. {$setc OLDROUTINENAMES := FALSE}
  171. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  172. {$setc OPAQUE_UPP_TYPES := TRUE}
  173. {$setc OTCARBONAPPLICATION := TRUE}
  174. {$setc OTKERNEL := FALSE}
  175. {$setc PM_USE_SESSION_APIS := TRUE}
  176. {$setc TARGET_API_MAC_CARBON := TRUE}
  177. {$setc TARGET_API_MAC_OS8 := FALSE}
  178. {$setc TARGET_API_MAC_OSX := TRUE}
  179. {$setc TARGET_CARBON := TRUE}
  180. {$setc TARGET_CPU_68K := FALSE}
  181. {$setc TARGET_CPU_MIPS := FALSE}
  182. {$setc TARGET_CPU_SPARC := FALSE}
  183. {$setc TARGET_OS_UNIX := FALSE}
  184. {$setc TARGET_OS_WIN32 := FALSE}
  185. {$setc TARGET_RT_MAC_68881 := FALSE}
  186. {$setc TARGET_RT_MAC_CFM := FALSE}
  187. {$setc TARGET_RT_MAC_MACHO := TRUE}
  188. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  189. {$setc TYPE_BOOL := FALSE}
  190. {$setc TYPE_EXTENDED := FALSE}
  191. {$setc TYPE_LONGLONG := TRUE}
  192. uses MacTypes,CFBase,CFLocale,CFDate,CFTimeZone;
  193. {$endc} {not MACOSALLINCLUDE}
  194. {$ALIGN POWER}
  195. {#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
  196. type
  197. CFCalendarRef = ^__CFCalendar; { an opaque type }
  198. __CFCalendar = record end;
  199. function CFCalendarGetTypeID: CFTypeID; external name '_CFCalendarGetTypeID';
  200. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  201. function CFCalendarCopyCurrent: CFCalendarRef; external name '_CFCalendarCopyCurrent';
  202. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  203. function CFCalendarCreateWithIdentifier( allocator: CFAllocatorRef; identifier: CFStringRef ): CFCalendarRef; external name '_CFCalendarCreateWithIdentifier';
  204. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  205. // Create a calendar. The identifiers are the kCF*Calendar
  206. // constants in CFLocale.h.
  207. function CFCalendarGetIdentifier( calendar: CFCalendarRef ): CFStringRef; external name '_CFCalendarGetIdentifier';
  208. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  209. // Returns the calendar's identifier.
  210. function CFCalendarCopyLocale( calendar: CFCalendarRef ): CFLocaleRef; external name '_CFCalendarCopyLocale';
  211. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  212. procedure CFCalendarSetLocale( calendar: CFCalendarRef; locale: CFLocaleRef ); external name '_CFCalendarSetLocale';
  213. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  214. function CFCalendarCopyTimeZone( calendar: CFCalendarRef ): CFTimeZoneRef; external name '_CFCalendarCopyTimeZone';
  215. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  216. procedure CFCalendarSetTimeZone( calendar: CFCalendarRef; tz: CFTimeZoneRef ); external name '_CFCalendarSetTimeZone';
  217. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  218. function CFCalendarGetFirstWeekday( calendar: CFCalendarRef ): CFIndex; external name '_CFCalendarGetFirstWeekday';
  219. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  220. procedure CFCalendarSetFirstWeekday( calendar: CFCalendarRef; wkdy: CFIndex ); external name '_CFCalendarSetFirstWeekday';
  221. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  222. function CFCalendarGetMinimumDaysInFirstWeek( calendar: CFCalendarRef ): CFIndex; external name '_CFCalendarGetMinimumDaysInFirstWeek';
  223. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  224. procedure CFCalendarSetMinimumDaysInFirstWeek( calendar: CFCalendarRef; mwd: CFIndex ); external name '_CFCalendarSetMinimumDaysInFirstWeek';
  225. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  226. type
  227. CFCalendarUnit = UNSIGNEDLONG;
  228. const
  229. kCFCalendarUnitEra = 1 shl 1;
  230. kCFCalendarUnitYear = 1 shl 2;
  231. kCFCalendarUnitMonth = 1 shl 3;
  232. kCFCalendarUnitDay = 1 shl 4;
  233. kCFCalendarUnitHour = 1 shl 5;
  234. kCFCalendarUnitMinute = 1 shl 6;
  235. kCFCalendarUnitSecond = 1 shl 7;
  236. kCFCalendarUnitWeek = 1 shl 8;
  237. kCFCalendarUnitWeekday = 1 shl 9;
  238. kCFCalendarUnitWeekdayOrdinal = 1 shl 10;
  239. kCFCalendarUnitQuarter = 1 shl 11; { CF_AVAILABLE_STARTING(10_6, 4_0); }
  240. kCFCalendarUnitWeekOfMonth = 1 shl 12; { CF_AVAILABLE_STARTING(10_7, 5_0) }
  241. kCFCalendarUnitWeekOfYear = 1 shl 13; { CF_AVAILABLE_STARTING(10_7, 5_0) }
  242. kCFCalendarUnitYearForWeekOfYear = 1 shl 14; { CF_AVAILABLE_STARTING(10_7, 5_0) }
  243. function CFCalendarGetMinimumRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit ): CFRange; external name '_CFCalendarGetMinimumRangeOfUnit';
  244. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  245. function CFCalendarGetMaximumRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit ): CFRange; external name '_CFCalendarGetMaximumRangeOfUnit';
  246. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  247. function CFCalendarGetRangeOfUnit( calendar: CFCalendarRef; smallerUnit: CFCalendarUnit; biggerUnit: CFCalendarUnit; at: CFAbsoluteTime ): CFRange; external name '_CFCalendarGetRangeOfUnit';
  248. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  249. function CFCalendarGetOrdinalityOfUnit( calendar: CFCalendarRef; smallerUnit: CFCalendarUnit; biggerUnit: CFCalendarUnit; at: CFAbsoluteTime ): CFIndex; external name '_CFCalendarGetOrdinalityOfUnit';
  250. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  251. function CFCalendarGetTimeRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit; at: CFAbsoluteTime; var startp: CFAbsoluteTime; var tip: CFTimeInterval ): Boolean; external name '_CFCalendarGetTimeRangeOfUnit';
  252. (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
  253. function CFCalendarComposeAbsoluteTime( calendar: CFCalendarRef; var at: { out } CFAbsoluteTime; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarComposeAbsoluteTime';
  254. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  255. function CFCalendarDecomposeAbsoluteTime( calendar: CFCalendarRef; at: CFAbsoluteTime; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarDecomposeAbsoluteTime';
  256. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  257. const
  258. kCFCalendarComponentsWrap = 1 shl 0; // option for adding
  259. function CFCalendarAddComponents( calendar: CFCalendarRef; var at: { inout } CFAbsoluteTime; options: CFOptionFlags; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarAddComponents';
  260. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  261. function CFCalendarGetComponentDifference( calendar: CFCalendarRef; startingAT: CFAbsoluteTime; resultAT: CFAbsoluteTime; options: CFOptionFlags; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarGetComponentDifference';
  262. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  263. {#endif}
  264. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  265. end.
  266. {$endc} {not MACOSALLINCLUDE}