2003-12-15 17:59:25 +01:00
|
|
|
// GLib.Type.cs - GLib GType class implementation
|
2003-02-24 07:44:54 +01:00
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2004-06-25 20:42:19 +02:00
|
|
|
// Copyright (c) 2003 Mike Kestner
|
|
|
|
// Copyright (c) 2003 Novell, Inc.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
2003-02-24 07:44:54 +01:00
|
|
|
|
|
|
|
namespace GLib {
|
|
|
|
|
|
|
|
using System;
|
2003-12-15 17:59:25 +01:00
|
|
|
using System.Runtime.InteropServices;
|
2003-02-24 07:44:54 +01:00
|
|
|
|
2003-12-15 17:59:25 +01:00
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
public struct GType {
|
2003-02-24 07:44:54 +01:00
|
|
|
|
2003-12-15 17:59:25 +01:00
|
|
|
IntPtr val;
|
2003-02-24 07:44:54 +01:00
|
|
|
|
2003-12-15 17:59:25 +01:00
|
|
|
public GType (IntPtr val) {
|
2003-02-24 07:44:54 +01:00
|
|
|
this.val = val;
|
|
|
|
}
|
|
|
|
|
2003-12-15 17:59:25 +01:00
|
|
|
public static readonly GType Invalid = new GType ((IntPtr) TypeFundamentals.TypeInvalid);
|
|
|
|
public static readonly GType None = new GType ((IntPtr) TypeFundamentals.TypeNone);
|
2005-04-22 21:10:47 +02:00
|
|
|
public static readonly GType Char = new GType ((IntPtr) TypeFundamentals.TypeChar);
|
2003-12-15 17:59:25 +01:00
|
|
|
public static readonly GType Boolean = new GType ((IntPtr) TypeFundamentals.TypeBoolean);
|
|
|
|
public static readonly GType Int = new GType ((IntPtr) TypeFundamentals.TypeInt);
|
2005-04-22 21:10:47 +02:00
|
|
|
public static readonly GType UInt = new GType ((IntPtr) TypeFundamentals.TypeUInt);
|
2004-12-03 21:04:18 +01:00
|
|
|
public static readonly GType Int64 = new GType ((IntPtr) TypeFundamentals.TypeInt64);
|
|
|
|
public static readonly GType UInt64 = new GType ((IntPtr) TypeFundamentals.TypeUInt64);
|
2003-12-15 17:59:25 +01:00
|
|
|
public static readonly GType Float = new GType ((IntPtr) TypeFundamentals.TypeFloat);
|
2005-04-22 21:10:47 +02:00
|
|
|
public static readonly GType Double = new GType ((IntPtr) TypeFundamentals.TypeDouble);
|
|
|
|
public static readonly GType String = new GType ((IntPtr) TypeFundamentals.TypeString);
|
2003-12-15 17:59:25 +01:00
|
|
|
public static readonly GType Pointer = new GType ((IntPtr) TypeFundamentals.TypePointer);
|
|
|
|
public static readonly GType Boxed = new GType ((IntPtr) TypeFundamentals.TypeBoxed);
|
2005-04-22 21:10:47 +02:00
|
|
|
public static readonly GType Object = new GType ((IntPtr) TypeFundamentals.TypeObject);
|
2003-02-24 07:44:54 +01:00
|
|
|
|
2003-12-15 17:59:25 +01:00
|
|
|
public IntPtr Val {
|
2003-02-24 07:44:54 +01:00
|
|
|
get {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
}
|
2003-06-23 23:46:31 +02:00
|
|
|
|
2003-12-15 17:59:25 +01: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 23:46:31 +02:00
|
|
|
{
|
|
|
|
return val.ToString();
|
|
|
|
}
|
2003-02-24 07:44:54 +01:00
|
|
|
}
|
|
|
|
}
|