1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module glib.Date;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import glib.TimeVal;
30 private import gtkc.glib;
31 public  import gtkc.glibtypes;
32 private import gtkd.Loader;
33 
34 
35 /**
36  * Represents a day between January 1, Year 1 and a few thousand years in
37  * the future. None of its members should be accessed directly.
38  * 
39  * If the #GDate-struct is obtained from g_date_new(), it will be safe
40  * to mutate but invalid and thus not safe for calendrical computations.
41  * 
42  * If it's declared on the stack, it will contain garbage so must be
43  * initialized with g_date_clear(). g_date_clear() makes the date invalid
44  * but sane. An invalid date doesn't represent a day, it's "empty." A date
45  * becomes valid after you set it to a Julian day or you set a day, month,
46  * and year.
47  */
48 public class Date
49 {
50 	/** the main Gtk struct */
51 	protected GDate* gDate;
52 	protected bool ownedRef;
53 
54 	/** Get the main Gtk struct */
55 	public GDate* getDateStruct(bool transferOwnership = false)
56 	{
57 		if (transferOwnership)
58 			ownedRef = false;
59 		return gDate;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected void* getStruct()
64 	{
65 		return cast(void*)gDate;
66 	}
67 
68 	/**
69 	 * Sets our main struct and passes it to the parent class.
70 	 */
71 	public this (GDate* gDate, bool ownedRef = false)
72 	{
73 		this.gDate = gDate;
74 		this.ownedRef = ownedRef;
75 	}
76 
77 	~this ()
78 	{
79 		if (  Linker.isLoaded(LIBRARY_GLIB) && ownedRef )
80 			g_date_free(gDate);
81 	}
82 
83 
84 	/**
85 	 * Allocates a #GDate and initializes
86 	 * it to a sane state. The new date will
87 	 * be cleared (as if you'd called g_date_clear()) but invalid (it won't
88 	 * represent an existing day). Free the return value with g_date_free().
89 	 *
90 	 * Returns: a newly-allocated #GDate
91 	 *
92 	 * Throws: ConstructionException GTK+ fails to create the object.
93 	 */
94 	public this()
95 	{
96 		auto p = g_date_new();
97 		
98 		if(p is null)
99 		{
100 			throw new ConstructionException("null returned by new");
101 		}
102 		
103 		this(cast(GDate*) p);
104 	}
105 
106 	/**
107 	 * Like g_date_new(), but also sets the value of the date. Assuming the
108 	 * day-month-year triplet you pass in represents an existing day, the
109 	 * returned date will be valid.
110 	 *
111 	 * Params:
112 	 *     day = day of the month
113 	 *     month = month of the year
114 	 *     year = year
115 	 *
116 	 * Returns: a newly-allocated #GDate initialized with @day, @month, and @year
117 	 *
118 	 * Throws: ConstructionException GTK+ fails to create the object.
119 	 */
120 	public this(GDateDay day, GDateMonth month, GDateYear year)
121 	{
122 		auto p = g_date_new_dmy(day, month, year);
123 		
124 		if(p is null)
125 		{
126 			throw new ConstructionException("null returned by new_dmy");
127 		}
128 		
129 		this(cast(GDate*) p);
130 	}
131 
132 	/**
133 	 * Like g_date_new(), but also sets the value of the date. Assuming the
134 	 * Julian day number you pass in is valid (greater than 0, less than an
135 	 * unreasonably large number), the returned date will be valid.
136 	 *
137 	 * Params:
138 	 *     julianDay = days since January 1, Year 1
139 	 *
140 	 * Returns: a newly-allocated #GDate initialized with @julian_day
141 	 *
142 	 * Throws: ConstructionException GTK+ fails to create the object.
143 	 */
144 	public this(uint julianDay)
145 	{
146 		auto p = g_date_new_julian(julianDay);
147 		
148 		if(p is null)
149 		{
150 			throw new ConstructionException("null returned by new_julian");
151 		}
152 		
153 		this(cast(GDate*) p);
154 	}
155 
156 	/**
157 	 * Increments a date some number of days.
158 	 * To move forward by weeks, add weeks*7 days.
159 	 * The date must be valid.
160 	 *
161 	 * Params:
162 	 *     nDays = number of days to move the date forward
163 	 */
164 	public void addDays(uint nDays)
165 	{
166 		g_date_add_days(gDate, nDays);
167 	}
168 
169 	/**
170 	 * Increments a date by some number of months.
171 	 * If the day of the month is greater than 28,
172 	 * this routine may change the day of the month
173 	 * (because the destination month may not have
174 	 * the current day in it). The date must be valid.
175 	 *
176 	 * Params:
177 	 *     nMonths = number of months to move forward
178 	 */
179 	public void addMonths(uint nMonths)
180 	{
181 		g_date_add_months(gDate, nMonths);
182 	}
183 
184 	/**
185 	 * Increments a date by some number of years.
186 	 * If the date is February 29, and the destination
187 	 * year is not a leap year, the date will be changed
188 	 * to February 28. The date must be valid.
189 	 *
190 	 * Params:
191 	 *     nYears = number of years to move forward
192 	 */
193 	public void addYears(uint nYears)
194 	{
195 		g_date_add_years(gDate, nYears);
196 	}
197 
198 	/**
199 	 * If @date is prior to @min_date, sets @date equal to @min_date.
200 	 * If @date falls after @max_date, sets @date equal to @max_date.
201 	 * Otherwise, @date is unchanged.
202 	 * Either of @min_date and @max_date may be %NULL.
203 	 * All non-%NULL dates must be valid.
204 	 *
205 	 * Params:
206 	 *     minDate = minimum accepted value for @date
207 	 *     maxDate = maximum accepted value for @date
208 	 */
209 	public void clamp(Date minDate, Date maxDate)
210 	{
211 		g_date_clamp(gDate, (minDate is null) ? null : minDate.getDateStruct(), (maxDate is null) ? null : maxDate.getDateStruct());
212 	}
213 
214 	/**
215 	 * Initializes one or more #GDate structs to a sane but invalid
216 	 * state. The cleared dates will not represent an existing date, but will
217 	 * not contain garbage. Useful to init a date declared on the stack.
218 	 * Validity can be tested with g_date_valid().
219 	 *
220 	 * Params:
221 	 *     nDates = number of dates to clear
222 	 */
223 	public void clear(uint nDates)
224 	{
225 		g_date_clear(gDate, nDates);
226 	}
227 
228 	/**
229 	 * qsort()-style comparison function for dates.
230 	 * Both dates must be valid.
231 	 *
232 	 * Params:
233 	 *     rhs = second date to compare
234 	 *
235 	 * Returns: 0 for equal, less than zero if @lhs is less than @rhs,
236 	 *     greater than zero if @lhs is greater than @rhs
237 	 */
238 	public int compare(Date rhs)
239 	{
240 		return g_date_compare(gDate, (rhs is null) ? null : rhs.getDateStruct());
241 	}
242 
243 	/**
244 	 * Computes the number of days between two dates.
245 	 * If @date2 is prior to @date1, the returned value is negative.
246 	 * Both dates must be valid.
247 	 *
248 	 * Params:
249 	 *     date2 = the second date
250 	 *
251 	 * Returns: the number of days between @date1 and @date2
252 	 */
253 	public int daysBetween(Date date2)
254 	{
255 		return g_date_days_between(gDate, (date2 is null) ? null : date2.getDateStruct());
256 	}
257 
258 	/**
259 	 * Frees a #GDate returned from g_date_new().
260 	 */
261 	public void free()
262 	{
263 		g_date_free(gDate);
264 		ownedRef = false;
265 	}
266 
267 	/**
268 	 * Returns the day of the month. The date must be valid.
269 	 *
270 	 * Returns: day of the month
271 	 */
272 	public GDateDay getDay()
273 	{
274 		return g_date_get_day(gDate);
275 	}
276 
277 	/**
278 	 * Returns the day of the year, where Jan 1 is the first day of the
279 	 * year. The date must be valid.
280 	 *
281 	 * Returns: day of the year
282 	 */
283 	public uint getDayOfYear()
284 	{
285 		return g_date_get_day_of_year(gDate);
286 	}
287 
288 	/**
289 	 * Returns the week of the year, where weeks are interpreted according
290 	 * to ISO 8601.
291 	 *
292 	 * Returns: ISO 8601 week number of the year.
293 	 *
294 	 * Since: 2.6
295 	 */
296 	public uint getIso8601WeekOfYear()
297 	{
298 		return g_date_get_iso8601_week_of_year(gDate);
299 	}
300 
301 	/**
302 	 * Returns the Julian day or "serial number" of the #GDate. The
303 	 * Julian day is simply the number of days since January 1, Year 1; i.e.,
304 	 * January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
305 	 * etc. The date must be valid.
306 	 *
307 	 * Returns: Julian day
308 	 */
309 	public uint getJulian()
310 	{
311 		return g_date_get_julian(gDate);
312 	}
313 
314 	/**
315 	 * Returns the week of the year, where weeks are understood to start on
316 	 * Monday. If the date is before the first Monday of the year, return 0.
317 	 * The date must be valid.
318 	 *
319 	 * Returns: week of the year
320 	 */
321 	public uint getMondayWeekOfYear()
322 	{
323 		return g_date_get_monday_week_of_year(gDate);
324 	}
325 
326 	/**
327 	 * Returns the month of the year. The date must be valid.
328 	 *
329 	 * Returns: month of the year as a #GDateMonth
330 	 */
331 	public GDateMonth getMonth()
332 	{
333 		return g_date_get_month(gDate);
334 	}
335 
336 	/**
337 	 * Returns the week of the year during which this date falls, if
338 	 * weeks are understood to begin on Sunday. The date must be valid.
339 	 * Can return 0 if the day is before the first Sunday of the year.
340 	 *
341 	 * Returns: week number
342 	 */
343 	public uint getSundayWeekOfYear()
344 	{
345 		return g_date_get_sunday_week_of_year(gDate);
346 	}
347 
348 	/**
349 	 * Returns the day of the week for a #GDate. The date must be valid.
350 	 *
351 	 * Returns: day of the week as a #GDateWeekday.
352 	 */
353 	public GDateWeekday getWeekday()
354 	{
355 		return g_date_get_weekday(gDate);
356 	}
357 
358 	/**
359 	 * Returns the year of a #GDate. The date must be valid.
360 	 *
361 	 * Returns: year in which the date falls
362 	 */
363 	public GDateYear getYear()
364 	{
365 		return g_date_get_year(gDate);
366 	}
367 
368 	/**
369 	 * Returns %TRUE if the date is on the first of a month.
370 	 * The date must be valid.
371 	 *
372 	 * Returns: %TRUE if the date is the first of the month
373 	 */
374 	public bool isFirstOfMonth()
375 	{
376 		return g_date_is_first_of_month(gDate) != 0;
377 	}
378 
379 	/**
380 	 * Returns %TRUE if the date is the last day of the month.
381 	 * The date must be valid.
382 	 *
383 	 * Returns: %TRUE if the date is the last day of the month
384 	 */
385 	public bool isLastOfMonth()
386 	{
387 		return g_date_is_last_of_month(gDate) != 0;
388 	}
389 
390 	/**
391 	 * Checks if @date1 is less than or equal to @date2,
392 	 * and swap the values if this is not the case.
393 	 *
394 	 * Params:
395 	 *     date2 = the second date
396 	 */
397 	public void order(Date date2)
398 	{
399 		g_date_order(gDate, (date2 is null) ? null : date2.getDateStruct());
400 	}
401 
402 	/**
403 	 * Sets the day of the month for a #GDate. If the resulting
404 	 * day-month-year triplet is invalid, the date will be invalid.
405 	 *
406 	 * Params:
407 	 *     day = day to set
408 	 */
409 	public void setDay(GDateDay day)
410 	{
411 		g_date_set_day(gDate, day);
412 	}
413 
414 	/**
415 	 * Sets the value of a #GDate from a day, month, and year.
416 	 * The day-month-year triplet must be valid; if you aren't
417 	 * sure it is, call g_date_valid_dmy() to check before you
418 	 * set it.
419 	 *
420 	 * Params:
421 	 *     day = day
422 	 *     month = month
423 	 *     y = year
424 	 */
425 	public void setDmy(GDateDay day, GDateMonth month, GDateYear y)
426 	{
427 		g_date_set_dmy(gDate, day, month, y);
428 	}
429 
430 	/**
431 	 * Sets the value of a #GDate from a Julian day number.
432 	 *
433 	 * Params:
434 	 *     julianDate = Julian day number (days since January 1, Year 1)
435 	 */
436 	public void setJulian(uint julianDate)
437 	{
438 		g_date_set_julian(gDate, julianDate);
439 	}
440 
441 	/**
442 	 * Sets the month of the year for a #GDate.  If the resulting
443 	 * day-month-year triplet is invalid, the date will be invalid.
444 	 *
445 	 * Params:
446 	 *     month = month to set
447 	 */
448 	public void setMonth(GDateMonth month)
449 	{
450 		g_date_set_month(gDate, month);
451 	}
452 
453 	/**
454 	 * Parses a user-inputted string @str, and try to figure out what date it
455 	 * represents, taking the [current locale][setlocale] into account. If the
456 	 * string is successfully parsed, the date will be valid after the call.
457 	 * Otherwise, it will be invalid. You should check using g_date_valid()
458 	 * to see whether the parsing succeeded.
459 	 *
460 	 * This function is not appropriate for file formats and the like; it
461 	 * isn't very precise, and its exact behavior varies with the locale.
462 	 * It's intended to be a heuristic routine that guesses what the user
463 	 * means by a given string (and it does work pretty well in that
464 	 * capacity).
465 	 *
466 	 * Params:
467 	 *     str = string to parse
468 	 */
469 	public void setParse(string str)
470 	{
471 		g_date_set_parse(gDate, Str.toStringz(str));
472 	}
473 
474 	/**
475 	 * Sets the value of a date from a #GTime value.
476 	 * The time to date conversion is done using the user's current timezone.
477 	 *
478 	 * Deprecated: Use g_date_set_time_t() instead.
479 	 *
480 	 * Params:
481 	 *     time = #GTime value to set.
482 	 */
483 	public void setTime(GTime time)
484 	{
485 		g_date_set_time(gDate, time);
486 	}
487 
488 	/**
489 	 * Sets the value of a date to the date corresponding to a time
490 	 * specified as a time_t. The time to date conversion is done using
491 	 * the user's current timezone.
492 	 *
493 	 * To set the value of a date to the current day, you could write:
494 	 * |[<!-- language="C" -->
495 	 * g_date_set_time_t (date, time (NULL));
496 	 * ]|
497 	 *
498 	 * Params:
499 	 *     timet = time_t value to set
500 	 *
501 	 * Since: 2.10
502 	 */
503 	public void setTimeT(uint timet)
504 	{
505 		g_date_set_time_t(gDate, timet);
506 	}
507 
508 	/**
509 	 * Sets the value of a date from a #GTimeVal value.  Note that the
510 	 * @tv_usec member is ignored, because #GDate can't make use of the
511 	 * additional precision.
512 	 *
513 	 * The time to date conversion is done using the user's current timezone.
514 	 *
515 	 * Params:
516 	 *     timeval = #GTimeVal value to set
517 	 *
518 	 * Since: 2.10
519 	 */
520 	public void setTimeVal(TimeVal timeval)
521 	{
522 		g_date_set_time_val(gDate, (timeval is null) ? null : timeval.getTimeValStruct());
523 	}
524 
525 	/**
526 	 * Sets the year for a #GDate. If the resulting day-month-year
527 	 * triplet is invalid, the date will be invalid.
528 	 *
529 	 * Params:
530 	 *     year = year to set
531 	 */
532 	public void setYear(GDateYear year)
533 	{
534 		g_date_set_year(gDate, year);
535 	}
536 
537 	/**
538 	 * Moves a date some number of days into the past.
539 	 * To move by weeks, just move by weeks*7 days.
540 	 * The date must be valid.
541 	 *
542 	 * Params:
543 	 *     nDays = number of days to move
544 	 */
545 	public void subtractDays(uint nDays)
546 	{
547 		g_date_subtract_days(gDate, nDays);
548 	}
549 
550 	/**
551 	 * Moves a date some number of months into the past.
552 	 * If the current day of the month doesn't exist in
553 	 * the destination month, the day of the month
554 	 * may change. The date must be valid.
555 	 *
556 	 * Params:
557 	 *     nMonths = number of months to move
558 	 */
559 	public void subtractMonths(uint nMonths)
560 	{
561 		g_date_subtract_months(gDate, nMonths);
562 	}
563 
564 	/**
565 	 * Moves a date some number of years into the past.
566 	 * If the current day doesn't exist in the destination
567 	 * year (i.e. it's February 29 and you move to a non-leap-year)
568 	 * then the day is changed to February 29. The date
569 	 * must be valid.
570 	 *
571 	 * Params:
572 	 *     nYears = number of years to move
573 	 */
574 	public void subtractYears(uint nYears)
575 	{
576 		g_date_subtract_years(gDate, nYears);
577 	}
578 
579 	/**
580 	 * Fills in the date-related bits of a struct tm using the @date value.
581 	 * Initializes the non-date parts with something sane but meaningless.
582 	 *
583 	 * Params:
584 	 *     tm = struct tm to fill
585 	 */
586 	public void toStructTm(void* tm)
587 	{
588 		g_date_to_struct_tm(gDate, tm);
589 	}
590 
591 	/**
592 	 * Returns %TRUE if the #GDate represents an existing day. The date must not
593 	 * contain garbage; it should have been initialized with g_date_clear()
594 	 * if it wasn't allocated by one of the g_date_new() variants.
595 	 *
596 	 * Returns: Whether the date is valid
597 	 */
598 	public bool valid()
599 	{
600 		return g_date_valid(gDate) != 0;
601 	}
602 
603 	/**
604 	 * Returns the number of days in a month, taking leap
605 	 * years into account.
606 	 *
607 	 * Params:
608 	 *     month = month
609 	 *     year = year
610 	 *
611 	 * Returns: number of days in @month during the @year
612 	 */
613 	public static ubyte getDaysInMonth(GDateMonth month, GDateYear year)
614 	{
615 		return g_date_get_days_in_month(month, year);
616 	}
617 
618 	/**
619 	 * Returns the number of weeks in the year, where weeks
620 	 * are taken to start on Monday. Will be 52 or 53. The
621 	 * date must be valid. (Years always have 52 7-day periods,
622 	 * plus 1 or 2 extra days depending on whether it's a leap
623 	 * year. This function is basically telling you how many
624 	 * Mondays are in the year, i.e. there are 53 Mondays if
625 	 * one of the extra days happens to be a Monday.)
626 	 *
627 	 * Params:
628 	 *     year = a year
629 	 *
630 	 * Returns: number of Mondays in the year
631 	 */
632 	public static ubyte getMondayWeeksInYear(GDateYear year)
633 	{
634 		return g_date_get_monday_weeks_in_year(year);
635 	}
636 
637 	/**
638 	 * Returns the number of weeks in the year, where weeks
639 	 * are taken to start on Sunday. Will be 52 or 53. The
640 	 * date must be valid. (Years always have 52 7-day periods,
641 	 * plus 1 or 2 extra days depending on whether it's a leap
642 	 * year. This function is basically telling you how many
643 	 * Sundays are in the year, i.e. there are 53 Sundays if
644 	 * one of the extra days happens to be a Sunday.)
645 	 *
646 	 * Params:
647 	 *     year = year to count weeks in
648 	 *
649 	 * Returns: the number of weeks in @year
650 	 */
651 	public static ubyte getSundayWeeksInYear(GDateYear year)
652 	{
653 		return g_date_get_sunday_weeks_in_year(year);
654 	}
655 
656 	/**
657 	 * Returns %TRUE if the year is a leap year.
658 	 *
659 	 * For the purposes of this function, leap year is every year
660 	 * divisible by 4 unless that year is divisible by 100. If it
661 	 * is divisible by 100 it would be a leap year only if that year
662 	 * is also divisible by 400.
663 	 *
664 	 * Params:
665 	 *     year = year to check
666 	 *
667 	 * Returns: %TRUE if the year is a leap year
668 	 */
669 	public static bool isLeapYear(GDateYear year)
670 	{
671 		return g_date_is_leap_year(year) != 0;
672 	}
673 
674 	/**
675 	 * Generates a printed representation of the date, in a
676 	 * [locale][setlocale]-specific way.
677 	 * Works just like the platform's C library strftime() function,
678 	 * but only accepts date-related formats; time-related formats
679 	 * give undefined results. Date must be valid. Unlike strftime()
680 	 * (which uses the locale encoding), works on a UTF-8 format
681 	 * string and stores a UTF-8 result.
682 	 *
683 	 * This function does not provide any conversion specifiers in
684 	 * addition to those implemented by the platform's C library.
685 	 * For example, don't expect that using g_date_strftime() would
686 	 * make the \%F provided by the C99 strftime() work on Windows
687 	 * where the C library only complies to C89.
688 	 *
689 	 * Params:
690 	 *     s = destination buffer
691 	 *     slen = buffer size
692 	 *     format = format string
693 	 *     date = valid #GDate
694 	 *
695 	 * Returns: number of characters written to the buffer, or 0 the buffer was too small
696 	 */
697 	public static size_t strftime(string s, size_t slen, string format, Date date)
698 	{
699 		return g_date_strftime(Str.toStringz(s), slen, Str.toStringz(format), (date is null) ? null : date.getDateStruct());
700 	}
701 
702 	/**
703 	 * Returns %TRUE if the day of the month is valid (a day is valid if it's
704 	 * between 1 and 31 inclusive).
705 	 *
706 	 * Params:
707 	 *     day = day to check
708 	 *
709 	 * Returns: %TRUE if the day is valid
710 	 */
711 	public static bool validDay(GDateDay day)
712 	{
713 		return g_date_valid_day(day) != 0;
714 	}
715 
716 	/**
717 	 * Returns %TRUE if the day-month-year triplet forms a valid, existing day
718 	 * in the range of days #GDate understands (Year 1 or later, no more than
719 	 * a few thousand years in the future).
720 	 *
721 	 * Params:
722 	 *     day = day
723 	 *     month = month
724 	 *     year = year
725 	 *
726 	 * Returns: %TRUE if the date is a valid one
727 	 */
728 	public static bool validDmy(GDateDay day, GDateMonth month, GDateYear year)
729 	{
730 		return g_date_valid_dmy(day, month, year) != 0;
731 	}
732 
733 	/**
734 	 * Returns %TRUE if the Julian day is valid. Anything greater than zero
735 	 * is basically a valid Julian, though there is a 32-bit limit.
736 	 *
737 	 * Params:
738 	 *     julianDate = Julian day to check
739 	 *
740 	 * Returns: %TRUE if the Julian day is valid
741 	 */
742 	public static bool validJulian(uint julianDate)
743 	{
744 		return g_date_valid_julian(julianDate) != 0;
745 	}
746 
747 	/**
748 	 * Returns %TRUE if the month value is valid. The 12 #GDateMonth
749 	 * enumeration values are the only valid months.
750 	 *
751 	 * Params:
752 	 *     month = month
753 	 *
754 	 * Returns: %TRUE if the month is valid
755 	 */
756 	public static bool validMonth(GDateMonth month)
757 	{
758 		return g_date_valid_month(month) != 0;
759 	}
760 
761 	/**
762 	 * Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
763 	 * values are the only valid weekdays.
764 	 *
765 	 * Params:
766 	 *     weekday = weekday
767 	 *
768 	 * Returns: %TRUE if the weekday is valid
769 	 */
770 	public static bool validWeekday(GDateWeekday weekday)
771 	{
772 		return g_date_valid_weekday(weekday) != 0;
773 	}
774 
775 	/**
776 	 * Returns %TRUE if the year is valid. Any year greater than 0 is valid,
777 	 * though there is a 16-bit limit to what #GDate will understand.
778 	 *
779 	 * Params:
780 	 *     year = year
781 	 *
782 	 * Returns: %TRUE if the year is valid
783 	 */
784 	public static bool validYear(GDateYear year)
785 	{
786 		return g_date_valid_year(year) != 0;
787 	}
788 }