512 lines
16 KiB
C#
512 lines
16 KiB
C#
// This file was generated by the Gtk# code generator.
|
|
// Any changes made will be lost if regenerated.
|
|
|
|
namespace GLib {
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
|
|
#region Autogenerated code
|
|
public partial class DateTime : GLib.Opaque {
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_get_type();
|
|
|
|
public static GLib.GType GType {
|
|
get {
|
|
IntPtr raw_ret = g_date_time_get_type();
|
|
GLib.GType ret = new GLib.GType(raw_ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add(IntPtr raw, long timespan);
|
|
|
|
public GLib.DateTime Add(long timespan) {
|
|
IntPtr raw_ret = g_date_time_add(Handle, timespan);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_days(IntPtr raw, int days);
|
|
|
|
public GLib.DateTime AddDays(int days) {
|
|
IntPtr raw_ret = g_date_time_add_days(Handle, days);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_full(IntPtr raw, int years, int months, int days, int hours, int minutes, double seconds);
|
|
|
|
public GLib.DateTime AddFull(int years, int months, int days, int hours, int minutes, double seconds) {
|
|
IntPtr raw_ret = g_date_time_add_full(Handle, years, months, days, hours, minutes, seconds);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_hours(IntPtr raw, int hours);
|
|
|
|
public GLib.DateTime AddHours(int hours) {
|
|
IntPtr raw_ret = g_date_time_add_hours(Handle, hours);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_minutes(IntPtr raw, int minutes);
|
|
|
|
public GLib.DateTime AddMinutes(int minutes) {
|
|
IntPtr raw_ret = g_date_time_add_minutes(Handle, minutes);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_months(IntPtr raw, int months);
|
|
|
|
public GLib.DateTime AddMonths(int months) {
|
|
IntPtr raw_ret = g_date_time_add_months(Handle, months);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_seconds(IntPtr raw, double seconds);
|
|
|
|
public GLib.DateTime AddSeconds(double seconds) {
|
|
IntPtr raw_ret = g_date_time_add_seconds(Handle, seconds);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_weeks(IntPtr raw, int weeks);
|
|
|
|
public GLib.DateTime AddWeeks(int weeks) {
|
|
IntPtr raw_ret = g_date_time_add_weeks(Handle, weeks);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_add_years(IntPtr raw, int years);
|
|
|
|
public GLib.DateTime AddYears(int years) {
|
|
IntPtr raw_ret = g_date_time_add_years(Handle, years);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern long g_date_time_difference(IntPtr raw, IntPtr begin);
|
|
|
|
public long Difference(GLib.DateTime begin) {
|
|
long raw_ret = g_date_time_difference(Handle, begin == null ? IntPtr.Zero : begin.Handle);
|
|
long ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_format(IntPtr raw, IntPtr format);
|
|
|
|
public string Format(string format) {
|
|
IntPtr native_format = GLib.Marshaller.StringToPtrGStrdup (format);
|
|
IntPtr raw_ret = g_date_time_format(Handle, native_format);
|
|
string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
|
|
GLib.Marshaller.Free (native_format);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_day_of_month(IntPtr raw);
|
|
|
|
public int DayOfMonth {
|
|
get {
|
|
int raw_ret = g_date_time_get_day_of_month(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_day_of_week(IntPtr raw);
|
|
|
|
public int DayOfWeek {
|
|
get {
|
|
int raw_ret = g_date_time_get_day_of_week(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_day_of_year(IntPtr raw);
|
|
|
|
public int DayOfYear {
|
|
get {
|
|
int raw_ret = g_date_time_get_day_of_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_hour(IntPtr raw);
|
|
|
|
public int Hour {
|
|
get {
|
|
int raw_ret = g_date_time_get_hour(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_microsecond(IntPtr raw);
|
|
|
|
public int Microsecond {
|
|
get {
|
|
int raw_ret = g_date_time_get_microsecond(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_minute(IntPtr raw);
|
|
|
|
public int Minute {
|
|
get {
|
|
int raw_ret = g_date_time_get_minute(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_month(IntPtr raw);
|
|
|
|
public int Month {
|
|
get {
|
|
int raw_ret = g_date_time_get_month(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_second(IntPtr raw);
|
|
|
|
public int Second {
|
|
get {
|
|
int raw_ret = g_date_time_get_second(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern double g_date_time_get_seconds(IntPtr raw);
|
|
|
|
public double Seconds {
|
|
get {
|
|
double raw_ret = g_date_time_get_seconds(Handle);
|
|
double ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_get_timezone_abbreviation(IntPtr raw);
|
|
|
|
public string TimezoneAbbreviation {
|
|
get {
|
|
IntPtr raw_ret = g_date_time_get_timezone_abbreviation(Handle);
|
|
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern long g_date_time_get_utc_offset(IntPtr raw);
|
|
|
|
public long UtcOffset {
|
|
get {
|
|
long raw_ret = g_date_time_get_utc_offset(Handle);
|
|
long ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_week_numbering_year(IntPtr raw);
|
|
|
|
public int WeekNumberingYear {
|
|
get {
|
|
int raw_ret = g_date_time_get_week_numbering_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_week_of_year(IntPtr raw);
|
|
|
|
public int WeekOfYear {
|
|
get {
|
|
int raw_ret = g_date_time_get_week_of_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_get_year(IntPtr raw);
|
|
|
|
public int Year {
|
|
get {
|
|
int raw_ret = g_date_time_get_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern void g_date_time_get_ymd(IntPtr raw, out int year, out int month, out int day);
|
|
|
|
public void GetYmd(out int year, out int month, out int day) {
|
|
g_date_time_get_ymd(Handle, out year, out month, out day);
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern bool g_date_time_is_daylight_savings(IntPtr raw);
|
|
|
|
public bool IsDaylightSavings {
|
|
get {
|
|
bool raw_ret = g_date_time_is_daylight_savings(Handle);
|
|
bool ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_to_local(IntPtr raw);
|
|
|
|
public GLib.DateTime ToLocal() {
|
|
IntPtr raw_ret = g_date_time_to_local(Handle);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern bool g_date_time_to_timeval(IntPtr raw, IntPtr tv);
|
|
|
|
public bool ToTimeval(GLib.TimeVal tv) {
|
|
IntPtr native_tv = GLib.Marshaller.StructureToPtrAlloc (tv);
|
|
bool raw_ret = g_date_time_to_timeval(Handle, native_tv);
|
|
bool ret = raw_ret;
|
|
tv = GLib.TimeVal.New (native_tv);
|
|
Marshal.FreeHGlobal (native_tv);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_to_timezone(IntPtr raw, IntPtr tz);
|
|
|
|
public GLib.DateTime ToTimezone(GLib.TimeZone tz) {
|
|
IntPtr raw_ret = g_date_time_to_timezone(Handle, tz == null ? IntPtr.Zero : tz.Handle);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern long g_date_time_to_unix(IntPtr raw);
|
|
|
|
public long ToUnix() {
|
|
long raw_ret = g_date_time_to_unix(Handle);
|
|
long ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_to_utc(IntPtr raw);
|
|
|
|
public GLib.DateTime ToUtc() {
|
|
IntPtr raw_ret = g_date_time_to_utc(Handle);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern int g_date_time_compare(IntPtr dt1, IntPtr dt2);
|
|
|
|
public static int Compare(IntPtr dt1, IntPtr dt2) {
|
|
int raw_ret = g_date_time_compare(dt1, dt2);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern bool g_date_time_equal(IntPtr dt1, IntPtr dt2);
|
|
|
|
public static bool Equal(IntPtr dt1, IntPtr dt2) {
|
|
bool raw_ret = g_date_time_equal(dt1, dt2);
|
|
bool ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern uint g_date_time_hash(IntPtr datetime);
|
|
|
|
public static uint Hash(IntPtr datetime) {
|
|
uint raw_ret = g_date_time_hash(datetime);
|
|
uint ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
public DateTime(IntPtr raw) : base(raw) {}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new(IntPtr tz, int year, int month, int day, int hour, int minute, double seconds);
|
|
|
|
public DateTime (GLib.TimeZone tz, int year, int month, int day, int hour, int minute, double seconds)
|
|
{
|
|
Raw = g_date_time_new(tz == null ? IntPtr.Zero : tz.Handle, year, month, day, hour, minute, seconds);
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_from_timeval_local(IntPtr tv);
|
|
|
|
public DateTime (GLib.TimeVal tv)
|
|
{
|
|
IntPtr native_tv = GLib.Marshaller.StructureToPtrAlloc (tv);
|
|
Raw = g_date_time_new_from_timeval_local(native_tv);
|
|
tv = GLib.TimeVal.New (native_tv);
|
|
Marshal.FreeHGlobal (native_tv);
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_from_timeval_utc(IntPtr tv);
|
|
|
|
public static DateTime NewFromTimevalUtc(GLib.TimeVal tv)
|
|
{
|
|
IntPtr native_tv = GLib.Marshaller.StructureToPtrAlloc (tv);
|
|
DateTime result = new DateTime (g_date_time_new_from_timeval_utc(native_tv));
|
|
tv = GLib.TimeVal.New (native_tv);
|
|
Marshal.FreeHGlobal (native_tv);
|
|
return result;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_from_unix_local(long t);
|
|
|
|
public DateTime (long t)
|
|
{
|
|
Raw = g_date_time_new_from_unix_local(t);
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_from_unix_utc(long t);
|
|
|
|
public static DateTime NewFromUnixUtc(long t)
|
|
{
|
|
DateTime result = new DateTime (g_date_time_new_from_unix_utc(t));
|
|
return result;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_local(int year, int month, int day, int hour, int minute, double seconds);
|
|
|
|
public DateTime (int year, int month, int day, int hour, int minute, double seconds)
|
|
{
|
|
Raw = g_date_time_new_local(year, month, day, hour, minute, seconds);
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_now(IntPtr tz);
|
|
|
|
public DateTime (GLib.TimeZone tz)
|
|
{
|
|
Raw = g_date_time_new_now(tz == null ? IntPtr.Zero : tz.Handle);
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_now_local();
|
|
|
|
public DateTime ()
|
|
{
|
|
Raw = g_date_time_new_now_local();
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_now_utc();
|
|
|
|
public static DateTime NewNowUtc()
|
|
{
|
|
DateTime result = new DateTime (g_date_time_new_now_utc());
|
|
return result;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_new_utc(int year, int month, int day, int hour, int minute, double seconds);
|
|
|
|
public static DateTime NewUtc(int year, int month, int day, int hour, int minute, double seconds)
|
|
{
|
|
DateTime result = new DateTime (g_date_time_new_utc(year, month, day, hour, minute, seconds));
|
|
return result;
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr g_date_time_ref(IntPtr raw);
|
|
|
|
protected override void Ref (IntPtr raw)
|
|
{
|
|
if (!Owned) {
|
|
g_date_time_ref (raw);
|
|
Owned = true;
|
|
}
|
|
}
|
|
|
|
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
static extern void g_date_time_unref(IntPtr raw);
|
|
|
|
protected override void Unref (IntPtr raw)
|
|
{
|
|
if (Owned) {
|
|
g_date_time_unref (raw);
|
|
Owned = false;
|
|
}
|
|
}
|
|
|
|
class FinalizerInfo {
|
|
IntPtr handle;
|
|
|
|
public FinalizerInfo (IntPtr handle)
|
|
{
|
|
this.handle = handle;
|
|
}
|
|
|
|
public bool Handler ()
|
|
{
|
|
g_date_time_unref (handle);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
~DateTime ()
|
|
{
|
|
if (!Owned)
|
|
return;
|
|
FinalizerInfo info = new FinalizerInfo (Handle);
|
|
GLib.Timeout.Add (50, new GLib.TimeoutHandler (info.Handler));
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|