mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
glib: add GDate, GDateTime
Add GDate and GDateTime classes to glib, and map them in the generator's SymbolTable. (The types TimeZone and TimeVal are also added because the Date* types depend on them, but there is no need to map them in the generator.) Also move the TODOs of other auto-generated classes to a single TODO in the Makefile
This commit is contained in:
parent
aaa41cd095
commit
9abde602ec
@ -130,6 +130,8 @@ namespace GtkSharp.Generation {
|
||||
AddType (new ManualGen ("GMutex", "GLib.Mutex"));
|
||||
AddType (new ManualGen ("GRecMutex", "GLib.RecMutex"));
|
||||
AddType (new ManualGen ("GCond", "GLib.Cond"));
|
||||
AddType (new ManualGen ("GDateTime", "GLib.DateTime"));
|
||||
AddType (new ManualGen ("GDate", "GLib.Date"));
|
||||
AddType (new MarshalGen ("gunichar", "char", "uint", "GLib.Marshaller.CharToGUnichar ({0})", "GLib.Marshaller.GUnicharToChar ({0})"));
|
||||
AddType (new MarshalGen ("time_t", "System.DateTime", "IntPtr", "GLib.Marshaller.DateTimeTotime_t ({0})", "GLib.Marshaller.time_tToDateTime ({0})"));
|
||||
AddType (new MarshalGen ("GString", "string", "IntPtr", "new GLib.GString ({0}).Handle", "GLib.GString.PtrToString ({0})"));
|
||||
@ -138,7 +140,6 @@ namespace GtkSharp.Generation {
|
||||
AddType (new SimpleGen ("GDestroyNotify", "GLib.DestroyNotify", "null"));
|
||||
AddType (new SimpleGen ("GThread", "GLib.Thread", "null"));
|
||||
|
||||
|
||||
// FIXME: These ought to be handled properly.
|
||||
AddType (new SimpleGen ("GC", "IntPtr", "IntPtr.Zero"));
|
||||
AddType (new SimpleGen ("GError", "IntPtr", "IntPtr.Zero"));
|
||||
|
@ -1,8 +1,6 @@
|
||||
// This file was generated by the Gtk# code generator.
|
||||
// Any changes made will be lost if regenerated.
|
||||
|
||||
// TODO: generate this as part of the build instead of committing it to the repo
|
||||
|
||||
namespace GLib {
|
||||
|
||||
using System;
|
||||
|
478
glib/Date.cs
Normal file
478
glib/Date.cs
Normal file
@ -0,0 +1,478 @@
|
||||
// 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 Date : GLib.Opaque {
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_date_get_type();
|
||||
|
||||
public static GLib.GType GType {
|
||||
get {
|
||||
IntPtr raw_ret = g_date_get_type();
|
||||
GLib.GType ret = new GLib.GType(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_add_days(IntPtr raw, uint n_days);
|
||||
|
||||
public void AddDays(uint n_days) {
|
||||
g_date_add_days(Handle, n_days);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_add_months(IntPtr raw, uint n_months);
|
||||
|
||||
public void AddMonths(uint n_months) {
|
||||
g_date_add_months(Handle, n_months);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_add_years(IntPtr raw, uint n_years);
|
||||
|
||||
public void AddYears(uint n_years) {
|
||||
g_date_add_years(Handle, n_years);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_clamp(IntPtr raw, IntPtr min_date, IntPtr max_date);
|
||||
|
||||
public void Clamp(GLib.Date min_date, GLib.Date max_date) {
|
||||
g_date_clamp(Handle, min_date == null ? IntPtr.Zero : min_date.Handle, max_date == null ? IntPtr.Zero : max_date.Handle);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_clear(IntPtr raw, uint n_dates);
|
||||
|
||||
public void Clear(uint n_dates) {
|
||||
g_date_clear(Handle, n_dates);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_date_compare(IntPtr raw, IntPtr rhs);
|
||||
|
||||
public int Compare(GLib.Date rhs) {
|
||||
int raw_ret = g_date_compare(Handle, rhs == null ? IntPtr.Zero : rhs.Handle);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_date_days_between(IntPtr raw, IntPtr date2);
|
||||
|
||||
public int DaysBetween(GLib.Date date2) {
|
||||
int raw_ret = g_date_days_between(Handle, date2 == null ? IntPtr.Zero : date2.Handle);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern byte g_date_get_day(IntPtr raw);
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_day(IntPtr raw, byte day);
|
||||
|
||||
public byte Day {
|
||||
get {
|
||||
byte raw_ret = g_date_get_day(Handle);
|
||||
byte ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
g_date_set_day(Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern uint g_date_get_day_of_year(IntPtr raw);
|
||||
|
||||
public uint DayOfYear {
|
||||
get {
|
||||
uint raw_ret = g_date_get_day_of_year(Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern uint g_date_get_iso8601_week_of_year(IntPtr raw);
|
||||
|
||||
public uint Iso8601WeekOfYear {
|
||||
get {
|
||||
uint raw_ret = g_date_get_iso8601_week_of_year(Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern uint g_date_get_julian(IntPtr raw);
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_julian(IntPtr raw, uint julian_date);
|
||||
|
||||
public uint Julian {
|
||||
get {
|
||||
uint raw_ret = g_date_get_julian(Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
g_date_set_julian(Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern uint g_date_get_monday_week_of_year(IntPtr raw);
|
||||
|
||||
public uint MondayWeekOfYear {
|
||||
get {
|
||||
uint raw_ret = g_date_get_monday_week_of_year(Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_date_get_month(IntPtr raw);
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_month(IntPtr raw, int month);
|
||||
|
||||
public int Month {
|
||||
get {
|
||||
int raw_ret = g_date_get_month(Handle);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
g_date_set_month(Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern uint g_date_get_sunday_week_of_year(IntPtr raw);
|
||||
|
||||
public uint SundayWeekOfYear {
|
||||
get {
|
||||
uint raw_ret = g_date_get_sunday_week_of_year(Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_date_get_weekday(IntPtr raw);
|
||||
|
||||
public int Weekday {
|
||||
get {
|
||||
int raw_ret = g_date_get_weekday(Handle);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern ushort g_date_get_year(IntPtr raw);
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_year(IntPtr raw, ushort year);
|
||||
|
||||
public ushort Year {
|
||||
get {
|
||||
ushort raw_ret = g_date_get_year(Handle);
|
||||
ushort ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
g_date_set_year(Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_is_first_of_month(IntPtr raw);
|
||||
|
||||
public bool IsFirstOfMonth {
|
||||
get {
|
||||
bool raw_ret = g_date_is_first_of_month(Handle);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_is_last_of_month(IntPtr raw);
|
||||
|
||||
public bool IsLastOfMonth {
|
||||
get {
|
||||
bool raw_ret = g_date_is_last_of_month(Handle);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_order(IntPtr raw, IntPtr date2);
|
||||
|
||||
public void Order(GLib.Date date2) {
|
||||
g_date_order(Handle, date2 == null ? IntPtr.Zero : date2.Handle);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_dmy(IntPtr raw, byte day, int month, ushort y);
|
||||
|
||||
public void SetDmy(byte day, int month, ushort y) {
|
||||
g_date_set_dmy(Handle, day, month, y);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_parse(IntPtr raw, IntPtr str);
|
||||
|
||||
public string Parse {
|
||||
set {
|
||||
IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
|
||||
g_date_set_parse(Handle, native_value);
|
||||
GLib.Marshaller.Free (native_value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_time(IntPtr raw, int time_);
|
||||
|
||||
[Obsolete]
|
||||
public int Time {
|
||||
set {
|
||||
g_date_set_time(Handle, value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_time_t(IntPtr raw, IntPtr timet);
|
||||
|
||||
public long TimeT {
|
||||
set {
|
||||
g_date_set_time_t(Handle, new IntPtr (value));
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_set_time_val(IntPtr raw, IntPtr value);
|
||||
|
||||
public GLib.TimeVal TimeVal {
|
||||
set {
|
||||
IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
|
||||
g_date_set_time_val(Handle, native_value);
|
||||
value = GLib.TimeVal.New (native_value);
|
||||
Marshal.FreeHGlobal (native_value);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_subtract_days(IntPtr raw, uint n_days);
|
||||
|
||||
public void SubtractDays(uint n_days) {
|
||||
g_date_subtract_days(Handle, n_days);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_subtract_months(IntPtr raw, uint n_months);
|
||||
|
||||
public void SubtractMonths(uint n_months) {
|
||||
g_date_subtract_months(Handle, n_months);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_subtract_years(IntPtr raw, uint n_years);
|
||||
|
||||
public void SubtractYears(uint n_years) {
|
||||
g_date_subtract_years(Handle, n_years);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_to_struct_tm(IntPtr raw, IntPtr tm);
|
||||
|
||||
public void ToStructTm(IntPtr tm) {
|
||||
g_date_to_struct_tm(Handle, tm);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid(IntPtr raw);
|
||||
|
||||
public bool Valid() {
|
||||
bool raw_ret = g_date_valid(Handle);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern byte g_date_get_days_in_month(int month, ushort year);
|
||||
|
||||
public static byte GetDaysInMonth(int month, ushort year) {
|
||||
byte raw_ret = g_date_get_days_in_month(month, year);
|
||||
byte ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern byte g_date_get_monday_weeks_in_year(ushort year);
|
||||
|
||||
public static byte GetMondayWeeksInYear(ushort year) {
|
||||
byte raw_ret = g_date_get_monday_weeks_in_year(year);
|
||||
byte ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern byte g_date_get_sunday_weeks_in_year(ushort year);
|
||||
|
||||
public static byte GetSundayWeeksInYear(ushort year) {
|
||||
byte raw_ret = g_date_get_sunday_weeks_in_year(year);
|
||||
byte ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_is_leap_year(ushort year);
|
||||
|
||||
public static bool IsLeapYear(ushort year) {
|
||||
bool raw_ret = g_date_is_leap_year(year);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern UIntPtr g_date_strftime(IntPtr s, UIntPtr slen, IntPtr format, IntPtr date);
|
||||
|
||||
public static ulong Strftime(string s, string format, GLib.Date date) {
|
||||
IntPtr native_s = GLib.Marshaller.StringToPtrGStrdup (s);
|
||||
IntPtr native_format = GLib.Marshaller.StringToPtrGStrdup (format);
|
||||
UIntPtr raw_ret = g_date_strftime(native_s, new UIntPtr ((ulong) System.Text.Encoding.UTF8.GetByteCount (s)), native_format, date == null ? IntPtr.Zero : date.Handle);
|
||||
ulong ret = (ulong) raw_ret;
|
||||
GLib.Marshaller.Free (native_s);
|
||||
GLib.Marshaller.Free (native_format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid_day(byte day);
|
||||
|
||||
public static bool ValidDay(byte day) {
|
||||
bool raw_ret = g_date_valid_day(day);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid_dmy(byte day, int month, ushort year);
|
||||
|
||||
public static bool ValidDmy(byte day, int month, ushort year) {
|
||||
bool raw_ret = g_date_valid_dmy(day, month, year);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid_julian(uint julian_date);
|
||||
|
||||
public static bool ValidJulian(uint julian_date) {
|
||||
bool raw_ret = g_date_valid_julian(julian_date);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid_month(int month);
|
||||
|
||||
public static bool ValidMonth(int month) {
|
||||
bool raw_ret = g_date_valid_month(month);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid_weekday(int weekday);
|
||||
|
||||
public static bool ValidWeekday(int weekday) {
|
||||
bool raw_ret = g_date_valid_weekday(weekday);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_date_valid_year(ushort year);
|
||||
|
||||
public static bool ValidYear(ushort year) {
|
||||
bool raw_ret = g_date_valid_year(year);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Date(IntPtr raw) : base(raw) {}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_date_new();
|
||||
|
||||
public Date ()
|
||||
{
|
||||
Raw = g_date_new();
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_date_new_dmy(byte day, int month, ushort year);
|
||||
|
||||
public Date (byte day, int month, ushort year)
|
||||
{
|
||||
Raw = g_date_new_dmy(day, month, year);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_date_new_julian(uint julian_day);
|
||||
|
||||
public Date (uint julian_day)
|
||||
{
|
||||
Raw = g_date_new_julian(julian_day);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_date_free(IntPtr raw);
|
||||
|
||||
protected override void Free (IntPtr raw)
|
||||
{
|
||||
g_date_free (raw);
|
||||
}
|
||||
|
||||
class FinalizerInfo {
|
||||
IntPtr handle;
|
||||
|
||||
public FinalizerInfo (IntPtr handle)
|
||||
{
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public bool Handler ()
|
||||
{
|
||||
g_date_free (handle);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
~Date ()
|
||||
{
|
||||
if (!Owned)
|
||||
return;
|
||||
FinalizerInfo info = new FinalizerInfo (Handle);
|
||||
GLib.Timeout.Add (50, new GLib.TimeoutHandler (info.Handler));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
512
glib/DateTime.cs
Normal file
512
glib/DateTime.cs
Normal file
@ -0,0 +1,512 @@
|
||||
// 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_date_time_new_now_local();
|
||||
|
||||
public DateTime ()
|
||||
{
|
||||
Raw = g_date_time_new_now_local();
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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("libglib-2.0-0.dll", 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
|
||||
}
|
||||
}
|
@ -19,10 +19,15 @@ POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS)))
|
||||
|
||||
references =
|
||||
|
||||
# TODO: auto-generate at compile time the following classes:
|
||||
# Cond, Date, DateTime, Mutex, RecMutex, TimeVal, TimeZone
|
||||
|
||||
sources = \
|
||||
Argv.cs \
|
||||
ConnectBeforeAttribute.cs \
|
||||
Cond.cs \
|
||||
Date.cs \
|
||||
DateTime.cs \
|
||||
DefaultSignalHandlerAttribute.cs \
|
||||
DestroyNotify.cs \
|
||||
ExceptionManager.cs \
|
||||
@ -68,6 +73,8 @@ sources = \
|
||||
Spawn.cs \
|
||||
Thread.cs \
|
||||
Timeout.cs \
|
||||
TimeVal.cs \
|
||||
TimeZone.cs \
|
||||
ToggleRef.cs \
|
||||
TypeFundamentals.cs \
|
||||
TypeInitializerAttribute.cs \
|
||||
|
@ -348,15 +348,15 @@ namespace GLib {
|
||||
return unmarshal_32 (array, argc);
|
||||
}
|
||||
|
||||
static DateTime local_epoch = new DateTime (1970, 1, 1, 0, 0, 0);
|
||||
static int utc_offset = (int) (TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.Now)).TotalSeconds;
|
||||
static System.DateTime local_epoch = new System.DateTime (1970, 1, 1, 0, 0, 0);
|
||||
static int utc_offset = (int) (System.TimeZone.CurrentTimeZone.GetUtcOffset (System.DateTime.Now)).TotalSeconds;
|
||||
|
||||
public static IntPtr DateTimeTotime_t (DateTime time)
|
||||
public static IntPtr DateTimeTotime_t (System.DateTime time)
|
||||
{
|
||||
return new IntPtr (((long)time.Subtract (local_epoch).TotalSeconds) - utc_offset);
|
||||
}
|
||||
|
||||
public static DateTime time_tToDateTime (IntPtr time_t)
|
||||
public static System.DateTime time_tToDateTime (IntPtr time_t)
|
||||
{
|
||||
return local_epoch.AddSeconds (time_t.ToInt64 () + utc_offset);
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// This file was generated by the Gtk# code generator.
|
||||
// Any changes made will be lost if regenerated.
|
||||
|
||||
// TODO: generate this as part of the build instead of committing it to the repo
|
||||
|
||||
namespace GLib {
|
||||
|
||||
using System;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// This file was generated by the Gtk# code generator.
|
||||
// Any changes made will be lost if regenerated.
|
||||
|
||||
// TODO: generate this as part of the build instead of committing it to the repo
|
||||
|
||||
namespace GLib {
|
||||
|
||||
using System;
|
||||
|
105
glib/TimeVal.cs
Normal file
105
glib/TimeVal.cs
Normal file
@ -0,0 +1,105 @@
|
||||
// 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
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public partial struct TimeVal : IEquatable<TimeVal> {
|
||||
|
||||
private IntPtr tv_sec;
|
||||
public long TvSec {
|
||||
get {
|
||||
return (long) tv_sec;
|
||||
}
|
||||
set {
|
||||
tv_sec = new IntPtr (value);
|
||||
}
|
||||
}
|
||||
private IntPtr tv_usec;
|
||||
public long TvUsec {
|
||||
get {
|
||||
return (long) tv_usec;
|
||||
}
|
||||
set {
|
||||
tv_usec = new IntPtr (value);
|
||||
}
|
||||
}
|
||||
|
||||
public static GLib.TimeVal Zero = new GLib.TimeVal ();
|
||||
|
||||
public static GLib.TimeVal New(IntPtr raw) {
|
||||
if (raw == IntPtr.Zero)
|
||||
return GLib.TimeVal.Zero;
|
||||
return (GLib.TimeVal) Marshal.PtrToStructure (raw, typeof (GLib.TimeVal));
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_time_val_add(IntPtr raw, IntPtr microseconds);
|
||||
|
||||
public void Add(long microseconds) {
|
||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
||||
g_time_val_add(this_as_native, new IntPtr (microseconds));
|
||||
ReadNative (this_as_native, ref this);
|
||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_val_to_iso8601(IntPtr raw);
|
||||
|
||||
public string ToIso8601() {
|
||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
||||
IntPtr raw_ret = g_time_val_to_iso8601(this_as_native);
|
||||
string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
|
||||
ReadNative (this_as_native, ref this);
|
||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_time_val_from_iso8601(IntPtr iso_date, IntPtr time_);
|
||||
|
||||
public static bool FromIso8601(string iso_date, out GLib.TimeVal time_) {
|
||||
IntPtr native_iso_date = GLib.Marshaller.StringToPtrGStrdup (iso_date);
|
||||
IntPtr native_time_ = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (GLib.TimeVal)));
|
||||
bool raw_ret = g_time_val_from_iso8601(native_iso_date, native_time_);
|
||||
bool ret = raw_ret;
|
||||
GLib.Marshaller.Free (native_iso_date);
|
||||
time_ = GLib.TimeVal.New (native_time_);
|
||||
Marshal.FreeHGlobal (native_time_);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ReadNative (IntPtr native, ref GLib.TimeVal target)
|
||||
{
|
||||
target = New (native);
|
||||
}
|
||||
|
||||
public bool Equals (TimeVal other)
|
||||
{
|
||||
return true && TvSec.Equals (other.TvSec) && TvUsec.Equals (other.TvUsec);
|
||||
}
|
||||
|
||||
public override bool Equals (object other)
|
||||
{
|
||||
return other is TimeVal && Equals ((TimeVal) other);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return this.GetType().FullName.GetHashCode() ^ TvSec.GetHashCode () ^ TvUsec.GetHashCode ();
|
||||
}
|
||||
|
||||
private static GLib.GType GType {
|
||||
get { return GLib.GType.Pointer; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
146
glib/TimeZone.cs
Normal file
146
glib/TimeZone.cs
Normal file
@ -0,0 +1,146 @@
|
||||
// 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 TimeZone : GLib.Opaque {
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_zone_get_type();
|
||||
|
||||
public static GLib.GType GType {
|
||||
get {
|
||||
IntPtr raw_ret = g_time_zone_get_type();
|
||||
GLib.GType ret = new GLib.GType(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_time_zone_adjust_time(IntPtr raw, int type, long time_);
|
||||
|
||||
public int AdjustTime(int type, long time_) {
|
||||
int raw_ret = g_time_zone_adjust_time(Handle, type, time_);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_time_zone_find_interval(IntPtr raw, int type, long time_);
|
||||
|
||||
public int FindInterval(int type, long time_) {
|
||||
int raw_ret = g_time_zone_find_interval(Handle, type, time_);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_zone_get_abbreviation(IntPtr raw, int interval);
|
||||
|
||||
public string GetAbbreviation(int interval) {
|
||||
IntPtr raw_ret = g_time_zone_get_abbreviation(Handle, interval);
|
||||
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int g_time_zone_get_offset(IntPtr raw, int interval);
|
||||
|
||||
public int GetOffset(int interval) {
|
||||
int raw_ret = g_time_zone_get_offset(Handle, interval);
|
||||
int ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern bool g_time_zone_is_dst(IntPtr raw, int interval);
|
||||
|
||||
public bool IsDst(int interval) {
|
||||
bool raw_ret = g_time_zone_is_dst(Handle, interval);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public TimeZone(IntPtr raw) : base(raw) {}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_zone_new(IntPtr identifier);
|
||||
|
||||
public TimeZone (string identifier)
|
||||
{
|
||||
IntPtr native_identifier = GLib.Marshaller.StringToPtrGStrdup (identifier);
|
||||
Raw = g_time_zone_new(native_identifier);
|
||||
GLib.Marshaller.Free (native_identifier);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_zone_new_local();
|
||||
|
||||
public TimeZone ()
|
||||
{
|
||||
Raw = g_time_zone_new_local();
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_zone_new_utc();
|
||||
|
||||
public static TimeZone NewUtc()
|
||||
{
|
||||
TimeZone result = new TimeZone (g_time_zone_new_utc());
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_time_zone_ref(IntPtr raw);
|
||||
|
||||
protected override void Ref (IntPtr raw)
|
||||
{
|
||||
if (!Owned) {
|
||||
g_time_zone_ref (raw);
|
||||
Owned = true;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_time_zone_unref(IntPtr raw);
|
||||
|
||||
protected override void Unref (IntPtr raw)
|
||||
{
|
||||
if (Owned) {
|
||||
g_time_zone_unref (raw);
|
||||
Owned = false;
|
||||
}
|
||||
}
|
||||
|
||||
class FinalizerInfo {
|
||||
IntPtr handle;
|
||||
|
||||
public FinalizerInfo (IntPtr handle)
|
||||
{
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public bool Handler ()
|
||||
{
|
||||
g_time_zone_unref (handle);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
~TimeZone ()
|
||||
{
|
||||
if (!Owned)
|
||||
return;
|
||||
FinalizerInfo info = new FinalizerInfo (Handle);
|
||||
GLib.Timeout.Add (50, new GLib.TimeoutHandler (info.Handler));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -90,6 +90,10 @@
|
||||
<Compile Include="Mutex.cs" />
|
||||
<Compile Include="RecMutex.cs" />
|
||||
<Compile Include="Cond.cs" />
|
||||
<Compile Include="Date.cs" />
|
||||
<Compile Include="DateTime.cs" />
|
||||
<Compile Include="TimeVal.cs" />
|
||||
<Compile Include="TimeZone.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Core" />
|
||||
|
Loading…
Reference in New Issue
Block a user