is_flags


Description:

[ CCode ( cname = "G_TYPE_IS_FLAGS" ) ]
public bool is_flags ()

Example: Check whether a type represents flags:

public interface Interface : Object {}
public abstract class AbstractGObject : Object, Interface {}
public abstract class AbstractSimpleObject {}
public enum Enum { E }
[Flags]
public enum Flags { E }

public static int main (string[] args) {
// Output: ``false``
Type type = typeof (Interface);
print (" is-flags: %s\n", type.is_flags ().to_string ());

// Output: ``false``
type = typeof (AbstractGObject);
print (" is-flags: %s\n", type.is_flags ().to_string ());

// Output: ``false``
type = typeof (AbstractSimpleObject);
print (" is-flags: %s\n", type.is_flags ().to_string ());

// Output: ``false``
type = typeof (Enum);
print (" is-flags: %s\n", type.is_flags ().to_string ());

// Output: ``true``
type = typeof (Flags);
print (" is-flags: %s\n", type.is_flags ().to_string ());

return 0;
}

valac --pkg gobject-2.0 GLib.Type.is_flags.vala