2003-12-15 16:59:25 +00:00
|
|
|
// GLib.Type.cs - GLib GType class implementation
|
2003-02-24 06:44:54 +00:00
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2003-12-15 16:59:25 +00:00
|
|
|
// (c) 2003 Mike Kestner, Novell, Inc.
|
2003-02-24 06:44:54 +00:00
|
|
|
|
|
|
|
namespace GLib {
|
|
|
|
|
|
|
|
using System;
|
2003-12-15 16:59:25 +00:00
|
|
|
using System.Runtime.InteropServices;
|
2003-02-24 06:44:54 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2003-12-15 16:59:25 +00:00
|
|
|
/// GType Class
|
2003-02-24 06:44:54 +00:00
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
|
|
|
/// An arbitrary data type similar to a CORBA Any which is used
|
|
|
|
/// to get and set properties on Objects.
|
|
|
|
/// </remarks>
|
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
public struct GType {
|
2003-02-24 06:44:54 +00:00
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
IntPtr val;
|
2003-02-24 06:44:54 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2003-12-15 16:59:25 +00:00
|
|
|
/// GType Constructor
|
2003-02-24 06:44:54 +00:00
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
2003-12-15 16:59:25 +00:00
|
|
|
/// Constructs a new GType from a native GType value.
|
2003-02-24 06:44:54 +00:00
|
|
|
/// </remarks>
|
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
public GType (IntPtr val) {
|
2003-02-24 06:44:54 +00:00
|
|
|
this.val = val;
|
|
|
|
}
|
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
public static readonly GType Invalid = new GType ((IntPtr) TypeFundamentals.TypeInvalid);
|
|
|
|
public static readonly GType None = new GType ((IntPtr) TypeFundamentals.TypeNone);
|
|
|
|
public static readonly GType String = new GType ((IntPtr) TypeFundamentals.TypeString);
|
|
|
|
public static readonly GType Boolean = new GType ((IntPtr) TypeFundamentals.TypeBoolean);
|
|
|
|
public static readonly GType Int = new GType ((IntPtr) TypeFundamentals.TypeInt);
|
|
|
|
public static readonly GType Double = new GType ((IntPtr) TypeFundamentals.TypeDouble);
|
|
|
|
public static readonly GType Float = new GType ((IntPtr) TypeFundamentals.TypeFloat);
|
|
|
|
public static readonly GType Char = new GType ((IntPtr) TypeFundamentals.TypeChar);
|
|
|
|
public static readonly GType UInt = new GType ((IntPtr) TypeFundamentals.TypeUInt);
|
|
|
|
public static readonly GType Object = new GType ((IntPtr) TypeFundamentals.TypeObject);
|
|
|
|
public static readonly GType Pointer = new GType ((IntPtr) TypeFundamentals.TypePointer);
|
|
|
|
public static readonly GType Boxed = new GType ((IntPtr) TypeFundamentals.TypeBoxed);
|
2003-02-24 06:44:54 +00:00
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
public IntPtr Val {
|
2003-02-24 06:44:54 +00:00
|
|
|
get {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
}
|
2003-06-23 21:46:31 +00:00
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
public override bool Equals (object o)
|
|
|
|
{
|
|
|
|
if (!(o is GType))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return ((GType) o) == this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool operator == (GType a, GType b)
|
|
|
|
{
|
|
|
|
return a.Val == b.Val;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool operator != (GType a, GType b)
|
|
|
|
{
|
|
|
|
return a.Val != b.Val;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override int GetHashCode ()
|
|
|
|
{
|
|
|
|
return val.GetHashCode ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string ToString ()
|
2003-06-23 21:46:31 +00:00
|
|
|
{
|
|
|
|
return val.ToString();
|
|
|
|
}
|
2003-02-24 06:44:54 +00:00
|
|
|
}
|
|
|
|
}
|