Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSCalendarDate.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSCalendarDate.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,196 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSCalendarDate; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSDate; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSTimeZone; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSCalendarDate : NSDate +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public static NSCalendarDate calendarDate () + { + objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_calendarDate); + return result !is null ? new NSCalendarDate(result) : null; + } + + public NSString calendarFormat () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_calendarFormat); + return result !is null ? new NSString(result) : null; + } + + public NSCalendarDate dateByAddingYears (NSInteger year, NSInteger month, NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_dateByAddingYears_1months_1days_1hours_1minutes_1seconds_1, year, month, day, hour, minute, + second); + return result is this.id ? this : (result !is null ? new NSCalendarDate(result) : null); + } + + public static id static_dateWithString_calendarFormat_ (NSString description, NSString format) + { + objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithString_1calendarFormat_1, + description !is null ? description.id : null, format !is null ? format.id : null); + return result !is null ? new id(result) : null; + } + + public static id static_dateWithString_calendarFormat_locale_ (NSString description, NSString format, id locale) + { + objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithString_1calendarFormat_1locale_1, + description !is null ? description.id : null, format !is null ? format.id : null, locale !is null ? locale.id : null); + return result !is null ? new id(result) : null; + } + + public static NSCalendarDate dateWithYear (NSInteger year, NSInteger month, NSInteger day, NSInteger hour, NSInteger minute, NSInteger second, NSTimeZone aTimeZone) + { + objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithYear_1month_1day_1hour_1minute_1second_1timeZone_1, year, month, + day, hour, minute, second, aTimeZone !is null ? aTimeZone.id : null); + return result !is null ? new NSCalendarDate(result) : null; + } + + public NSInteger dayOfCommonEra () + { + return OS.objc_msgSend(this.id, OS.sel_dayOfCommonEra); + } + + public NSInteger dayOfMonth () + { + return OS.objc_msgSend(this.id, OS.sel_dayOfMonth); + } + + public NSInteger dayOfWeek () + { + return OS.objc_msgSend(this.id, OS.sel_dayOfWeek); + } + + public NSInteger dayOfYear () + { + return OS.objc_msgSend(this.id, OS.sel_dayOfYear); + } + + public NSString description () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_description); + return result !is null ? new NSString(result) : null; + } + + public NSString descriptionWithCalendarFormat_ (NSString format) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithCalendarFormat_1, format !is null ? format.id : null); + return result !is null ? new NSString(result) : null; + } + + public NSString descriptionWithCalendarFormat_locale_ (NSString format, id locale) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithCalendarFormat_1locale_1, format !is null ? format.id : null, + locale !is null ? locale.id : null); + return result !is null ? new NSString(result) : null; + } + + public NSString descriptionWithLocale (id locale) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id : null); + return result !is null ? new NSString(result) : null; + } + + public NSInteger hourOfDay () + { + return OS.objc_msgSend(this.id, OS.sel_hourOfDay); + } + + public NSCalendarDate initWithString_ (NSString description) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1, description !is null ? description.id : null); + return result !is null ? this : null; + } + + public NSCalendarDate initWithString_calendarFormat_ (NSString description, NSString format) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1calendarFormat_1, description !is null ? description.id : null, + format !is null ? format.id : null); + return result !is null ? this : null; + } + + public NSCalendarDate initWithString_calendarFormat_locale_ (NSString description, NSString format, id locale) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1calendarFormat_1locale_1, description !is null ? description.id : null, + format !is null ? format.id : null, locale !is null ? locale.id : null); + return result !is null ? this : null; + } + + public id initWithYear (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithYear_1month_1day_1hour_1minute_1second_1timeZone_1, year, month, day, hour, minute, + second, aTimeZone !is null ? aTimeZone.id : null); + return result !is null ? new id(result) : null; + } + + public NSInteger minuteOfHour () + { + return OS.objc_msgSend(this.id, OS.sel_minuteOfHour); + } + + public NSInteger monthOfYear () + { + return OS.objc_msgSend(this.id, OS.sel_monthOfYear); + } + + public NSInteger secondOfMinute () + { + return OS.objc_msgSend(this.id, OS.sel_secondOfMinute); + } + + public void setCalendarFormat (NSString format) + { + OS.objc_msgSend(this.id, OS.sel_setCalendarFormat_1, format !is null ? format.id : null); + } + + public void setTimeZone (NSTimeZone aTimeZone) + { + OS.objc_msgSend(this.id, OS.sel_setTimeZone_1, aTimeZone !is null ? aTimeZone.id : null); + } + + public NSTimeZone timeZone () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_timeZone); + return result !is null ? new NSTimeZone(result) : null; + } + + public NSInteger yearOfCommonEra () + { + return OS.objc_msgSend(this.id, OS.sel_yearOfCommonEra); + } + + public void years (NSInteger* yp, NSInteger* mop, NSInteger* dp, NSInteger* hp, NSInteger* mip, NSInteger* sp, NSCalendarDate date) + { + OS.objc_msgSend(this.id, OS.sel_years_1months_1days_1hours_1minutes_1seconds_1sinceDate_1, yp, mop, dp, hp, mip, sp, + date !is null ? date.id : null); + } + +}