2001-09-27 17:17:33 +00:00
|
|
|
// GLib.Value.cs - GLib Value class implementation
|
2001-09-19 11:37:15 +00:00
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2004-04-12 15:54:57 +00:00
|
|
|
// Copyright (c) 2001 Mike Kestner
|
|
|
|
// Copyright (c) 2003-2004 Novell, Inc.
|
2004-06-25 18:42:19 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the Lesser GNU General
|
|
|
|
// Public License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this program; if not, write to the
|
|
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
2001-09-19 11:37:15 +00:00
|
|
|
|
|
|
|
namespace GLib {
|
|
|
|
|
|
|
|
using System;
|
2008-04-28 19:00:48 +00:00
|
|
|
using System.Reflection;
|
2001-09-19 11:37:15 +00:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
2004-04-07 03:41:13 +00:00
|
|
|
[StructLayout (LayoutKind.Sequential)]
|
2004-04-12 15:54:57 +00:00
|
|
|
public struct Value : IDisposable {
|
2001-09-28 00:28:30 +00:00
|
|
|
|
2004-05-07 13:42:59 +00:00
|
|
|
IntPtr type;
|
2011-01-08 04:22:04 +00:00
|
|
|
#pragma warning disable 0414
|
2011-04-28 00:05:11 +00:00
|
|
|
long pad1;
|
|
|
|
long pad2;
|
2011-01-08 04:22:04 +00:00
|
|
|
#pragma warning restore 0414
|
2001-09-28 00:28:30 +00:00
|
|
|
|
2004-04-12 15:54:57 +00:00
|
|
|
public static Value Empty;
|
2001-09-19 11:37:15 +00:00
|
|
|
|
2004-04-12 15:54:57 +00:00
|
|
|
public Value (GLib.GType gtype)
|
|
|
|
{
|
2004-05-07 13:42:59 +00:00
|
|
|
type = IntPtr.Zero;
|
2011-04-28 00:05:11 +00:00
|
|
|
pad1 = pad2 = 0;
|
2004-04-12 15:54:57 +00:00
|
|
|
g_value_init (ref this, gtype.Val);
|
2004-01-14 18:05:50 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (object obj)
|
2002-06-05 21:59:10 +00:00
|
|
|
{
|
2004-05-07 13:42:59 +00:00
|
|
|
type = IntPtr.Zero;
|
2011-04-28 00:05:11 +00:00
|
|
|
pad1 = pad2 = 0;
|
2001-09-28 00:28:30 +00:00
|
|
|
|
2005-05-04 16:54:24 +00:00
|
|
|
GType gtype = (GType) obj.GetType ();
|
|
|
|
g_value_init (ref this, gtype.Val);
|
2005-04-22 19:10:47 +00:00
|
|
|
Val = obj;
|
2002-07-26 06:08:52 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (bool val) : this (GType.Boolean)
|
2001-09-28 00:28:30 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_boolean (ref this, val);
|
2001-09-28 00:28:30 +00:00
|
|
|
}
|
|
|
|
|
2008-06-20 15:51:03 +00:00
|
|
|
public Value (byte val) : this (GType.UChar)
|
|
|
|
{
|
|
|
|
g_value_set_uchar (ref this, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Value (sbyte val) : this (GType.Char)
|
|
|
|
{
|
|
|
|
g_value_set_char (ref this, val);
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (int val) : this (GType.Int)
|
2001-09-28 18:23:14 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_int (ref this, val);
|
2001-09-28 18:23:14 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (uint val) : this (GType.UInt)
|
2001-09-27 17:17:33 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_uint (ref this, val);
|
2001-09-27 17:17:33 +00:00
|
|
|
}
|
2001-09-19 11:37:15 +00:00
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (ushort val) : this (GType.UInt)
|
2001-09-29 20:08:30 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_uint (ref this, val);
|
2001-09-29 20:08:30 +00:00
|
|
|
}
|
|
|
|
|
2004-12-03 20:04:18 +00:00
|
|
|
public Value (long val) : this (GType.Int64)
|
|
|
|
{
|
|
|
|
g_value_set_int64 (ref this, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Value (ulong val) : this (GType.UInt64)
|
|
|
|
{
|
|
|
|
g_value_set_uint64 (ref this, val);
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (float val) : this (GType.Float)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_float (ref this, val);
|
2002-05-02 21:57:41 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (double val) : this (GType.Double)
|
|
|
|
{
|
|
|
|
g_value_set_double (ref this, val);
|
|
|
|
}
|
2002-06-23 18:49:33 +00:00
|
|
|
|
2004-04-12 15:54:57 +00:00
|
|
|
public Value (string val) : this (GType.String)
|
2001-09-19 11:37:15 +00:00
|
|
|
{
|
2005-03-08 21:28:08 +00:00
|
|
|
IntPtr native_val = GLib.Marshaller.StringToPtrGStrdup (val);
|
|
|
|
g_value_set_string (ref this, native_val);
|
|
|
|
GLib.Marshaller.Free (native_val);
|
2001-09-28 00:28:30 +00:00
|
|
|
}
|
|
|
|
|
2009-05-13 18:57:31 +00:00
|
|
|
public Value (ValueArray val) : this (ValueArray.GType)
|
|
|
|
{
|
|
|
|
g_value_set_boxed (ref this, val.Handle);
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (IntPtr val) : this (GType.Pointer)
|
|
|
|
{
|
|
|
|
g_value_set_pointer (ref this, val);
|
|
|
|
}
|
2001-09-28 00:28:30 +00:00
|
|
|
|
2014-05-21 23:35:10 +00:00
|
|
|
public Value (Variant variant) : this (GType.Variant)
|
|
|
|
{
|
|
|
|
g_value_set_variant (ref this, variant == null ? IntPtr.Zero : variant.Handle);
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (Opaque val, string type_name)
|
2001-09-28 00:28:30 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
type = IntPtr.Zero;
|
2011-04-28 00:05:11 +00:00
|
|
|
pad1 = pad2 = 0;
|
2008-12-19 18:57:42 +00:00
|
|
|
g_value_init (ref this, GType.FromName (type_name).Val);
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_boxed (ref this, val.Handle);
|
2001-09-28 00:28:30 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public Value (GLib.Object val) : this (val == null ? GType.Object : val.NativeType)
|
2002-10-27 02:30:51 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle);
|
2002-10-27 02:30:51 +00:00
|
|
|
}
|
|
|
|
|
2013-10-12 12:09:23 +00:00
|
|
|
public Value (GLib.GInterfaceAdapter val) : this (val == null ? GType.Object : val.GInterfaceGType)
|
2007-10-15 20:25:05 +00:00
|
|
|
{
|
|
|
|
g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle);
|
|
|
|
}
|
2005-04-22 19:10:47 +00:00
|
|
|
|
|
|
|
public Value (GLib.Object obj, string prop_name)
|
2004-11-16 18:03:58 +00:00
|
|
|
{
|
|
|
|
type = IntPtr.Zero;
|
2011-04-28 00:05:11 +00:00
|
|
|
pad1 = pad2 = 0;
|
2008-12-19 18:57:42 +00:00
|
|
|
InitForProperty (obj, prop_name);
|
2004-11-16 18:03:58 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
[Obsolete]
|
|
|
|
public Value (IntPtr obj, string prop_name, Opaque val)
|
2003-05-19 07:18:52 +00:00
|
|
|
{
|
2004-05-07 13:42:59 +00:00
|
|
|
type = IntPtr.Zero;
|
2011-04-28 00:05:11 +00:00
|
|
|
pad1 = pad2 = 0;
|
2008-12-19 18:57:42 +00:00
|
|
|
InitForProperty (GLib.Object.GetObject (obj), prop_name);
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_boxed (ref this, val.Handle);
|
2003-05-19 07:18:52 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 17:58:28 +00:00
|
|
|
public Value (string[] val) : this (new GLib.GType (g_strv_get_type ()))
|
|
|
|
{
|
|
|
|
if (val == null) {
|
|
|
|
g_value_set_boxed (ref this, IntPtr.Zero);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
IntPtr native_array = Marshal.AllocHGlobal ((val.Length + 1) * IntPtr.Size);
|
|
|
|
for (int i = 0; i < val.Length; i++)
|
|
|
|
Marshal.WriteIntPtr (native_array, i * IntPtr.Size, GLib.Marshaller.StringToPtrGStrdup (val[i]));
|
|
|
|
Marshal.WriteIntPtr (native_array, val.Length * IntPtr.Size, IntPtr.Zero);
|
|
|
|
|
|
|
|
g_value_set_boxed (ref this, native_array);
|
|
|
|
|
|
|
|
for (int i = 0; i < val.Length; i++)
|
|
|
|
GLib.Marshaller.Free (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
|
|
|
|
Marshal.FreeHGlobal (native_array);
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public void Dispose ()
|
2001-09-28 00:28:30 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_unset (ref this);
|
2001-09-19 11:37:15 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public void Init (GLib.GType gtype)
|
2002-07-26 06:08:52 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_init (ref this, gtype.Val);
|
2002-07-26 06:08:52 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
|
|
|
|
public static explicit operator bool (Value val)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
return g_value_get_boolean (ref val);
|
2002-05-02 21:57:41 +00:00
|
|
|
}
|
|
|
|
|
2008-06-20 15:51:03 +00:00
|
|
|
public static explicit operator byte (Value val)
|
|
|
|
{
|
|
|
|
return g_value_get_uchar (ref val);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static explicit operator sbyte (Value val)
|
|
|
|
{
|
|
|
|
return g_value_get_char (ref val);
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator int (Value val)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
return g_value_get_int (ref val);
|
2002-05-02 21:57:41 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator uint (Value val)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
return g_value_get_uint (ref val);
|
2002-05-02 21:57:41 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator ushort (Value val)
|
2001-09-29 20:08:30 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
return (ushort) g_value_get_uint (ref val);
|
2001-09-29 20:08:30 +00:00
|
|
|
}
|
|
|
|
|
2004-12-03 20:04:18 +00:00
|
|
|
public static explicit operator long (Value val)
|
|
|
|
{
|
2009-09-24 17:21:16 +00:00
|
|
|
if (val.type == GType.Long.Val)
|
|
|
|
return val.GetLongForPlatform ();
|
|
|
|
else
|
|
|
|
return g_value_get_int64 (ref val);
|
2004-12-03 20:04:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static explicit operator ulong (Value val)
|
|
|
|
{
|
2009-09-24 17:21:16 +00:00
|
|
|
if (val.type == GType.ULong.Val)
|
|
|
|
return val.GetULongForPlatform ();
|
|
|
|
else
|
|
|
|
return g_value_get_uint64 (ref val);
|
2004-12-03 20:04:18 +00:00
|
|
|
}
|
|
|
|
|
2005-07-22 18:36:50 +00:00
|
|
|
public static explicit operator Enum (Value val)
|
|
|
|
{
|
2008-12-19 18:57:42 +00:00
|
|
|
if (val.HoldsFlags)
|
2005-07-22 18:36:50 +00:00
|
|
|
return (Enum)Enum.ToObject (GType.LookupType (val.type), g_value_get_flags (ref val));
|
|
|
|
else
|
|
|
|
return (Enum)Enum.ToObject (GType.LookupType (val.type), g_value_get_enum (ref val));
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator float (Value val)
|
2002-06-24 23:38:51 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
return g_value_get_float (ref val);
|
2002-06-24 23:38:51 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator double (Value val)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2005-04-22 19:10:47 +00:00
|
|
|
return g_value_get_double (ref val);
|
2002-05-02 21:57:41 +00:00
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator string (Value val)
|
2001-09-19 11:37:15 +00:00
|
|
|
{
|
2004-04-12 15:54:57 +00:00
|
|
|
IntPtr str = g_value_get_string (ref val);
|
2005-03-08 21:28:08 +00:00
|
|
|
return str == IntPtr.Zero ? null : GLib.Marshaller.Utf8PtrToString (str);
|
2001-09-19 11:37:15 +00:00
|
|
|
}
|
|
|
|
|
2009-05-13 18:57:31 +00:00
|
|
|
public static explicit operator ValueArray (Value val)
|
|
|
|
{
|
|
|
|
return new ValueArray (g_value_get_boxed (ref val));
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator IntPtr (Value val)
|
|
|
|
{
|
|
|
|
return g_value_get_pointer (ref val);
|
|
|
|
}
|
2002-05-02 21:57:41 +00:00
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator GLib.Opaque (Value val)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2005-09-27 19:12:43 +00:00
|
|
|
return GLib.Opaque.GetOpaque (g_value_get_boxed (ref val), (Type) new GType (val.type), false);
|
2002-05-02 21:57:41 +00:00
|
|
|
}
|
|
|
|
|
2014-05-21 23:35:10 +00:00
|
|
|
public static explicit operator GLib.Variant (Value Val)
|
|
|
|
{
|
|
|
|
return new Variant (g_value_get_variant (ref Val));
|
|
|
|
}
|
|
|
|
|
2011-02-11 19:52:13 +00:00
|
|
|
public static explicit operator GLib.VariantType (Value val)
|
|
|
|
{
|
|
|
|
return new VariantType (g_value_get_boxed (ref val));
|
|
|
|
}
|
|
|
|
|
2005-04-22 19:10:47 +00:00
|
|
|
public static explicit operator GLib.Object (Value val)
|
|
|
|
{
|
|
|
|
return GLib.Object.GetObject (g_value_get_object (ref val), false);
|
|
|
|
}
|
2002-06-24 22:04:10 +00:00
|
|
|
|
2005-06-01 17:58:28 +00:00
|
|
|
public static explicit operator string[] (Value val)
|
|
|
|
{
|
|
|
|
IntPtr native_array = g_value_get_boxed (ref val);
|
|
|
|
if (native_array == IntPtr.Zero)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
while (Marshal.ReadIntPtr (native_array, count * IntPtr.Size) != IntPtr.Zero)
|
|
|
|
count++;
|
|
|
|
string[] strings = new string[count];
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
strings[i] = GLib.Marshaller.Utf8PtrToString (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
|
|
|
|
return strings;
|
|
|
|
}
|
2004-04-12 15:54:57 +00:00
|
|
|
|
2009-04-16 20:03:35 +00:00
|
|
|
object ToRegisteredType () {
|
|
|
|
Type t = GLib.GType.LookupType (type);
|
|
|
|
ConstructorInfo ci = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
while (ci == null && t != null) {
|
|
|
|
if (!t.IsAbstract)
|
|
|
|
ci = t.GetConstructor (new Type[] { typeof (GLib.Value) });
|
2009-04-21 08:16:57 +00:00
|
|
|
if (ci == null)
|
|
|
|
t = t.BaseType;
|
2009-04-16 20:03:35 +00:00
|
|
|
}
|
|
|
|
} catch (Exception) {
|
|
|
|
ci = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ci == null)
|
|
|
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
|
|
|
|
|
|
|
return ci.Invoke (new object[] {this});
|
|
|
|
}
|
|
|
|
|
|
|
|
void FromRegisteredType (object val) {
|
|
|
|
Type t = GLib.GType.LookupType (type);
|
|
|
|
MethodInfo mi = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
while (mi == null && t != null) {
|
2009-04-21 08:16:57 +00:00
|
|
|
mi = t.GetMethod ("SetGValue", new Type[] { Type.GetType ("GLib.Value&") });
|
|
|
|
if (mi != null && (mi.IsAbstract || mi.ReturnType != typeof (void)))
|
2009-04-16 20:03:35 +00:00
|
|
|
mi = null;
|
2009-04-21 08:16:57 +00:00
|
|
|
if (mi == null)
|
|
|
|
t = t.BaseType;
|
2009-04-16 20:03:35 +00:00
|
|
|
}
|
|
|
|
} catch (Exception) {
|
|
|
|
mi = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mi == null)
|
|
|
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
|
|
|
|
2009-04-21 08:16:57 +00:00
|
|
|
object[] parameters = new object[] { this };
|
|
|
|
mi.Invoke (val, parameters);
|
|
|
|
this = (GLib.Value) parameters[0];
|
2009-04-16 20:03:35 +00:00
|
|
|
}
|
|
|
|
|
2009-09-24 17:21:16 +00:00
|
|
|
long GetLongForPlatform ()
|
|
|
|
{
|
|
|
|
switch (Environment.OSVersion.Platform) {
|
|
|
|
case PlatformID.Win32NT:
|
|
|
|
case PlatformID.Win32S:
|
|
|
|
case PlatformID.Win32Windows:
|
|
|
|
case PlatformID.WinCE:
|
|
|
|
return (long) g_value_get_long_as_int (ref this);
|
|
|
|
default:
|
|
|
|
return g_value_get_long (ref this).ToInt64 ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ulong GetULongForPlatform ()
|
|
|
|
{
|
|
|
|
switch (Environment.OSVersion.Platform) {
|
|
|
|
case PlatformID.Win32NT:
|
|
|
|
case PlatformID.Win32S:
|
|
|
|
case PlatformID.Win32Windows:
|
|
|
|
case PlatformID.WinCE:
|
|
|
|
return (ulong) g_value_get_ulong_as_uint (ref this);
|
|
|
|
default:
|
|
|
|
return g_value_get_ulong (ref this).ToUInt64 ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetLongForPlatform (long val)
|
|
|
|
{
|
|
|
|
switch (Environment.OSVersion.Platform) {
|
|
|
|
case PlatformID.Win32NT:
|
|
|
|
case PlatformID.Win32S:
|
|
|
|
case PlatformID.Win32Windows:
|
|
|
|
case PlatformID.WinCE:
|
|
|
|
g_value_set_long (ref this, (int) val);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_value_set_long (ref this, new IntPtr (val));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetULongForPlatform (ulong val)
|
|
|
|
{
|
|
|
|
switch (Environment.OSVersion.Platform) {
|
|
|
|
case PlatformID.Win32NT:
|
|
|
|
case PlatformID.Win32S:
|
|
|
|
case PlatformID.Win32Windows:
|
|
|
|
case PlatformID.WinCE:
|
|
|
|
g_value_set_ulong (ref this, (uint) val);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_value_set_ulong (ref this, new UIntPtr (val));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-13 19:27:39 +00:00
|
|
|
object ToEnum ()
|
|
|
|
{
|
|
|
|
Type t = GType.LookupType (type);
|
|
|
|
|
|
|
|
if (t == null) {
|
|
|
|
if (HoldsFlags)
|
|
|
|
return g_value_get_flags (ref this);
|
|
|
|
else
|
|
|
|
return g_value_get_enum (ref this);
|
|
|
|
} else {
|
|
|
|
return (Enum) this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-23 16:17:12 +00:00
|
|
|
object ToBoxed ()
|
|
|
|
{
|
|
|
|
IntPtr boxed_ptr = g_value_get_boxed (ref this);
|
2013-11-02 15:52:25 +00:00
|
|
|
|
|
|
|
if (boxed_ptr == IntPtr.Zero)
|
|
|
|
return null;
|
|
|
|
|
2007-04-23 16:17:12 +00:00
|
|
|
Type t = GType.LookupType (type);
|
|
|
|
if (t == null)
|
|
|
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
2008-04-28 19:00:48 +00:00
|
|
|
else if (t.IsSubclassOf (typeof (GLib.Opaque)))
|
|
|
|
return (GLib.Opaque) this;
|
|
|
|
|
2014-06-10 13:23:10 +00:00
|
|
|
MethodInfo mi = t.GetMethod ("New", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { typeof(IntPtr) }, null);
|
2013-10-09 11:40:56 +00:00
|
|
|
if (mi != null)
|
2008-04-28 19:00:48 +00:00
|
|
|
return mi.Invoke (null, new object[] {boxed_ptr});
|
2013-10-09 11:40:56 +00:00
|
|
|
|
2014-06-21 14:59:22 +00:00
|
|
|
ConstructorInfo ci = t.GetConstructor (new Type[] { typeof(IntPtr), typeof (bool) });
|
|
|
|
if (ci != null)
|
|
|
|
return ci.Invoke (new object[] { boxed_ptr, false });
|
|
|
|
|
|
|
|
ci = t.GetConstructor (new Type[] { typeof(IntPtr) });
|
2013-10-09 11:40:56 +00:00
|
|
|
if (ci != null)
|
|
|
|
return ci.Invoke (new object[] { boxed_ptr });
|
|
|
|
|
|
|
|
return Marshal.PtrToStructure (boxed_ptr, t);
|
2007-04-23 16:17:12 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 07:18:52 +00:00
|
|
|
public object Val
|
|
|
|
{
|
|
|
|
get {
|
2005-07-22 18:36:50 +00:00
|
|
|
if (type == GType.Boolean.Val)
|
2003-05-19 07:18:52 +00:00
|
|
|
return (bool) this;
|
2008-06-20 15:51:03 +00:00
|
|
|
else if (type == GType.UChar.Val)
|
|
|
|
return (byte) this;
|
|
|
|
else if (type == GType.Char.Val)
|
|
|
|
return (sbyte) this;
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Int.Val)
|
2003-05-19 07:18:52 +00:00
|
|
|
return (int) this;
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.UInt.Val)
|
2005-04-22 19:10:47 +00:00
|
|
|
return (uint) this;
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Int64.Val)
|
2004-12-03 20:04:18 +00:00
|
|
|
return (long) this;
|
2009-09-24 17:21:16 +00:00
|
|
|
else if (type == GType.Long.Val)
|
|
|
|
return GetLongForPlatform ();
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.UInt64.Val)
|
2004-12-03 20:04:18 +00:00
|
|
|
return (ulong) this;
|
2009-09-24 17:21:16 +00:00
|
|
|
else if (type == GType.ULong.Val)
|
|
|
|
return GetULongForPlatform ();
|
2009-01-06 15:27:12 +00:00
|
|
|
else if (GType.Is (type, GType.Enum) ||
|
|
|
|
GType.Is (type, GType.Flags))
|
2009-05-13 19:27:39 +00:00
|
|
|
return ToEnum ();
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Float.Val)
|
2003-05-19 07:18:52 +00:00
|
|
|
return (float) this;
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Double.Val)
|
2005-04-22 19:10:47 +00:00
|
|
|
return (double) this;
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.String.Val)
|
2005-04-22 19:10:47 +00:00
|
|
|
return (string) this;
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Pointer.Val)
|
|
|
|
return (IntPtr) this;
|
2014-05-21 23:35:10 +00:00
|
|
|
else if (type == GType.Variant.Val)
|
|
|
|
return (GLib.Variant) this;
|
2008-04-28 19:00:48 +00:00
|
|
|
else if (type == GType.Param.Val)
|
|
|
|
return g_value_get_param (ref this);
|
2009-05-13 18:57:31 +00:00
|
|
|
else if (type == ValueArray.GType.Val)
|
|
|
|
return new ValueArray (g_value_get_boxed (ref this));
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == ManagedValue.GType.Val)
|
2005-04-22 19:10:47 +00:00
|
|
|
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
|
2009-01-06 15:27:12 +00:00
|
|
|
else if (GType.Is (type, GType.Object))
|
2003-05-19 07:18:52 +00:00
|
|
|
return (GLib.Object) this;
|
2009-01-06 15:27:12 +00:00
|
|
|
else if (GType.Is (type, GType.Boxed))
|
2007-04-23 16:17:12 +00:00
|
|
|
return ToBoxed ();
|
2009-04-16 20:03:35 +00:00
|
|
|
else if (GType.LookupType (type) != null)
|
|
|
|
return ToRegisteredType ();
|
2008-08-19 22:00:33 +00:00
|
|
|
else if (type == IntPtr.Zero)
|
|
|
|
return null;
|
2003-12-15 16:59:25 +00:00
|
|
|
else
|
2005-07-22 18:36:50 +00:00
|
|
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
2003-05-19 07:18:52 +00:00
|
|
|
}
|
2003-11-04 23:20:15 +00:00
|
|
|
set {
|
2005-07-22 18:36:50 +00:00
|
|
|
if (type == GType.Boolean.Val)
|
2004-04-12 15:54:57 +00:00
|
|
|
g_value_set_boolean (ref this, (bool) value);
|
2008-06-20 15:51:03 +00:00
|
|
|
else if (type == GType.UChar.Val)
|
|
|
|
g_value_set_uchar (ref this, (byte) value);
|
|
|
|
else if (type == GType.Char.Val)
|
|
|
|
g_value_set_char (ref this, (sbyte) value);
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Int.Val)
|
2004-04-12 15:54:57 +00:00
|
|
|
g_value_set_int (ref this, (int) value);
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.UInt.Val)
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_uint (ref this, (uint) value);
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Int64.Val)
|
2004-12-03 20:04:18 +00:00
|
|
|
g_value_set_int64 (ref this, (long) value);
|
2009-09-24 17:21:16 +00:00
|
|
|
else if (type == GType.Long.Val)
|
|
|
|
SetLongForPlatform ((long) value);
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.UInt64.Val)
|
2004-12-03 20:04:18 +00:00
|
|
|
g_value_set_uint64 (ref this, (ulong) value);
|
2009-09-24 17:21:16 +00:00
|
|
|
else if (type == GType.ULong.Val)
|
2009-11-01 17:49:57 +00:00
|
|
|
SetULongForPlatform (Convert.ToUInt64 (value));
|
2009-01-06 15:27:12 +00:00
|
|
|
else if (GType.Is (type, GType.Enum))
|
2005-07-22 18:36:50 +00:00
|
|
|
g_value_set_enum (ref this, (int)value);
|
2009-01-06 15:27:12 +00:00
|
|
|
else if (GType.Is (type, GType.Flags))
|
2005-07-22 18:36:50 +00:00
|
|
|
g_value_set_flags (ref this, (uint)(int)value);
|
|
|
|
else if (type == GType.Float.Val)
|
2004-04-12 15:54:57 +00:00
|
|
|
g_value_set_float (ref this, (float) value);
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.Double.Val)
|
2005-04-22 19:10:47 +00:00
|
|
|
g_value_set_double (ref this, (double) value);
|
2014-05-21 23:35:10 +00:00
|
|
|
else if (type == GType.Variant.Val)
|
|
|
|
g_value_set_variant (ref this, ((GLib.Variant) value).Handle);
|
2005-07-22 18:36:50 +00:00
|
|
|
else if (type == GType.String.Val) {
|
2005-04-22 19:10:47 +00:00
|
|
|
IntPtr native = GLib.Marshaller.StringToPtrGStrdup ((string)value);
|
|
|
|
g_value_set_string (ref this, native);
|
|
|
|
GLib.Marshaller.Free (native);
|
2005-07-22 18:36:50 +00:00
|
|
|
} else if (type == GType.Pointer.Val) {
|
2008-11-26 01:56:46 +00:00
|
|
|
if (value.GetType () == typeof (IntPtr)) {
|
|
|
|
g_value_set_pointer (ref this, (IntPtr) value);
|
|
|
|
return;
|
|
|
|
} else if (value is IWrapper) {
|
2004-04-12 15:54:57 +00:00
|
|
|
g_value_set_pointer (ref this, ((IWrapper)value).Handle);
|
|
|
|
return;
|
|
|
|
}
|
2005-07-22 18:36:50 +00:00
|
|
|
IntPtr buf = Marshal.AllocHGlobal (Marshal.SizeOf (value.GetType()));
|
2004-04-12 15:54:57 +00:00
|
|
|
Marshal.StructureToPtr (value, buf, false);
|
|
|
|
g_value_set_pointer (ref this, buf);
|
2008-04-28 19:00:48 +00:00
|
|
|
} else if (type == GType.Param.Val) {
|
|
|
|
g_value_set_param (ref this, (IntPtr) value);
|
2009-05-13 18:57:31 +00:00
|
|
|
} else if (type == ValueArray.GType.Val) {
|
|
|
|
g_value_set_boxed (ref this, ((ValueArray) value).Handle);
|
2007-06-05 19:53:34 +00:00
|
|
|
} else if (type == ManagedValue.GType.Val) {
|
|
|
|
IntPtr wrapper = ManagedValue.WrapObject (value);
|
|
|
|
g_value_set_boxed (ref this, wrapper);
|
|
|
|
ManagedValue.ReleaseWrapper (wrapper);
|
2009-01-06 15:27:12 +00:00
|
|
|
} else if (GType.Is (type, GType.Object))
|
2008-08-20 15:53:03 +00:00
|
|
|
if(value is GLib.Object)
|
|
|
|
g_value_set_object (ref this, (value as GLib.Object).Handle);
|
|
|
|
else
|
2013-10-12 20:04:25 +00:00
|
|
|
g_value_set_object (ref this, ((GInterfaceAdapter)value).Handle);
|
2009-01-06 15:27:12 +00:00
|
|
|
else if (GType.Is (type, GType.Boxed)) {
|
2004-04-12 15:54:57 +00:00
|
|
|
if (value is IWrapper) {
|
|
|
|
g_value_set_boxed (ref this, ((IWrapper)value).Handle);
|
|
|
|
return;
|
|
|
|
}
|
2005-07-22 18:36:50 +00:00
|
|
|
IntPtr buf = Marshaller.StructureToPtrAlloc (value);
|
2004-05-10 18:54:14 +00:00
|
|
|
g_value_set_boxed (ref this, buf);
|
|
|
|
Marshal.FreeHGlobal (buf);
|
2009-04-16 20:03:35 +00:00
|
|
|
} else if (GLib.GType.LookupType (type) != null) {
|
|
|
|
FromRegisteredType (value);
|
2005-07-22 18:36:50 +00:00
|
|
|
} else
|
|
|
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
2003-11-04 23:20:15 +00:00
|
|
|
}
|
2003-05-19 07:18:52 +00:00
|
|
|
}
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2008-06-17 20:18:23 +00:00
|
|
|
internal void Update (object val)
|
|
|
|
{
|
2014-09-21 12:29:53 +00:00
|
|
|
if (GType.Is (type, GType.Boxed) && val != null && !(val is IWrapper)) {
|
2013-10-09 11:40:56 +00:00
|
|
|
MethodInfo mi = val.GetType ().GetMethod ("Update", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
IntPtr boxed_ptr = g_value_get_boxed (ref this);
|
2014-06-21 15:05:32 +00:00
|
|
|
|
|
|
|
if (mi == null && !val.GetType ().IsDefined (typeof(StructLayoutAttribute), false))
|
|
|
|
return;
|
|
|
|
|
2013-10-09 11:40:56 +00:00
|
|
|
if (mi == null)
|
|
|
|
Marshal.StructureToPtr (val, boxed_ptr, false);
|
|
|
|
else
|
|
|
|
mi.Invoke (val, null);
|
|
|
|
}
|
2008-06-17 20:18:23 +00:00
|
|
|
}
|
|
|
|
|
2008-12-19 18:57:42 +00:00
|
|
|
bool HoldsFlags {
|
|
|
|
get { return g_type_check_value_holds (ref this, GType.Flags.Val); }
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitForProperty (Object obj, string name)
|
|
|
|
{
|
2009-05-01 18:40:44 +00:00
|
|
|
GType gtype = obj.NativeType;
|
2008-12-19 18:57:42 +00:00
|
|
|
InitForProperty (gtype, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitForProperty (GType gtype, string name)
|
|
|
|
{
|
|
|
|
IntPtr p_name = Marshaller.StringToPtrGStrdup (name);
|
2009-08-08 23:42:15 +00:00
|
|
|
IntPtr spec_ptr = g_object_class_find_property (gtype.GetClassPtr (), p_name);
|
2008-12-19 18:57:42 +00:00
|
|
|
Marshaller.Free (p_name);
|
2009-05-12 23:53:50 +00:00
|
|
|
|
|
|
|
if (spec_ptr == IntPtr.Zero)
|
|
|
|
throw new Exception (String.Format ("No property with name '{0}' in type '{1}'", name, gtype.ToString()));
|
|
|
|
|
|
|
|
ParamSpec spec = new ParamSpec (spec_ptr);
|
2008-12-19 18:57:42 +00:00
|
|
|
g_value_init (ref this, spec.ValueType.Val);
|
|
|
|
}
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-12-19 18:57:42 +00:00
|
|
|
static extern IntPtr g_object_class_find_property (IntPtr klass, IntPtr name);
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-12-19 18:57:42 +00:00
|
|
|
static extern bool g_type_check_value_holds (ref Value val, IntPtr gtype);
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-12-19 18:57:42 +00:00
|
|
|
static extern void g_value_init (ref GLib.Value val, IntPtr gtype);
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-12-19 18:57:42 +00:00
|
|
|
static extern void g_value_unset (ref GLib.Value val);
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_boolean (ref Value val, bool data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-06-20 15:51:03 +00:00
|
|
|
static extern void g_value_set_uchar (ref Value val, byte data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-06-20 15:51:03 +00:00
|
|
|
static extern void g_value_set_char (ref Value val, sbyte data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_boxed (ref Value val, IntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_double (ref Value val, double data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_float (ref Value val, float data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_int (ref Value val, int data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_int64 (ref Value val, long data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern void g_value_set_long (ref Value val, IntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern void g_value_set_long (ref Value val, int data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_uint64 (ref Value val, ulong data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_object (ref Value val, IntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-04-28 19:00:48 +00:00
|
|
|
static extern void g_value_set_param (ref Value val, IntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_pointer (ref Value val, IntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_string (ref Value val, IntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_uint (ref Value val, uint data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern void g_value_set_ulong (ref Value val, UIntPtr data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern void g_value_set_ulong (ref Value val, uint data);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_enum (ref Value val, int data);
|
2014-05-21 23:35:10 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern void g_value_set_flags (ref Value val, uint data);
|
2014-05-21 23:35:10 +00:00
|
|
|
|
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern void g_value_set_variant (ref Value val, IntPtr data);
|
2005-04-22 19:10:47 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern bool g_value_get_boolean (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-06-20 15:51:03 +00:00
|
|
|
static extern byte g_value_get_uchar (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-06-20 15:51:03 +00:00
|
|
|
static extern sbyte g_value_get_char (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern IntPtr g_value_get_boxed (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern double g_value_get_double (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern float g_value_get_float (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern int g_value_get_int (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern long g_value_get_int64 (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern IntPtr g_value_get_long (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, EntryPoint = "g_value_get_long", CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern int g_value_get_long_as_int (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern ulong g_value_get_uint64 (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern UIntPtr g_value_get_ulong (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, EntryPoint = "g_value_get_ulong", CallingConvention = CallingConvention.Cdecl)]
|
2009-09-24 17:21:16 +00:00
|
|
|
static extern int g_value_get_ulong_as_uint (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern IntPtr g_value_get_object (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2008-04-28 19:00:48 +00:00
|
|
|
static extern IntPtr g_value_get_param (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern IntPtr g_value_get_pointer (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern IntPtr g_value_get_string (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern uint g_value_get_uint (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern int g_value_get_enum (ref Value val);
|
2014-05-21 23:35:10 +00:00
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-04-22 19:10:47 +00:00
|
|
|
static extern uint g_value_get_flags (ref Value val);
|
|
|
|
|
2013-11-05 10:12:27 +00:00
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
2005-06-01 17:58:28 +00:00
|
|
|
static extern IntPtr g_strv_get_type ();
|
2014-05-21 23:35:10 +00:00
|
|
|
|
|
|
|
[DllImport (Global.GObjectNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern IntPtr g_value_get_variant (ref Value val);
|
2001-09-19 11:37:15 +00:00
|
|
|
}
|
|
|
|
}
|