1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// `GDate` is a struct for calendrical calculations.
15//
16// The `GDate` data structure represents a day between January 1, Year 1,
17// and sometime a few thousand years in the future (right now it will go
18// to the year 65535 or so, but [method@GLib.Date.set_parse] only parses up to the
19// year 8000 or so - just count on "a few thousand"). `GDate` is meant to
20// represent everyday dates, not astronomical dates or historical dates
21// or ISO timestamps or the like. It extrapolates the current Gregorian
22// calendar forward and backward in time; there is no attempt to change
23// the calendar to match time periods or locations. `GDate` does not store
24// time information; it represents a day.
25//
26// The `GDate` implementation has several nice features; it is only a
27// 64-bit struct, so storing large numbers of dates is very efficient. It
28// can keep both a Julian and day-month-year representation of the date,
29// since some calculations are much easier with one representation or the
30// other. A Julian representation is simply a count of days since some
31// fixed day in the past; for #GDate the fixed day is January 1, 1 AD.
32// ("Julian" dates in the #GDate API aren't really Julian dates in the
33// technical sense; technically, Julian dates count from the start of the
34// Julian period, Jan 1, 4713 BC).
35//
36// `GDate` is simple to use. First you need a "blank" date; you can get a
37// dynamically allocated date from [ctor@GLib.Date.new], or you can declare an
38// automatic variable or array and initialize it by calling [method@GLib.Date.clear].
39// A cleared date is safe; it's safe to call [method@GLib.Date.set_dmy] and the other
40// mutator functions to initialize the value of a cleared date. However, a cleared date
41// is initially invalid, meaning that it doesn't represent a day that exists.
42// It is undefined to call any of the date calculation routines on an invalid date.
43// If you obtain a date from a user or other unpredictable source, you should check
44// its validity with the [method@GLib.Date.valid] predicate. [method@GLib.Date.valid]
45// is also used to check for errors with [method@GLib.Date.set_parse] and other functions
46// that can fail. Dates can be invalidated by calling [method@GLib.Date.clear] again.
47//
48// It is very important to use the API to access the `GDate` struct. Often only the
49// day-month-year or only the Julian representation is valid. Sometimes neither is valid.
50// Use the API.
51//
52// GLib also features `GDateTime` which represents a precise time.
53type Date struct {
54 _ structs.HostLayout
55
56 JulianDays uint
57
58 Julian uint
59
60 Dmy uint
61
62 Day uint
63
64 Month uint
65
66 Year uint
67}
68
69var xDateGLibType func() types.GType
70
71func DateGLibType() types.GType {
72 return xDateGLibType()
73}
74
75func (x *Date) GoPointer() uintptr {
76 return uintptr(unsafe.Pointer(x))
77}
78
79var xNewDate func() *Date
80
81// Allocates a #GDate and initializes
82// it to a safe state. The new date will
83// be cleared (as if you'd called g_date_clear()) but invalid (it won't
84// represent an existing day). Free the return value with g_date_free().
85func NewDate() *Date {
86
87 cret := xNewDate()
88 return cret
89}
90
91var xNewDateDmy func(DateDay, DateMonth, DateYear) *Date
92
93// Create a new #GDate representing the given day-month-year triplet.
94//
95// The triplet you pass in must represent a valid date. Use g_date_valid_dmy()
96// if needed to validate it. The returned #GDate is guaranteed to be non-%NULL
97// and valid.
98func NewDateDmy(DayVar DateDay, MonthVar DateMonth, YearVar DateYear) *Date {
99
100 cret := xNewDateDmy(DayVar, MonthVar, YearVar)
101 return cret
102}
103
104var xNewDateJulian func(uint32) *Date
105
106// Create a new #GDate representing the given Julian date.
107//
108// The @julian_day you pass in must be valid. Use g_date_valid_julian() if
109// needed to validate it. The returned #GDate is guaranteed to be non-%NULL and
110// valid.
111func NewDateJulian(JulianDayVar uint32) *Date {
112
113 cret := xNewDateJulian(JulianDayVar)
114 return cret
115}
116
117var xDateAddDays func(uintptr, uint)
118
119// Increments a date some number of days.
120// To move forward by weeks, add weeks*7 days.
121// The date must be valid.
122func (x *Date) AddDays(NDaysVar uint) {
123
124 xDateAddDays(x.GoPointer(), NDaysVar)
125
126}
127
128var xDateAddMonths func(uintptr, uint)
129
130// Increments a date by some number of months.
131// If the day of the month is greater than 28,
132// this routine may change the day of the month
133// (because the destination month may not have
134// the current day in it). The date must be valid.
135func (x *Date) AddMonths(NMonthsVar uint) {
136
137 xDateAddMonths(x.GoPointer(), NMonthsVar)
138
139}
140
141var xDateAddYears func(uintptr, uint)
142
143// Increments a date by some number of years.
144// If the date is February 29, and the destination
145// year is not a leap year, the date will be changed
146// to February 28. The date must be valid.
147func (x *Date) AddYears(NYearsVar uint) {
148
149 xDateAddYears(x.GoPointer(), NYearsVar)
150
151}
152
153var xDateClamp func(uintptr, *Date, *Date)
154
155// If @date is prior to @min_date, sets @date equal to @min_date.
156// If @date falls after @max_date, sets @date equal to @max_date.
157// Otherwise, @date is unchanged.
158// Either of @min_date and @max_date may be %NULL.
159// All non-%NULL dates must be valid.
160func (x *Date) Clamp(MinDateVar *Date, MaxDateVar *Date) {
161
162 xDateClamp(x.GoPointer(), MinDateVar, MaxDateVar)
163
164}
165
166var xDateClear func(uintptr, uint)
167
168// Initializes one or more #GDate structs to a safe but invalid
169// state. The cleared dates will not represent an existing date, but will
170// not contain garbage. Useful to init a date declared on the stack.
171// Validity can be tested with g_date_valid().
172func (x *Date) Clear(NDatesVar uint) {
173
174 xDateClear(x.GoPointer(), NDatesVar)
175
176}
177
178var xDateCompare func(uintptr, *Date) int
179
180// qsort()-style comparison function for dates.
181// Both dates must be valid.
182func (x *Date) Compare(RhsVar *Date) int {
183
184 cret := xDateCompare(x.GoPointer(), RhsVar)
185 return cret
186}
187
188var xDateCopy func(uintptr) *Date
189
190// Copies a GDate to a newly-allocated GDate. If the input was invalid
191// (as determined by g_date_valid()), the invalid state will be copied
192// as is into the new object.
193func (x *Date) Copy() *Date {
194
195 cret := xDateCopy(x.GoPointer())
196 return cret
197}
198
199var xDateDaysBetween func(uintptr, *Date) int
200
201// Computes the number of days between two dates.
202// If @date2 is prior to @date1, the returned value is negative.
203// Both dates must be valid.
204func (x *Date) DaysBetween(Date2Var *Date) int {
205
206 cret := xDateDaysBetween(x.GoPointer(), Date2Var)
207 return cret
208}
209
210var xDateFree func(uintptr)
211
212// Frees a #GDate returned from g_date_new().
213func (x *Date) Free() {
214
215 xDateFree(x.GoPointer())
216
217}
218
219var xDateGetDay func(uintptr) DateDay
220
221// Returns the day of the month. The date must be valid.
222func (x *Date) GetDay() DateDay {
223
224 cret := xDateGetDay(x.GoPointer())
225 return cret
226}
227
228var xDateGetDayOfYear func(uintptr) uint
229
230// Returns the day of the year, where Jan 1 is the first day of the
231// year. The date must be valid.
232func (x *Date) GetDayOfYear() uint {
233
234 cret := xDateGetDayOfYear(x.GoPointer())
235 return cret
236}
237
238var xDateGetIso8601WeekOfYear func(uintptr) uint
239
240// Returns the week of the year, where weeks are interpreted according
241// to ISO 8601.
242func (x *Date) GetIso8601WeekOfYear() uint {
243
244 cret := xDateGetIso8601WeekOfYear(x.GoPointer())
245 return cret
246}
247
248var xDateGetJulian func(uintptr) uint32
249
250// Returns the Julian day or "serial number" of the #GDate. The
251// Julian day is simply the number of days since January 1, Year 1; i.e.,
252// January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
253// etc. The date must be valid.
254func (x *Date) GetJulian() uint32 {
255
256 cret := xDateGetJulian(x.GoPointer())
257 return cret
258}
259
260var xDateGetMondayWeekOfYear func(uintptr) uint
261
262// Returns the week of the year, where weeks are understood to start on
263// Monday. If the date is before the first Monday of the year, return 0.
264// The date must be valid.
265func (x *Date) GetMondayWeekOfYear() uint {
266
267 cret := xDateGetMondayWeekOfYear(x.GoPointer())
268 return cret
269}
270
271var xDateGetMonth func(uintptr) DateMonth
272
273// Returns the month of the year. The date must be valid.
274func (x *Date) GetMonth() DateMonth {
275
276 cret := xDateGetMonth(x.GoPointer())
277 return cret
278}
279
280var xDateGetSundayWeekOfYear func(uintptr) uint
281
282// Returns the week of the year during which this date falls, if
283// weeks are understood to begin on Sunday. The date must be valid.
284// Can return 0 if the day is before the first Sunday of the year.
285func (x *Date) GetSundayWeekOfYear() uint {
286
287 cret := xDateGetSundayWeekOfYear(x.GoPointer())
288 return cret
289}
290
291var xDateGetWeekOfYear func(uintptr, DateWeekday) uint
292
293// Calculates the week of the year during which this date falls.
294//
295// The result depends on which day is considered the first day of the week,
296// which varies by locale. Both `date` and `first_day_of_week` must be valid.
297//
298// If @date is before the start of the first week of the year (for example,
299// before the first Monday in January if @first_day_of_week is
300// [enum@GLib.DateWeekday.MONDAY]) then zero will be returned.
301func (x *Date) GetWeekOfYear(FirstDayOfWeekVar DateWeekday) uint {
302
303 cret := xDateGetWeekOfYear(x.GoPointer(), FirstDayOfWeekVar)
304 return cret
305}
306
307var xDateGetWeekday func(uintptr) DateWeekday
308
309// Returns the day of the week for a #GDate. The date must be valid.
310func (x *Date) GetWeekday() DateWeekday {
311
312 cret := xDateGetWeekday(x.GoPointer())
313 return cret
314}
315
316var xDateGetYear func(uintptr) DateYear
317
318// Returns the year of a #GDate. The date must be valid.
319func (x *Date) GetYear() DateYear {
320
321 cret := xDateGetYear(x.GoPointer())
322 return cret
323}
324
325var xDateIsFirstOfMonth func(uintptr) bool
326
327// Returns %TRUE if the date is on the first of a month.
328// The date must be valid.
329func (x *Date) IsFirstOfMonth() bool {
330
331 cret := xDateIsFirstOfMonth(x.GoPointer())
332 return cret
333}
334
335var xDateIsLastOfMonth func(uintptr) bool
336
337// Returns %TRUE if the date is the last day of the month.
338// The date must be valid.
339func (x *Date) IsLastOfMonth() bool {
340
341 cret := xDateIsLastOfMonth(x.GoPointer())
342 return cret
343}
344
345var xDateOrder func(uintptr, *Date)
346
347// Checks if @date1 is less than or equal to @date2,
348// and swap the values if this is not the case.
349func (x *Date) Order(Date2Var *Date) {
350
351 xDateOrder(x.GoPointer(), Date2Var)
352
353}
354
355var xDateSetDay func(uintptr, DateDay)
356
357// Sets the day of the month for a #GDate. If the resulting
358// day-month-year triplet is invalid, the date will be invalid.
359func (x *Date) SetDay(DayVar DateDay) {
360
361 xDateSetDay(x.GoPointer(), DayVar)
362
363}
364
365var xDateSetDmy func(uintptr, DateDay, DateMonth, DateYear)
366
367// Sets the value of a #GDate from a day, month, and year.
368// The day-month-year triplet must be valid; if you aren't
369// sure it is, call g_date_valid_dmy() to check before you
370// set it.
371func (x *Date) SetDmy(DayVar DateDay, MonthVar DateMonth, YVar DateYear) {
372
373 xDateSetDmy(x.GoPointer(), DayVar, MonthVar, YVar)
374
375}
376
377var xDateSetJulian func(uintptr, uint32)
378
379// Sets the value of a #GDate from a Julian day number.
380func (x *Date) SetJulian(JulianDateVar uint32) {
381
382 xDateSetJulian(x.GoPointer(), JulianDateVar)
383
384}
385
386var xDateSetMonth func(uintptr, DateMonth)
387
388// Sets the month of the year for a #GDate. If the resulting
389// day-month-year triplet is invalid, the date will be invalid.
390func (x *Date) SetMonth(MonthVar DateMonth) {
391
392 xDateSetMonth(x.GoPointer(), MonthVar)
393
394}
395
396var xDateSetParse func(uintptr, string)
397
398// Parses a user-inputted string @str, and try to figure out what date it
399// represents, taking the [current locale](running.html#locale)
400// into account. If the string is successfully parsed, the date will be
401// valid after the call. Otherwise, it will be invalid. You should check
402// using g_date_valid() to see whether the parsing succeeded.
403//
404// This function is not appropriate for file formats and the like; it
405// isn't very precise, and its exact behavior varies with the locale.
406// It's intended to be a heuristic routine that guesses what the user
407// means by a given string (and it does work pretty well in that
408// capacity).
409func (x *Date) SetParse(StrVar string) {
410
411 xDateSetParse(x.GoPointer(), StrVar)
412
413}
414
415var xDateSetTime func(uintptr, Time)
416
417// Sets the value of a date from a #GTime value.
418// The time to date conversion is done using the user's current timezone.
419func (x *Date) SetTime(TimeVar Time) {
420
421 xDateSetTime(x.GoPointer(), TimeVar)
422
423}
424
425var xDateSetTimeT func(uintptr, int)
426
427// Sets the value of a date to the date corresponding to a time
428// specified as a time_t. The time to date conversion is done using
429// the user's current timezone.
430//
431// To set the value of a date to the current day, you could write:
432// |[<!-- language="C" -->
433//
434// time_t now = time (NULL);
435// if (now == (time_t) -1)
436// // handle the error
437// g_date_set_time_t (date, now);
438//
439// ]|
440func (x *Date) SetTimeT(TimetVar int) {
441
442 xDateSetTimeT(x.GoPointer(), TimetVar)
443
444}
445
446var xDateSetTimeVal func(uintptr, *TimeVal)
447
448// Sets the value of a date from a #GTimeVal value. Note that the
449// @tv_usec member is ignored, because #GDate can't make use of the
450// additional precision.
451//
452// The time to date conversion is done using the user's current timezone.
453func (x *Date) SetTimeVal(TimevalVar *TimeVal) {
454
455 xDateSetTimeVal(x.GoPointer(), TimevalVar)
456
457}
458
459var xDateSetYear func(uintptr, DateYear)
460
461// Sets the year for a #GDate. If the resulting day-month-year
462// triplet is invalid, the date will be invalid.
463func (x *Date) SetYear(YearVar DateYear) {
464
465 xDateSetYear(x.GoPointer(), YearVar)
466
467}
468
469var xDateSubtractDays func(uintptr, uint)
470
471// Moves a date some number of days into the past.
472// To move by weeks, just move by weeks*7 days.
473// The date must be valid.
474func (x *Date) SubtractDays(NDaysVar uint) {
475
476 xDateSubtractDays(x.GoPointer(), NDaysVar)
477
478}
479
480var xDateSubtractMonths func(uintptr, uint)
481
482// Moves a date some number of months into the past.
483// If the current day of the month doesn't exist in
484// the destination month, the day of the month
485// may change. The date must be valid.
486func (x *Date) SubtractMonths(NMonthsVar uint) {
487
488 xDateSubtractMonths(x.GoPointer(), NMonthsVar)
489
490}
491
492var xDateSubtractYears func(uintptr, uint)
493
494// Moves a date some number of years into the past.
495// If the current day doesn't exist in the destination
496// year (i.e. it's February 29 and you move to a non-leap-year)
497// then the day is changed to February 29. The date
498// must be valid.
499func (x *Date) SubtractYears(NYearsVar uint) {
500
501 xDateSubtractYears(x.GoPointer(), NYearsVar)
502
503}
504
505var xDateToStructTm func(uintptr, uintptr)
506
507// Fills in the date-related bits of a struct tm using the @date value.
508// Initializes the non-date parts with something safe but meaningless.
509func (x *Date) ToStructTm(TmVar uintptr) {
510
511 xDateToStructTm(x.GoPointer(), TmVar)
512
513}
514
515var xDateValid func(uintptr) bool
516
517// Returns %TRUE if the #GDate represents an existing day. The date must not
518// contain garbage; it should have been initialized with g_date_clear()
519// if it wasn't allocated by one of the g_date_new() variants.
520func (x *Date) Valid() bool {
521
522 cret := xDateValid(x.GoPointer())
523 return cret
524}
525
526// Integer representing a day of the month; between 1 and 31.
527//
528// The %G_DATE_BAD_DAY value represents an invalid day of the month.
529type DateDay = byte
530
531// Integer type representing a year.
532//
533// The %G_DATE_BAD_YEAR value is the invalid value. The year
534// must be 1 or higher; negative ([BCE](https://en.wikipedia.org/wiki/Common_Era))
535// years are not allowed.
536//
537// The year is represented with four digits.
538type DateYear = uint16
539
540// Simply a replacement for `time_t`. It has been deprecated
541// since it is not equivalent to `time_t` on 64-bit platforms
542// with a 64-bit `time_t`.
543//
544// Unrelated to #GTimer.
545//
546// Note that #GTime is defined to always be a 32-bit integer,
547// unlike `time_t` which may be 64-bit on some systems. Therefore,
548// #GTime will overflow in the year 2038, and you cannot use the
549// address of a #GTime variable as argument to the UNIX time()
550// function.
551//
552// Instead, do the following:
553//
554// |[<!-- language="C" -->
555// time_t ttime;
556// GTime gtime;
557//
558// time (&ttime);
559// gtime = (GTime)ttime;
560// ]|
561type Time = int32
562
563const (
564 // Represents an invalid #GDateDay.
565 DATE_BAD_DAY int = 0
566 // Represents an invalid Julian day number.
567 DATE_BAD_JULIAN int = 0
568 // Represents an invalid year.
569 DATE_BAD_YEAR int = 0
570)
571
572// This enumeration isn't used in the API, but may be useful if you need
573// to mark a number as a day, month, or year.
574type DateDMY int
575
576const (
577
578 // a day
579 GDateDayValue DateDMY = 0
580 // a month
581 GDateMonthValue DateDMY = 1
582 // a year
583 GDateYearValue DateDMY = 2
584)
585
586// Enumeration representing a month; values are %G_DATE_JANUARY,
587// %G_DATE_FEBRUARY, etc. %G_DATE_BAD_MONTH is the invalid value.
588type DateMonth int
589
590const (
591
592 // invalid value
593 GDateBadMonthValue DateMonth = 0
594 // January
595 GDateJanuaryValue DateMonth = 1
596 // February
597 GDateFebruaryValue DateMonth = 2
598 // March
599 GDateMarchValue DateMonth = 3
600 // April
601 GDateAprilValue DateMonth = 4
602 // May
603 GDateMayValue DateMonth = 5
604 // June
605 GDateJuneValue DateMonth = 6
606 // July
607 GDateJulyValue DateMonth = 7
608 // August
609 GDateAugustValue DateMonth = 8
610 // September
611 GDateSeptemberValue DateMonth = 9
612 // October
613 GDateOctoberValue DateMonth = 10
614 // November
615 GDateNovemberValue DateMonth = 11
616 // December
617 GDateDecemberValue DateMonth = 12
618)
619
620// Enumeration representing a day of the week; %G_DATE_MONDAY,
621// %G_DATE_TUESDAY, etc. %G_DATE_BAD_WEEKDAY is an invalid weekday.
622type DateWeekday int
623
624const (
625
626 // invalid value
627 GDateBadWeekdayValue DateWeekday = 0
628 // Monday
629 GDateMondayValue DateWeekday = 1
630 // Tuesday
631 GDateTuesdayValue DateWeekday = 2
632 // Wednesday
633 GDateWednesdayValue DateWeekday = 3
634 // Thursday
635 GDateThursdayValue DateWeekday = 4
636 // Friday
637 GDateFridayValue DateWeekday = 5
638 // Saturday
639 GDateSaturdayValue DateWeekday = 6
640 // Sunday
641 GDateSundayValue DateWeekday = 7
642)
643
644var xDateGetDaysInMonth func(DateMonth, DateYear) byte
645
646// Returns the number of days in a month, taking leap
647// years into account.
648func DateGetDaysInMonth(MonthVar DateMonth, YearVar DateYear) byte {
649
650 cret := xDateGetDaysInMonth(MonthVar, YearVar)
651
652 return cret
653}
654
655var xDateGetMondayWeeksInYear func(DateYear) byte
656
657// Returns the number of weeks in the year, where weeks
658// are taken to start on Monday. Will be 52 or 53. The
659// date must be valid. (Years always have 52 7-day periods,
660// plus 1 or 2 extra days depending on whether it's a leap
661// year. This function is basically telling you how many
662// Mondays are in the year, i.e. there are 53 Mondays if
663// one of the extra days happens to be a Monday.)
664func DateGetMondayWeeksInYear(YearVar DateYear) byte {
665
666 cret := xDateGetMondayWeeksInYear(YearVar)
667
668 return cret
669}
670
671var xDateGetSundayWeeksInYear func(DateYear) byte
672
673// Returns the number of weeks in the year, where weeks
674// are taken to start on Sunday. Will be 52 or 53. The
675// date must be valid. (Years always have 52 7-day periods,
676// plus 1 or 2 extra days depending on whether it's a leap
677// year. This function is basically telling you how many
678// Sundays are in the year, i.e. there are 53 Sundays if
679// one of the extra days happens to be a Sunday.)
680func DateGetSundayWeeksInYear(YearVar DateYear) byte {
681
682 cret := xDateGetSundayWeeksInYear(YearVar)
683
684 return cret
685}
686
687var xDateGetWeeksInYear func(DateYear, DateWeekday) byte
688
689// Calculates the number of weeks in the year.
690//
691// The result depends on which day is considered the first day of the week,
692// which varies by locale. `first_day_of_week` must be valid.
693//
694// The result will be either 52 or 53. Years always have 52 seven-day periods,
695// plus one or two extra days depending on whether it’s a leap year. This
696// function effectively calculates how many @first_day_of_week days there are in
697// the year.
698func DateGetWeeksInYear(YearVar DateYear, FirstDayOfWeekVar DateWeekday) byte {
699
700 cret := xDateGetWeeksInYear(YearVar, FirstDayOfWeekVar)
701
702 return cret
703}
704
705var xDateIsLeapYear func(DateYear) bool
706
707// Returns %TRUE if the year is a leap year.
708//
709// For the purposes of this function, leap year is every year
710// divisible by 4 unless that year is divisible by 100. If it
711// is divisible by 100 it would be a leap year only if that year
712// is also divisible by 400.
713func DateIsLeapYear(YearVar DateYear) bool {
714
715 cret := xDateIsLeapYear(YearVar)
716
717 return cret
718}
719
720var xDateStrftime func(string, uint, string, *Date) uint
721
722// Generates a printed representation of the date, in a
723// [locale](running.html#locale)-specific way.
724// Works just like the platform's C library strftime() function,
725// but only accepts date-related formats; time-related formats
726// give undefined results. Date must be valid. Unlike strftime()
727// (which uses the locale encoding), works on a UTF-8 format
728// string and stores a UTF-8 result.
729//
730// This function does not provide any conversion specifiers in
731// addition to those implemented by the platform's C library.
732// For example, don't expect that using g_date_strftime() would
733// make the \%F provided by the C99 strftime() work on Windows
734// where the C library only complies to C89.
735func DateStrftime(SVar string, SlenVar uint, FormatVar string, DateVar *Date) uint {
736
737 cret := xDateStrftime(SVar, SlenVar, FormatVar, DateVar)
738
739 return cret
740}
741
742var xDateValidDay func(DateDay) bool
743
744// Returns %TRUE if the day of the month is valid (a day is valid if it's
745// between 1 and 31 inclusive).
746func DateValidDay(DayVar DateDay) bool {
747
748 cret := xDateValidDay(DayVar)
749
750 return cret
751}
752
753var xDateValidDmy func(DateDay, DateMonth, DateYear) bool
754
755// Returns %TRUE if the day-month-year triplet forms a valid, existing day
756// in the range of days #GDate understands (Year 1 or later, no more than
757// a few thousand years in the future).
758func DateValidDmy(DayVar DateDay, MonthVar DateMonth, YearVar DateYear) bool {
759
760 cret := xDateValidDmy(DayVar, MonthVar, YearVar)
761
762 return cret
763}
764
765var xDateValidJulian func(uint32) bool
766
767// Returns %TRUE if the Julian day is valid. Anything greater than zero
768// is basically a valid Julian, though there is a 32-bit limit.
769func DateValidJulian(JulianDateVar uint32) bool {
770
771 cret := xDateValidJulian(JulianDateVar)
772
773 return cret
774}
775
776var xDateValidMonth func(DateMonth) bool
777
778// Returns %TRUE if the month value is valid. The 12 #GDateMonth
779// enumeration values are the only valid months.
780func DateValidMonth(MonthVar DateMonth) bool {
781
782 cret := xDateValidMonth(MonthVar)
783
784 return cret
785}
786
787var xDateValidWeekday func(DateWeekday) bool
788
789// Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
790// values are the only valid weekdays.
791func DateValidWeekday(WeekdayVar DateWeekday) bool {
792
793 cret := xDateValidWeekday(WeekdayVar)
794
795 return cret
796}
797
798var xDateValidYear func(DateYear) bool
799
800// Returns %TRUE if the year is valid. Any year greater than 0 is valid,
801// though there is a 16-bit limit to what #GDate will understand.
802func DateValidYear(YearVar DateYear) bool {
803
804 cret := xDateValidYear(YearVar)
805
806 return cret
807}
808
809func init() {
810 core.SetPackageName("GLIB", "glib-2.0")
811 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
812 var libs []uintptr
813 for _, libPath := range core.GetPaths("GLIB") {
814 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
815 if err != nil {
816 panic(err)
817 }
818 libs = append(libs, lib)
819 }
820
821 core.PuregoSafeRegister(&xDateGetDaysInMonth, libs, "g_date_get_days_in_month")
822 core.PuregoSafeRegister(&xDateGetMondayWeeksInYear, libs, "g_date_get_monday_weeks_in_year")
823 core.PuregoSafeRegister(&xDateGetSundayWeeksInYear, libs, "g_date_get_sunday_weeks_in_year")
824 core.PuregoSafeRegister(&xDateGetWeeksInYear, libs, "g_date_get_weeks_in_year")
825 core.PuregoSafeRegister(&xDateIsLeapYear, libs, "g_date_is_leap_year")
826 core.PuregoSafeRegister(&xDateStrftime, libs, "g_date_strftime")
827 core.PuregoSafeRegister(&xDateValidDay, libs, "g_date_valid_day")
828 core.PuregoSafeRegister(&xDateValidDmy, libs, "g_date_valid_dmy")
829 core.PuregoSafeRegister(&xDateValidJulian, libs, "g_date_valid_julian")
830 core.PuregoSafeRegister(&xDateValidMonth, libs, "g_date_valid_month")
831 core.PuregoSafeRegister(&xDateValidWeekday, libs, "g_date_valid_weekday")
832 core.PuregoSafeRegister(&xDateValidYear, libs, "g_date_valid_year")
833
834 core.PuregoSafeRegister(&xDateGLibType, libs, "g_date_get_type")
835
836 core.PuregoSafeRegister(&xNewDate, libs, "g_date_new")
837 core.PuregoSafeRegister(&xNewDateDmy, libs, "g_date_new_dmy")
838 core.PuregoSafeRegister(&xNewDateJulian, libs, "g_date_new_julian")
839
840 core.PuregoSafeRegister(&xDateAddDays, libs, "g_date_add_days")
841 core.PuregoSafeRegister(&xDateAddMonths, libs, "g_date_add_months")
842 core.PuregoSafeRegister(&xDateAddYears, libs, "g_date_add_years")
843 core.PuregoSafeRegister(&xDateClamp, libs, "g_date_clamp")
844 core.PuregoSafeRegister(&xDateClear, libs, "g_date_clear")
845 core.PuregoSafeRegister(&xDateCompare, libs, "g_date_compare")
846 core.PuregoSafeRegister(&xDateCopy, libs, "g_date_copy")
847 core.PuregoSafeRegister(&xDateDaysBetween, libs, "g_date_days_between")
848 core.PuregoSafeRegister(&xDateFree, libs, "g_date_free")
849 core.PuregoSafeRegister(&xDateGetDay, libs, "g_date_get_day")
850 core.PuregoSafeRegister(&xDateGetDayOfYear, libs, "g_date_get_day_of_year")
851 core.PuregoSafeRegister(&xDateGetIso8601WeekOfYear, libs, "g_date_get_iso8601_week_of_year")
852 core.PuregoSafeRegister(&xDateGetJulian, libs, "g_date_get_julian")
853 core.PuregoSafeRegister(&xDateGetMondayWeekOfYear, libs, "g_date_get_monday_week_of_year")
854 core.PuregoSafeRegister(&xDateGetMonth, libs, "g_date_get_month")
855 core.PuregoSafeRegister(&xDateGetSundayWeekOfYear, libs, "g_date_get_sunday_week_of_year")
856 core.PuregoSafeRegister(&xDateGetWeekOfYear, libs, "g_date_get_week_of_year")
857 core.PuregoSafeRegister(&xDateGetWeekday, libs, "g_date_get_weekday")
858 core.PuregoSafeRegister(&xDateGetYear, libs, "g_date_get_year")
859 core.PuregoSafeRegister(&xDateIsFirstOfMonth, libs, "g_date_is_first_of_month")
860 core.PuregoSafeRegister(&xDateIsLastOfMonth, libs, "g_date_is_last_of_month")
861 core.PuregoSafeRegister(&xDateOrder, libs, "g_date_order")
862 core.PuregoSafeRegister(&xDateSetDay, libs, "g_date_set_day")
863 core.PuregoSafeRegister(&xDateSetDmy, libs, "g_date_set_dmy")
864 core.PuregoSafeRegister(&xDateSetJulian, libs, "g_date_set_julian")
865 core.PuregoSafeRegister(&xDateSetMonth, libs, "g_date_set_month")
866 core.PuregoSafeRegister(&xDateSetParse, libs, "g_date_set_parse")
867 core.PuregoSafeRegister(&xDateSetTime, libs, "g_date_set_time")
868 core.PuregoSafeRegister(&xDateSetTimeT, libs, "g_date_set_time_t")
869 core.PuregoSafeRegister(&xDateSetTimeVal, libs, "g_date_set_time_val")
870 core.PuregoSafeRegister(&xDateSetYear, libs, "g_date_set_year")
871 core.PuregoSafeRegister(&xDateSubtractDays, libs, "g_date_subtract_days")
872 core.PuregoSafeRegister(&xDateSubtractMonths, libs, "g_date_subtract_months")
873 core.PuregoSafeRegister(&xDateSubtractYears, libs, "g_date_subtract_years")
874 core.PuregoSafeRegister(&xDateToStructTm, libs, "g_date_to_struct_tm")
875 core.PuregoSafeRegister(&xDateValid, libs, "g_date_valid")
876
877}