diff dwt/internal/cocoa/NSCalendarDate.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children 62202ce0039f
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSCalendarDate.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSCalendarDate.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,196 +1,87 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 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
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSCalendarDate;
 
-import dwt.internal.cocoa.id;
+import dwt.dwthelper.utils;
+import cocoa = 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 dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-public class NSCalendarDate : NSDate
-{
-
-    public this ()
-    {
-        super();
-    }
+public class NSCalendarDate : NSDate {
 
-    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 this() {
+    super();
+}
 
-    public NSString calendarFormat ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_calendarFormat);
-        return result !is null ? new NSString(result) : null;
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    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 this(cocoa.id id) {
+    super(id);
+}
 
-    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 cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_dayOfCommonEra);
-    }
+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 NSInteger dayOfMonth ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_dayOfMonth);
-    }
-
-    public NSInteger dayOfWeek ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_dayOfWeek);
-    }
+public static NSCalendarDate dateWithYear(NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) {
+    objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithYear_month_day_hour_minute_second_timeZone_, year, month, day, hour, minute, second, aTimeZone !is null ? aTimeZone.id : null);
+    return result !is null ? new NSCalendarDate(result) : null;
+}
 
-    public NSInteger dayOfYear ()
-    {
-        return cast(NSInteger) 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 NSInteger dayOfMonth() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_dayOfMonth);
+}
 
-    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 NSInteger hourOfDay() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_hourOfDay);
+}
 
-    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 cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_hourOfDay);
-    }
+public NSInteger minuteOfHour() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_minuteOfHour);
+}
 
-    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 NSInteger monthOfYear() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_monthOfYear);
+}
 
-    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 NSInteger secondOfMinute() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_secondOfMinute);
+}
 
-    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 NSTimeZone timeZone() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_timeZone);
+    return result !is null ? new NSTimeZone(result) : null;
+}
 
-    public NSInteger minuteOfHour ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_minuteOfHour);
-    }
-
-    public NSInteger monthOfYear ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_monthOfYear);
-    }
-
-    public NSInteger secondOfMinute ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_secondOfMinute);
-    }
+public int /*long*/yearOfCommonEra() {
+    return OS.objc_msgSend(this.id, OS.sel_yearOfCommonEra);
+}
 
-    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 static NSDate dateWithTimeIntervalSinceNow(double secs) {
+    objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithTimeIntervalSinceNow_, secs);
+    return result !is null ? new NSCalendarDate(result) : 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 cast(NSInteger) 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);
-    }
+public static NSDate distantFuture() {
+    objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_distantFuture);
+    return result !is null ? new NSCalendarDate(result) : null;
+}
 
 }