-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GIRepository.Flags
    ( 

 -- * Flags
-- ** FieldInfoFlags #flag:FieldInfoFlags#

    FieldInfoFlags(..)                      ,


-- ** FunctionInfoFlags #flag:FunctionInfoFlags#

    FunctionInfoFlags(..)                   ,


-- ** RepositoryLoadFlags #flag:RepositoryLoadFlags#

    RepositoryLoadFlags(..)                 ,


-- ** VFuncInfoFlags #flag:VFuncInfoFlags#

    VFuncInfoFlags(..)                      ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL


-- Flags VFuncInfoFlags
-- | Flags of a @/GIVFuncInfo/@ struct.
data VFuncInfoFlags = 
      VFuncInfoFlagsMustChainUp
    -- ^ chains up to the parent type
    | VFuncInfoFlagsMustOverride
    -- ^ overrides
    | VFuncInfoFlagsMustNotOverride
    -- ^ does not override
    | VFuncInfoFlagsThrows
    -- ^ Includes a t'GError'
    | AnotherVFuncInfoFlags Int
    -- ^ Catch-all for unknown values
    deriving (Int -> VFuncInfoFlags -> ShowS
[VFuncInfoFlags] -> ShowS
VFuncInfoFlags -> String
(Int -> VFuncInfoFlags -> ShowS)
-> (VFuncInfoFlags -> String)
-> ([VFuncInfoFlags] -> ShowS)
-> Show VFuncInfoFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VFuncInfoFlags] -> ShowS
$cshowList :: [VFuncInfoFlags] -> ShowS
show :: VFuncInfoFlags -> String
$cshow :: VFuncInfoFlags -> String
showsPrec :: Int -> VFuncInfoFlags -> ShowS
$cshowsPrec :: Int -> VFuncInfoFlags -> ShowS
Show, VFuncInfoFlags -> VFuncInfoFlags -> Bool
(VFuncInfoFlags -> VFuncInfoFlags -> Bool)
-> (VFuncInfoFlags -> VFuncInfoFlags -> Bool) -> Eq VFuncInfoFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
$c/= :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
== :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
$c== :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
Eq)

instance P.Enum VFuncInfoFlags where
    fromEnum :: VFuncInfoFlags -> Int
fromEnum VFuncInfoFlagsMustChainUp = 1
    fromEnum VFuncInfoFlagsMustOverride = 2
    fromEnum VFuncInfoFlagsMustNotOverride = 4
    fromEnum VFuncInfoFlagsThrows = 8
    fromEnum (AnotherVFuncInfoFlags k :: Int
k) = Int
k

    toEnum :: Int -> VFuncInfoFlags
toEnum 1 = VFuncInfoFlags
VFuncInfoFlagsMustChainUp
    toEnum 2 = VFuncInfoFlags
VFuncInfoFlagsMustOverride
    toEnum 4 = VFuncInfoFlags
VFuncInfoFlagsMustNotOverride
    toEnum 8 = VFuncInfoFlags
VFuncInfoFlagsThrows
    toEnum k :: Int
k = Int -> VFuncInfoFlags
AnotherVFuncInfoFlags Int
k

instance P.Ord VFuncInfoFlags where
    compare :: VFuncInfoFlags -> VFuncInfoFlags -> Ordering
compare a :: VFuncInfoFlags
a b :: VFuncInfoFlags
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (VFuncInfoFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum VFuncInfoFlags
a) (VFuncInfoFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum VFuncInfoFlags
b)

instance IsGFlag VFuncInfoFlags

-- Flags RepositoryLoadFlags
-- | Flags that control how a typelib is loaded.
data RepositoryLoadFlags = 
      RepositoryLoadFlagsIrepositoryLoadFlagLazy
    -- ^ Lazily load the typelib.
    | AnotherRepositoryLoadFlags Int
    -- ^ Catch-all for unknown values
    deriving (Int -> RepositoryLoadFlags -> ShowS
[RepositoryLoadFlags] -> ShowS
RepositoryLoadFlags -> String
(Int -> RepositoryLoadFlags -> ShowS)
-> (RepositoryLoadFlags -> String)
-> ([RepositoryLoadFlags] -> ShowS)
-> Show RepositoryLoadFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryLoadFlags] -> ShowS
$cshowList :: [RepositoryLoadFlags] -> ShowS
show :: RepositoryLoadFlags -> String
$cshow :: RepositoryLoadFlags -> String
showsPrec :: Int -> RepositoryLoadFlags -> ShowS
$cshowsPrec :: Int -> RepositoryLoadFlags -> ShowS
Show, RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
(RepositoryLoadFlags -> RepositoryLoadFlags -> Bool)
-> (RepositoryLoadFlags -> RepositoryLoadFlags -> Bool)
-> Eq RepositoryLoadFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
$c/= :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
== :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
$c== :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
Eq)

instance P.Enum RepositoryLoadFlags where
    fromEnum :: RepositoryLoadFlags -> Int
fromEnum RepositoryLoadFlagsIrepositoryLoadFlagLazy = 1
    fromEnum (AnotherRepositoryLoadFlags k :: Int
k) = Int
k

    toEnum :: Int -> RepositoryLoadFlags
toEnum 1 = RepositoryLoadFlags
RepositoryLoadFlagsIrepositoryLoadFlagLazy
    toEnum k :: Int
k = Int -> RepositoryLoadFlags
AnotherRepositoryLoadFlags Int
k

instance P.Ord RepositoryLoadFlags where
    compare :: RepositoryLoadFlags -> RepositoryLoadFlags -> Ordering
compare a :: RepositoryLoadFlags
a b :: RepositoryLoadFlags
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (RepositoryLoadFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum RepositoryLoadFlags
a) (RepositoryLoadFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum RepositoryLoadFlags
b)

instance IsGFlag RepositoryLoadFlags

-- Flags FunctionInfoFlags
-- | Flags for a @/GIFunctionInfo/@ struct.
data FunctionInfoFlags = 
      FunctionInfoFlagsIsMethod
    -- ^ is a method.
    | FunctionInfoFlagsIsConstructor
    -- ^ is a constructor.
    | FunctionInfoFlagsIsGetter
    -- ^ is a getter of a @/GIPropertyInfo/@.
    | FunctionInfoFlagsIsSetter
    -- ^ is a setter of a @/GIPropertyInfo/@.
    | FunctionInfoFlagsWrapsVfunc
    -- ^ represents a virtual function.
    | FunctionInfoFlagsThrows
    -- ^ the function may throw an error.
    | AnotherFunctionInfoFlags Int
    -- ^ Catch-all for unknown values
    deriving (Int -> FunctionInfoFlags -> ShowS
[FunctionInfoFlags] -> ShowS
FunctionInfoFlags -> String
(Int -> FunctionInfoFlags -> ShowS)
-> (FunctionInfoFlags -> String)
-> ([FunctionInfoFlags] -> ShowS)
-> Show FunctionInfoFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionInfoFlags] -> ShowS
$cshowList :: [FunctionInfoFlags] -> ShowS
show :: FunctionInfoFlags -> String
$cshow :: FunctionInfoFlags -> String
showsPrec :: Int -> FunctionInfoFlags -> ShowS
$cshowsPrec :: Int -> FunctionInfoFlags -> ShowS
Show, FunctionInfoFlags -> FunctionInfoFlags -> Bool
(FunctionInfoFlags -> FunctionInfoFlags -> Bool)
-> (FunctionInfoFlags -> FunctionInfoFlags -> Bool)
-> Eq FunctionInfoFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
$c/= :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
== :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
$c== :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
Eq)

instance P.Enum FunctionInfoFlags where
    fromEnum :: FunctionInfoFlags -> Int
fromEnum FunctionInfoFlagsIsMethod = 1
    fromEnum FunctionInfoFlagsIsConstructor = 2
    fromEnum FunctionInfoFlagsIsGetter = 4
    fromEnum FunctionInfoFlagsIsSetter = 8
    fromEnum FunctionInfoFlagsWrapsVfunc = 16
    fromEnum FunctionInfoFlagsThrows = 32
    fromEnum (AnotherFunctionInfoFlags k :: Int
k) = Int
k

    toEnum :: Int -> FunctionInfoFlags
toEnum 1 = FunctionInfoFlags
FunctionInfoFlagsIsMethod
    toEnum 2 = FunctionInfoFlags
FunctionInfoFlagsIsConstructor
    toEnum 4 = FunctionInfoFlags
FunctionInfoFlagsIsGetter
    toEnum 8 = FunctionInfoFlags
FunctionInfoFlagsIsSetter
    toEnum 16 = FunctionInfoFlags
FunctionInfoFlagsWrapsVfunc
    toEnum 32 = FunctionInfoFlags
FunctionInfoFlagsThrows
    toEnum k :: Int
k = Int -> FunctionInfoFlags
AnotherFunctionInfoFlags Int
k

instance P.Ord FunctionInfoFlags where
    compare :: FunctionInfoFlags -> FunctionInfoFlags -> Ordering
compare a :: FunctionInfoFlags
a b :: FunctionInfoFlags
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (FunctionInfoFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum FunctionInfoFlags
a) (FunctionInfoFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum FunctionInfoFlags
b)

instance IsGFlag FunctionInfoFlags

-- Flags FieldInfoFlags
-- | Flags for a @/GIFieldInfo/@.
data FieldInfoFlags = 
      FieldInfoFlagsReadable
    -- ^ field is readable.
    | FieldInfoFlagsWritable
    -- ^ field is writable.
    | AnotherFieldInfoFlags Int
    -- ^ Catch-all for unknown values
    deriving (Int -> FieldInfoFlags -> ShowS
[FieldInfoFlags] -> ShowS
FieldInfoFlags -> String
(Int -> FieldInfoFlags -> ShowS)
-> (FieldInfoFlags -> String)
-> ([FieldInfoFlags] -> ShowS)
-> Show FieldInfoFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldInfoFlags] -> ShowS
$cshowList :: [FieldInfoFlags] -> ShowS
show :: FieldInfoFlags -> String
$cshow :: FieldInfoFlags -> String
showsPrec :: Int -> FieldInfoFlags -> ShowS
$cshowsPrec :: Int -> FieldInfoFlags -> ShowS
Show, FieldInfoFlags -> FieldInfoFlags -> Bool
(FieldInfoFlags -> FieldInfoFlags -> Bool)
-> (FieldInfoFlags -> FieldInfoFlags -> Bool) -> Eq FieldInfoFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldInfoFlags -> FieldInfoFlags -> Bool
$c/= :: FieldInfoFlags -> FieldInfoFlags -> Bool
== :: FieldInfoFlags -> FieldInfoFlags -> Bool
$c== :: FieldInfoFlags -> FieldInfoFlags -> Bool
Eq)

instance P.Enum FieldInfoFlags where
    fromEnum :: FieldInfoFlags -> Int
fromEnum FieldInfoFlagsReadable = 1
    fromEnum FieldInfoFlagsWritable = 2
    fromEnum (AnotherFieldInfoFlags k :: Int
k) = Int
k

    toEnum :: Int -> FieldInfoFlags
toEnum 1 = FieldInfoFlags
FieldInfoFlagsReadable
    toEnum 2 = FieldInfoFlags
FieldInfoFlagsWritable
    toEnum k :: Int
k = Int -> FieldInfoFlags
AnotherFieldInfoFlags Int
k

instance P.Ord FieldInfoFlags where
    compare :: FieldInfoFlags -> FieldInfoFlags -> Ordering
compare a :: FieldInfoFlags
a b :: FieldInfoFlags
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (FieldInfoFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum FieldInfoFlags
a) (FieldInfoFlags -> Int
forall a. Enum a => a -> Int
P.fromEnum FieldInfoFlags
b)

instance IsGFlag FieldInfoFlags