// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib_sys;
use gobject_sys;
use translate::*;
use value::FromValue;
use value::FromValueOptional;
use value::SetValue;
use value::Value;
use StaticType;
use Type;

bitflags! {
    pub struct FileTest: u32 {
        const IS_REGULAR = 1;
        const IS_SYMLINK = 2;
        const IS_DIR = 4;
        const IS_EXECUTABLE = 8;
        const EXISTS = 16;
    }
}

#[doc(hidden)]
impl ToGlib for FileTest {
    type GlibType = glib_sys::GFileTest;

    fn to_glib(&self) -> glib_sys::GFileTest {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<glib_sys::GFileTest> for FileTest {
    fn from_glib(value: glib_sys::GFileTest) -> FileTest {
        FileTest::from_bits_truncate(value)
    }
}

bitflags! {
    pub struct FormatSizeFlags: u32 {
        const DEFAULT = 0;
        const LONG_FORMAT = 1;
        const IEC_UNITS = 2;
        const BITS = 4;
    }
}

#[doc(hidden)]
impl ToGlib for FormatSizeFlags {
    type GlibType = glib_sys::GFormatSizeFlags;

    fn to_glib(&self) -> glib_sys::GFormatSizeFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<glib_sys::GFormatSizeFlags> for FormatSizeFlags {
    fn from_glib(value: glib_sys::GFormatSizeFlags) -> FormatSizeFlags {
        FormatSizeFlags::from_bits_truncate(value)
    }
}

bitflags! {
    pub struct IOCondition: u32 {
        const IN = 1;
        const OUT = 4;
        const PRI = 2;
        const ERR = 8;
        const HUP = 16;
        const NVAL = 32;
    }
}

#[doc(hidden)]
impl ToGlib for IOCondition {
    type GlibType = glib_sys::GIOCondition;

    fn to_glib(&self) -> glib_sys::GIOCondition {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<glib_sys::GIOCondition> for IOCondition {
    fn from_glib(value: glib_sys::GIOCondition) -> IOCondition {
        IOCondition::from_bits_truncate(value)
    }
}

impl StaticType for IOCondition {
    fn static_type() -> Type {
        unsafe { from_glib(glib_sys::g_io_condition_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for IOCondition {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for IOCondition {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for IOCondition {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    pub struct KeyFileFlags: u32 {
        const NONE = 0;
        const KEEP_COMMENTS = 1;
        const KEEP_TRANSLATIONS = 2;
    }
}

#[doc(hidden)]
impl ToGlib for KeyFileFlags {
    type GlibType = glib_sys::GKeyFileFlags;

    fn to_glib(&self) -> glib_sys::GKeyFileFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<glib_sys::GKeyFileFlags> for KeyFileFlags {
    fn from_glib(value: glib_sys::GKeyFileFlags) -> KeyFileFlags {
        KeyFileFlags::from_bits_truncate(value)
    }
}

bitflags! {
    pub struct OptionFlags: u32 {
        const NONE = 0;
        const HIDDEN = 1;
        const IN_MAIN = 2;
        const REVERSE = 4;
        const NO_ARG = 8;
        const FILENAME = 16;
        const OPTIONAL_ARG = 32;
        const NOALIAS = 64;
    }
}

#[doc(hidden)]
impl ToGlib for OptionFlags {
    type GlibType = glib_sys::GOptionFlags;

    fn to_glib(&self) -> glib_sys::GOptionFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<glib_sys::GOptionFlags> for OptionFlags {
    fn from_glib(value: glib_sys::GOptionFlags) -> OptionFlags {
        OptionFlags::from_bits_truncate(value)
    }
}

bitflags! {
    pub struct SpawnFlags: u32 {
        const DEFAULT = 0;
        const LEAVE_DESCRIPTORS_OPEN = 1;
        const DO_NOT_REAP_CHILD = 2;
        const SEARCH_PATH = 4;
        const STDOUT_TO_DEV_NULL = 8;
        const STDERR_TO_DEV_NULL = 16;
        const CHILD_INHERITS_STDIN = 32;
        const FILE_AND_ARGV_ZERO = 64;
        const SEARCH_PATH_FROM_ENVP = 128;
        const CLOEXEC_PIPES = 256;
    }
}

#[doc(hidden)]
impl ToGlib for SpawnFlags {
    type GlibType = glib_sys::GSpawnFlags;

    fn to_glib(&self) -> glib_sys::GSpawnFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<glib_sys::GSpawnFlags> for SpawnFlags {
    fn from_glib(value: glib_sys::GSpawnFlags) -> SpawnFlags {
        SpawnFlags::from_bits_truncate(value)
    }
}
