Mercurial > projects > dstep
view dstep/foundation/NSTimeZone.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children | b9de51448c6b |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 3, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.foundation.NSTimeZone; import dstep.foundation.NSArray; import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDate; import dstep.foundation.NSDictionary; import dstep.foundation.NSLocale; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.foundation.NSTimeZone_bindings; alias NSInteger NSTimeZoneNameStyle; private NSString NSSystemTimeZoneDidChangeNotification_; NSString NSSystemTimeZoneDidChangeNotification () { if (NSSystemTimeZoneDidChangeNotification_) return NSSystemTimeZoneDidChangeNotification_; return NSSystemTimeZoneDidChangeNotification_ = new NSString(bindings.NSSystemTimeZoneDidChangeNotification); } enum { NSTimeZoneNameStyleStandard, NSTimeZoneNameStyleShortStandard, NSTimeZoneNameStyleDaylightSaving, NSTimeZoneNameStyleShortDaylightSaving } const TNSExtendedTimeZone = ` static NSTimeZone systemTimeZone () { return invokeObjcSuperClass!(NSTimeZone, "systemTimeZone"); } static void resetSystemTimeZone () { return invokeObjcSuperClass!(void, "resetSystemTimeZone"); } static NSTimeZone defaultTimeZone () { return invokeObjcSuperClass!(NSTimeZone, "defaultTimeZone"); } static void setDefaultTimeZone (NSTimeZone aTimeZone) { return invokeObjcSuperClass!(void, "setDefaultTimeZone:", NSTimeZone)(aTimeZone); } static NSTimeZone localTimeZone () { return invokeObjcSuperClass!(NSTimeZone, "localTimeZone"); } static NSArray knownTimeZoneNames () { return invokeObjcSuperClass!(NSArray, "knownTimeZoneNames"); } static NSDictionary abbreviationDictionary () { return invokeObjcSuperClass!(NSDictionary, "abbreviationDictionary"); } NSInteger secondsFromGMT () { return invokeObjcSelf!(NSInteger, "secondsFromGMT"); } NSString abbreviation () { return invokeObjcSelf!(NSString, "abbreviation"); } bool isDaylightSavingTime () { return invokeObjcSelf!(bool, "isDaylightSavingTime"); } double daylightSavingTimeOffset () { return invokeObjcSelf!(double, "daylightSavingTimeOffset"); } NSDate nextDaylightSavingTimeTransition () { return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransition"); } NSString description () { return invokeObjcSelf!(NSString, "description"); } bool isEqualToTimeZone (NSTimeZone aTimeZone) { return invokeObjcSelf!(bool, "isEqualToTimeZone:", NSTimeZone)(aTimeZone); } NSString localizedName (int style, NSLocale locale) { return invokeObjcSelf!(NSString, "localizedName:locale:", int, NSLocale)(style, locale); } `; const TNSTimeZoneCreation = ` static Object timeZoneWithName (NSString tzName) { return invokeObjcSuperClass!(Object, "timeZoneWithName:", NSString)(tzName); } static Object timeZoneWithName (NSString tzName, NSData aData) { return invokeObjcSuperClass!(Object, "timeZoneWithName:data:", NSString, NSData)(tzName, aData); } Object initWithName (NSString tzName) { return invokeObjcSelf!(Object, "initWithName:", NSString)(tzName); } this (NSString tzName) { typeof(this).alloc.initWithName(tzName); } Object initWithName (NSString tzName, NSData aData) { return invokeObjcSelf!(Object, "initWithName:data:", NSString, NSData)(tzName, aData); } this (NSString tzName, NSData aData) { typeof(this).alloc.initWithName(tzName, aData); } static Object timeZoneForSecondsFromGMT (NSInteger seconds) { return invokeObjcSuperClass!(Object, "timeZoneForSecondsFromGMT:", NSInteger)(seconds); } static Object timeZoneWithAbbreviation (NSString abbreviation) { return invokeObjcSuperClass!(Object, "timeZoneWithAbbreviation:", NSString)(abbreviation); } `; class NSTimeZone : NSObject, INSCopying, INSCoding { mixin (ObjcWrap); this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } NSString name () { return invokeObjcSelf!(NSString, "name"); } NSData data () { return invokeObjcSelf!(NSData, "data"); } NSInteger secondsFromGMTForDate (NSDate aDate) { return invokeObjcSelf!(NSInteger, "secondsFromGMTForDate:", NSDate)(aDate); } NSString abbreviationForDate (NSDate aDate) { return invokeObjcSelf!(NSString, "abbreviationForDate:", NSDate)(aDate); } bool isDaylightSavingTimeForDate (NSDate aDate) { return invokeObjcSelf!(bool, "isDaylightSavingTimeForDate:", NSDate)(aDate); } double daylightSavingTimeOffsetForDate (NSDate aDate) { return invokeObjcSelf!(double, "daylightSavingTimeOffsetForDate:", NSDate)(aDate); } NSDate nextDaylightSavingTimeTransitionAfterDate (NSDate aDate) { return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransitionAfterDate:", NSDate)(aDate); } Object copyWithZone (NSZone* zone) { return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); } void encodeWithCoder (NSCoder aCoder) { return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); } Object initWithCoder (NSCoder aDecoder) { return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); } this (NSCoder aDecoder) { typeof(this).alloc.initWithCoder(aDecoder); } // TNSExtendedTimeZone static NSTimeZone systemTimeZone () { return invokeObjcSuperClass!(NSTimeZone, "systemTimeZone"); } static void resetSystemTimeZone () { return invokeObjcSuperClass!(void, "resetSystemTimeZone"); } static NSTimeZone defaultTimeZone () { return invokeObjcSuperClass!(NSTimeZone, "defaultTimeZone"); } static void setDefaultTimeZone (NSTimeZone aTimeZone) { return invokeObjcSuperClass!(void, "setDefaultTimeZone:", NSTimeZone)(aTimeZone); } static NSTimeZone localTimeZone () { return invokeObjcSuperClass!(NSTimeZone, "localTimeZone"); } static NSArray knownTimeZoneNames () { return invokeObjcSuperClass!(NSArray, "knownTimeZoneNames"); } static NSDictionary abbreviationDictionary () { return invokeObjcSuperClass!(NSDictionary, "abbreviationDictionary"); } NSInteger secondsFromGMT () { return invokeObjcSelf!(NSInteger, "secondsFromGMT"); } NSString abbreviation () { return invokeObjcSelf!(NSString, "abbreviation"); } bool isDaylightSavingTime () { return invokeObjcSelf!(bool, "isDaylightSavingTime"); } double daylightSavingTimeOffset () { return invokeObjcSelf!(double, "daylightSavingTimeOffset"); } NSDate nextDaylightSavingTimeTransition () { return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransition"); } NSString description () { return invokeObjcSelf!(NSString, "description"); } bool isEqualToTimeZone (NSTimeZone aTimeZone) { return invokeObjcSelf!(bool, "isEqualToTimeZone:", NSTimeZone)(aTimeZone); } NSString localizedName (int style, NSLocale locale) { return invokeObjcSelf!(NSString, "localizedName:locale:", int, NSLocale)(style, locale); } // TNSTimeZoneCreation static Object timeZoneWithName (NSString tzName) { return invokeObjcSuperClass!(Object, "timeZoneWithName:", NSString)(tzName); } static Object timeZoneWithName (NSString tzName, NSData aData) { return invokeObjcSuperClass!(Object, "timeZoneWithName:data:", NSString, NSData)(tzName, aData); } Object initWithName (NSString tzName) { return invokeObjcSelf!(Object, "initWithName:", NSString)(tzName); } this (NSString tzName) { typeof(this).alloc.initWithName(tzName); } Object initWithName (NSString tzName, NSData aData) { return invokeObjcSelf!(Object, "initWithName:data:", NSString, NSData)(tzName, aData); } this (NSString tzName, NSData aData) { typeof(this).alloc.initWithName(tzName, aData); } static Object timeZoneForSecondsFromGMT (NSInteger seconds) { return invokeObjcSuperClass!(Object, "timeZoneForSecondsFromGMT:", NSInteger)(seconds); } static Object timeZoneWithAbbreviation (NSString abbreviation) { return invokeObjcSuperClass!(Object, "timeZoneWithAbbreviation:", NSString)(abbreviation); } }