Mercurial > projects > dwt-mac
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSCalendarDate; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSDate; | |
18 import dwt.internal.cocoa.NSInteger; | |
19 import dwt.internal.cocoa.NSString; | |
20 import dwt.internal.cocoa.NSTimeZone; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 public class NSCalendarDate : NSDate | |
25 { | |
26 | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public static NSCalendarDate calendarDate () | |
38 { | |
39 objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_calendarDate); | |
40 return result !is null ? new NSCalendarDate(result) : null; | |
41 } | |
42 | |
43 public NSString calendarFormat () | |
44 { | |
45 objc.id result = OS.objc_msgSend(this.id, OS.sel_calendarFormat); | |
46 return result !is null ? new NSString(result) : null; | |
47 } | |
48 | |
49 public NSCalendarDate dateByAddingYears (NSInteger year, NSInteger month, NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) | |
50 { | |
51 objc.id result = OS.objc_msgSend(this.id, OS.sel_dateByAddingYears_1months_1days_1hours_1minutes_1seconds_1, year, month, day, hour, minute, | |
52 second); | |
53 return result is this.id ? this : (result !is null ? new NSCalendarDate(result) : null); | |
54 } | |
55 | |
56 public static id static_dateWithString_calendarFormat_ (NSString description, NSString format) | |
57 { | |
58 objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithString_1calendarFormat_1, | |
59 description !is null ? description.id : null, format !is null ? format.id : null); | |
60 return result !is null ? new id(result) : null; | |
61 } | |
62 | |
63 public static id static_dateWithString_calendarFormat_locale_ (NSString description, NSString format, id locale) | |
64 { | |
65 objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithString_1calendarFormat_1locale_1, | |
66 description !is null ? description.id : null, format !is null ? format.id : null, locale !is null ? locale.id : null); | |
67 return result !is null ? new id(result) : null; | |
68 } | |
69 | |
70 public static NSCalendarDate dateWithYear (NSInteger year, NSInteger month, NSInteger day, NSInteger hour, NSInteger minute, NSInteger second, NSTimeZone aTimeZone) | |
71 { | |
72 objc.id result = OS.objc_msgSend(OS.class_NSCalendarDate, OS.sel_dateWithYear_1month_1day_1hour_1minute_1second_1timeZone_1, year, month, | |
73 day, hour, minute, second, aTimeZone !is null ? aTimeZone.id : null); | |
74 return result !is null ? new NSCalendarDate(result) : null; | |
75 } | |
76 | |
77 public NSInteger dayOfCommonEra () | |
78 { | |
79 return OS.objc_msgSend(this.id, OS.sel_dayOfCommonEra); | |
80 } | |
81 | |
82 public NSInteger dayOfMonth () | |
83 { | |
84 return OS.objc_msgSend(this.id, OS.sel_dayOfMonth); | |
85 } | |
86 | |
87 public NSInteger dayOfWeek () | |
88 { | |
89 return OS.objc_msgSend(this.id, OS.sel_dayOfWeek); | |
90 } | |
91 | |
92 public NSInteger dayOfYear () | |
93 { | |
94 return OS.objc_msgSend(this.id, OS.sel_dayOfYear); | |
95 } | |
96 | |
97 public NSString description () | |
98 { | |
99 objc.id result = OS.objc_msgSend(this.id, OS.sel_description); | |
100 return result !is null ? new NSString(result) : null; | |
101 } | |
102 | |
103 public NSString descriptionWithCalendarFormat_ (NSString format) | |
104 { | |
105 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithCalendarFormat_1, format !is null ? format.id : null); | |
106 return result !is null ? new NSString(result) : null; | |
107 } | |
108 | |
109 public NSString descriptionWithCalendarFormat_locale_ (NSString format, id locale) | |
110 { | |
111 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithCalendarFormat_1locale_1, format !is null ? format.id : null, | |
112 locale !is null ? locale.id : null); | |
113 return result !is null ? new NSString(result) : null; | |
114 } | |
115 | |
116 public NSString descriptionWithLocale (id locale) | |
117 { | |
118 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id : null); | |
119 return result !is null ? new NSString(result) : null; | |
120 } | |
121 | |
122 public NSInteger hourOfDay () | |
123 { | |
124 return OS.objc_msgSend(this.id, OS.sel_hourOfDay); | |
125 } | |
126 | |
127 public NSCalendarDate initWithString_ (NSString description) | |
128 { | |
129 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1, description !is null ? description.id : null); | |
130 return result !is null ? this : null; | |
131 } | |
132 | |
133 public NSCalendarDate initWithString_calendarFormat_ (NSString description, NSString format) | |
134 { | |
135 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1calendarFormat_1, description !is null ? description.id : null, | |
136 format !is null ? format.id : null); | |
137 return result !is null ? this : null; | |
138 } | |
139 | |
140 public NSCalendarDate initWithString_calendarFormat_locale_ (NSString description, NSString format, id locale) | |
141 { | |
142 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1calendarFormat_1locale_1, description !is null ? description.id : null, | |
143 format !is null ? format.id : null, locale !is null ? locale.id : null); | |
144 return result !is null ? this : null; | |
145 } | |
146 | |
147 public id initWithYear (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) | |
148 { | |
149 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithYear_1month_1day_1hour_1minute_1second_1timeZone_1, year, month, day, hour, minute, | |
150 second, aTimeZone !is null ? aTimeZone.id : null); | |
151 return result !is null ? new id(result) : null; | |
152 } | |
153 | |
154 public NSInteger minuteOfHour () | |
155 { | |
156 return OS.objc_msgSend(this.id, OS.sel_minuteOfHour); | |
157 } | |
158 | |
159 public NSInteger monthOfYear () | |
160 { | |
161 return OS.objc_msgSend(this.id, OS.sel_monthOfYear); | |
162 } | |
163 | |
164 public NSInteger secondOfMinute () | |
165 { | |
166 return OS.objc_msgSend(this.id, OS.sel_secondOfMinute); | |
167 } | |
168 | |
169 public void setCalendarFormat (NSString format) | |
170 { | |
171 OS.objc_msgSend(this.id, OS.sel_setCalendarFormat_1, format !is null ? format.id : null); | |
172 } | |
173 | |
174 public void setTimeZone (NSTimeZone aTimeZone) | |
175 { | |
176 OS.objc_msgSend(this.id, OS.sel_setTimeZone_1, aTimeZone !is null ? aTimeZone.id : null); | |
177 } | |
178 | |
179 public NSTimeZone timeZone () | |
180 { | |
181 objc.id result = OS.objc_msgSend(this.id, OS.sel_timeZone); | |
182 return result !is null ? new NSTimeZone(result) : null; | |
183 } | |
184 | |
185 public NSInteger yearOfCommonEra () | |
186 { | |
187 return OS.objc_msgSend(this.id, OS.sel_yearOfCommonEra); | |
188 } | |
189 | |
190 public void years (NSInteger* yp, NSInteger* mop, NSInteger* dp, NSInteger* hp, NSInteger* mip, NSInteger* sp, NSCalendarDate date) | |
191 { | |
192 OS.objc_msgSend(this.id, OS.sel_years_1months_1days_1hours_1minutes_1seconds_1sinceDate_1, yp, mop, dp, hp, mip, sp, | |
193 date !is null ? date.id : null); | |
194 } | |
195 | |
196 } |