예제 #1
0
        public static VariantType NewMaybe(VariantType element)
        {
            VariantType result = new VariantType();

            result.handle = g_variant_type_new_maybe(element == null ? IntPtr.Zero : element.Handle);
            return(result);
        }
예제 #2
0
        public static VariantType NewDictionaryEntry(VariantType key, VariantType value)
        {
            VariantType result = new VariantType();

            result.handle = g_variant_type_new_dict_entry(key == null ? IntPtr.Zero : key.Handle, value == null ? IntPtr.Zero : value.Handle);
            return(result);
        }
예제 #3
0
        public static VariantType NewTuple(VariantType[] items)
        {
            VariantType result = new VariantType();

            IntPtr[] native = new IntPtr [items.Length];
            for (int i = 0; i < items.Length; i++)
            {
                native [i] = items [i].Handle;
            }
            result.handle = g_variant_type_new_tuple(native, native.Length);
            return(result);
        }
예제 #4
0
        public Variant(IDictionary <string, Variant> dict)
        {
            VariantType type = VariantType.NewDictionaryEntry(
                VariantType.String,
                VariantType.Variant);

            var pairs = new List <Variant> ();

            foreach (var kvp in dict)
            {
                pairs.Add(NewDictEntry(new Variant(kvp.Key), NewVariant(kvp.Value)));
            }

            handle = g_variant_ref_sink(NewArray(type, pairs.ToArray()).Handle);
        }
예제 #5
0
        public static Variant NewArray(VariantType type, Variant[] children)
        {
            if (children == null)
            {
                if (type == null)
                {
                    throw new ArgumentException("The type and children parameters cannot be both null");
                }
                else
                {
                    return(new Variant(g_variant_new_array(type.Handle, null, new UIntPtr(0ul))));
                }
            }

            IntPtr[] native = new IntPtr[children.Length];
            for (int i = 0; i < children.Length; i++)
            {
                native[i] = children[i].Handle;
            }

            return(new Variant(g_variant_new_array(type == null ? (IntPtr)null : type.Handle,
                                                   native, new UIntPtr((ulong)children.Length))));
        }
예제 #6
0
 public bool IsSubtypeOf(VariantType supertype)
 {
     return(g_variant_type_is_subtype_of(Handle, supertype == null ? IntPtr.Zero : supertype.Handle));
 }
예제 #7
0
		public static Variant NewArray (VariantType type, Variant[] children)
		{
			if (children == null) {
				if (type == null) {
					throw new ArgumentException ("The type and children parameters cannot be both null");
				} else {
					return new Variant (g_variant_new_array (type.Handle, null, new UIntPtr (0ul)));
				}
			}

			IntPtr[] native = new IntPtr[children.Length];
			for (int i = 0; i < children.Length; i++)
				native[i] = children[i].Handle;

			return new Variant (g_variant_new_array (type == null ? (IntPtr) null : type.Handle,
			                                         native, new UIntPtr ((ulong) children.Length)));
		}
예제 #8
0
 public bool IsSubtypeOf(VariantType supertype)
 {
     return g_variant_type_is_subtype_of (Handle, supertype == null ? IntPtr.Zero : supertype.Handle);
 }
예제 #9
0
 public static VariantType NewTuple(VariantType[] items)
 {
     VariantType result = new VariantType ();
     IntPtr[] native = new IntPtr [items.Length];
     for (int i = 0; i < items.Length; i++)
         native [i] = items [i].Handle;
     result.handle = g_variant_type_new_tuple (native, native.Length);
     return result;
 }
예제 #10
0
 public static VariantType NewMaybe(VariantType element)
 {
     VariantType result = new VariantType ();
     result.handle = g_variant_type_new_maybe (element == null ? IntPtr.Zero : element.Handle);
     return result;
 }
예제 #11
0
 public static VariantType NewDictionaryEntry(VariantType key, VariantType value)
 {
     VariantType result = new VariantType ();
     result.handle = g_variant_type_new_dict_entry (key == null ? IntPtr.Zero : key.Handle, value == null ? IntPtr.Zero : value.Handle);
     return result;
 }