/packages/univint/src/CFTimeZone.pas
Pascal | 238 lines | 33 code | 38 blank | 167 comment | 0 complexity | 53e178d9b05ab7dfd02dd3bca0909fc1 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
1{ CFTimeZone.h 2 Copyright (c) 1998-2012, Apple Inc. All rights reserved. 3} 4{ Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, November 2005 } 5{ Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2009 } 6{ Pascal Translation Updated: Jonas Maebe <jonas@freepascal.org>, September 2012 } 7{ 8 Modified for use with Free Pascal 9 Version 308 10 Please report any bugs to <gpc@microbizz.nl> 11} 12 13{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE} 14{$mode macpas} 15{$packenum 1} 16{$macro on} 17{$inline on} 18{$calling mwpascal} 19 20unit CFTimeZone; 21interface 22{$setc UNIVERSAL_INTERFACES_VERSION := $0400} 23{$setc GAP_INTERFACES_VERSION := $0308} 24 25{$ifc not defined USE_CFSTR_CONSTANT_MACROS} 26 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE} 27{$endc} 28 29{$ifc defined CPUPOWERPC and defined CPUI386} 30 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386} 31{$endc} 32{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN} 33 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN} 34{$endc} 35 36{$ifc not defined __ppc__ and defined CPUPOWERPC32} 37 {$setc __ppc__ := 1} 38{$elsec} 39 {$setc __ppc__ := 0} 40{$endc} 41{$ifc not defined __ppc64__ and defined CPUPOWERPC64} 42 {$setc __ppc64__ := 1} 43{$elsec} 44 {$setc __ppc64__ := 0} 45{$endc} 46{$ifc not defined __i386__ and defined CPUI386} 47 {$setc __i386__ := 1} 48{$elsec} 49 {$setc __i386__ := 0} 50{$endc} 51{$ifc not defined __x86_64__ and defined CPUX86_64} 52 {$setc __x86_64__ := 1} 53{$elsec} 54 {$setc __x86_64__ := 0} 55{$endc} 56{$ifc not defined __arm__ and defined CPUARM} 57 {$setc __arm__ := 1} 58{$elsec} 59 {$setc __arm__ := 0} 60{$endc} 61 62{$ifc defined cpu64} 63 {$setc __LP64__ := 1} 64{$elsec} 65 {$setc __LP64__ := 0} 66{$endc} 67 68 69{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__} 70 {$error Conflicting definitions for __ppc__ and __i386__} 71{$endc} 72 73{$ifc defined __ppc__ and __ppc__} 74 {$setc TARGET_CPU_PPC := TRUE} 75 {$setc TARGET_CPU_PPC64 := FALSE} 76 {$setc TARGET_CPU_X86 := FALSE} 77 {$setc TARGET_CPU_X86_64 := FALSE} 78 {$setc TARGET_CPU_ARM := FALSE} 79 {$setc TARGET_OS_MAC := TRUE} 80 {$setc TARGET_OS_IPHONE := FALSE} 81 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 82 {$setc TARGET_OS_EMBEDDED := FALSE} 83{$elifc defined __ppc64__ and __ppc64__} 84 {$setc TARGET_CPU_PPC := FALSE} 85 {$setc TARGET_CPU_PPC64 := TRUE} 86 {$setc TARGET_CPU_X86 := FALSE} 87 {$setc TARGET_CPU_X86_64 := FALSE} 88 {$setc TARGET_CPU_ARM := FALSE} 89 {$setc TARGET_OS_MAC := TRUE} 90 {$setc TARGET_OS_IPHONE := FALSE} 91 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 92 {$setc TARGET_OS_EMBEDDED := FALSE} 93{$elifc defined __i386__ and __i386__} 94 {$setc TARGET_CPU_PPC := FALSE} 95 {$setc TARGET_CPU_PPC64 := FALSE} 96 {$setc TARGET_CPU_X86 := TRUE} 97 {$setc TARGET_CPU_X86_64 := FALSE} 98 {$setc TARGET_CPU_ARM := FALSE} 99{$ifc defined(iphonesim)} 100 {$setc TARGET_OS_MAC := FALSE} 101 {$setc TARGET_OS_IPHONE := TRUE} 102 {$setc TARGET_IPHONE_SIMULATOR := TRUE} 103{$elsec} 104 {$setc TARGET_OS_MAC := TRUE} 105 {$setc TARGET_OS_IPHONE := FALSE} 106 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 107{$endc} 108 {$setc TARGET_OS_EMBEDDED := FALSE} 109{$elifc defined __x86_64__ and __x86_64__} 110 {$setc TARGET_CPU_PPC := FALSE} 111 {$setc TARGET_CPU_PPC64 := FALSE} 112 {$setc TARGET_CPU_X86 := FALSE} 113 {$setc TARGET_CPU_X86_64 := TRUE} 114 {$setc TARGET_CPU_ARM := FALSE} 115 {$setc TARGET_OS_MAC := TRUE} 116 {$setc TARGET_OS_IPHONE := FALSE} 117 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 118 {$setc TARGET_OS_EMBEDDED := FALSE} 119{$elifc defined __arm__ and __arm__} 120 {$setc TARGET_CPU_PPC := FALSE} 121 {$setc TARGET_CPU_PPC64 := FALSE} 122 {$setc TARGET_CPU_X86 := FALSE} 123 {$setc TARGET_CPU_X86_64 := FALSE} 124 {$setc TARGET_CPU_ARM := TRUE} 125 { will require compiler define when/if other Apple devices with ARM cpus ship } 126 {$setc TARGET_OS_MAC := FALSE} 127 {$setc TARGET_OS_IPHONE := TRUE} 128 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 129 {$setc TARGET_OS_EMBEDDED := TRUE} 130{$elsec} 131 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.} 132{$endc} 133 134{$ifc defined __LP64__ and __LP64__ } 135 {$setc TARGET_CPU_64 := TRUE} 136{$elsec} 137 {$setc TARGET_CPU_64 := FALSE} 138{$endc} 139 140{$ifc defined FPC_BIG_ENDIAN} 141 {$setc TARGET_RT_BIG_ENDIAN := TRUE} 142 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE} 143{$elifc defined FPC_LITTLE_ENDIAN} 144 {$setc TARGET_RT_BIG_ENDIAN := FALSE} 145 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE} 146{$elsec} 147 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.} 148{$endc} 149{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE} 150{$setc CALL_NOT_IN_CARBON := FALSE} 151{$setc OLDROUTINENAMES := FALSE} 152{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE} 153{$setc OPAQUE_UPP_TYPES := TRUE} 154{$setc OTCARBONAPPLICATION := TRUE} 155{$setc OTKERNEL := FALSE} 156{$setc PM_USE_SESSION_APIS := TRUE} 157{$setc TARGET_API_MAC_CARBON := TRUE} 158{$setc TARGET_API_MAC_OS8 := FALSE} 159{$setc TARGET_API_MAC_OSX := TRUE} 160{$setc TARGET_CARBON := TRUE} 161{$setc TARGET_CPU_68K := FALSE} 162{$setc TARGET_CPU_MIPS := FALSE} 163{$setc TARGET_CPU_SPARC := FALSE} 164{$setc TARGET_OS_UNIX := FALSE} 165{$setc TARGET_OS_WIN32 := FALSE} 166{$setc TARGET_RT_MAC_68881 := FALSE} 167{$setc TARGET_RT_MAC_CFM := FALSE} 168{$setc TARGET_RT_MAC_MACHO := TRUE} 169{$setc TYPED_FUNCTION_POINTERS := TRUE} 170{$setc TYPE_BOOL := FALSE} 171{$setc TYPE_EXTENDED := FALSE} 172{$setc TYPE_LONGLONG := TRUE} 173uses MacTypes,CFBase,CFArray,CFData,CFDate,CFDictionary,CFLocale,CFString; 174{$endc} {not MACOSALLINCLUDE} 175 176{$ALIGN POWER} 177 178 179function CFTimeZoneGetTypeID: CFTypeID; external name '_CFTimeZoneGetTypeID'; 180 181function CFTimeZoneCopySystem: CFTimeZoneRef; external name '_CFTimeZoneCopySystem'; 182 183procedure CFTimeZoneResetSystem; external name '_CFTimeZoneResetSystem'; 184 185function CFTimeZoneCopyDefault: CFTimeZoneRef; external name '_CFTimeZoneCopyDefault'; 186 187procedure CFTimeZoneSetDefault( tz: CFTimeZoneRef ); external name '_CFTimeZoneSetDefault'; 188 189function CFTimeZoneCopyKnownNames: CFArrayRef; external name '_CFTimeZoneCopyKnownNames'; 190 191function CFTimeZoneCopyAbbreviationDictionary: CFDictionaryRef; external name '_CFTimeZoneCopyAbbreviationDictionary'; 192 193procedure CFTimeZoneSetAbbreviationDictionary( dict: CFDictionaryRef ); external name '_CFTimeZoneSetAbbreviationDictionary'; 194 195function CFTimeZoneCreate( allocator: CFAllocatorRef; name: CFStringRef; data: CFDataRef ): CFTimeZoneRef; external name '_CFTimeZoneCreate'; 196 197function CFTimeZoneCreateWithTimeIntervalFromGMT( allocator: CFAllocatorRef; ti: CFTimeInterval ): CFTimeZoneRef; external name '_CFTimeZoneCreateWithTimeIntervalFromGMT'; 198 199function CFTimeZoneCreateWithName( allocator: CFAllocatorRef; name: CFStringRef; tryAbbrev: Boolean ): CFTimeZoneRef; external name '_CFTimeZoneCreateWithName'; 200 201function CFTimeZoneGetName( tz: CFTimeZoneRef ): CFStringRef; external name '_CFTimeZoneGetName'; 202 203function CFTimeZoneGetData( tz: CFTimeZoneRef ): CFDataRef; external name '_CFTimeZoneGetData'; 204 205function CFTimeZoneGetSecondsFromGMT( tz: CFTimeZoneRef; at: CFAbsoluteTime ): CFTimeInterval; external name '_CFTimeZoneGetSecondsFromGMT'; 206 207function CFTimeZoneCopyAbbreviation( tz: CFTimeZoneRef; at: CFAbsoluteTime ): CFStringRef; external name '_CFTimeZoneCopyAbbreviation'; 208 209function CFTimeZoneIsDaylightSavingTime( tz: CFTimeZoneRef; at: CFAbsoluteTime ): Boolean; external name '_CFTimeZoneIsDaylightSavingTime'; 210 211function CFTimeZoneGetDaylightSavingTimeOffset( tz: CFTimeZoneRef; at: CFAbsoluteTime ): CFTimeInterval; external name '_CFTimeZoneGetDaylightSavingTimeOffset'; 212(* CF_AVAILABLE_STARTING(10_5, 2_0) *) 213 214function CFTimeZoneGetNextDaylightSavingTimeTransition( tz: CFTimeZoneRef; at: CFAbsoluteTime ): CFAbsoluteTime; external name '_CFTimeZoneGetNextDaylightSavingTimeTransition'; 215(* CF_AVAILABLE_STARTING(10_5, 2_0) *) 216 217type 218 CFTimeZoneNameStyle = CFIndex; 219 220const 221 kCFTimeZoneNameStyleStandard = 0; 222 kCFTimeZoneNameStyleShortStandard = 1; 223 kCFTimeZoneNameStyleDaylightSaving = 2; 224 kCFTimeZoneNameStyleShortDaylightSaving = 3; 225 kCFTimeZoneNameStyleGeneric = 4; 226 kCFTimeZoneNameStyleShortGeneric = 5; 227 228function CFTimeZoneCopyLocalizedName( tz: CFTimeZoneRef; style: CFTimeZoneNameStyle; locale: CFLocaleRef ): CFStringRef; external name '_CFTimeZoneCopyLocalizedName'; 229(* CF_AVAILABLE_STARTING(10_5, 2_0) *) 230 231var kCFTimeZoneSystemTimeZoneDidChangeNotification: CFStringRef; external name '_kCFTimeZoneSystemTimeZoneDidChangeNotification'; (* attribute const *) 232(* CF_AVAILABLE_STARTING(10_5, 2_0) *) 233 234 235{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE} 236 237end. 238{$endc} {not MACOSALLINCLUDE}