-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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
import qualified GHC.Records as R


-- 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
$cshowsPrec :: Int -> VFuncInfoFlags -> ShowS
showsPrec :: Int -> VFuncInfoFlags -> ShowS
$cshow :: VFuncInfoFlags -> String
show :: VFuncInfoFlags -> String
$cshowList :: [VFuncInfoFlags] -> ShowS
showList :: [VFuncInfoFlags] -> ShowS
Show, VFuncInfoFlags -> VFuncInfoFlags -> Bool
(VFuncInfoFlags -> VFuncInfoFlags -> Bool)
-> (VFuncInfoFlags -> VFuncInfoFlags -> Bool) -> Eq VFuncInfoFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
== :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
$c/= :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
/= :: VFuncInfoFlags -> VFuncInfoFlags -> Bool
Eq)

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

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

instance P.Ord VFuncInfoFlags where
    compare :: VFuncInfoFlags -> VFuncInfoFlags -> Ordering
compare VFuncInfoFlags
a 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
$cshowsPrec :: Int -> RepositoryLoadFlags -> ShowS
showsPrec :: Int -> RepositoryLoadFlags -> ShowS
$cshow :: RepositoryLoadFlags -> String
show :: RepositoryLoadFlags -> String
$cshowList :: [RepositoryLoadFlags] -> ShowS
showList :: [RepositoryLoadFlags] -> ShowS
Show, RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
(RepositoryLoadFlags -> RepositoryLoadFlags -> Bool)
-> (RepositoryLoadFlags -> RepositoryLoadFlags -> Bool)
-> Eq RepositoryLoadFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
== :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
$c/= :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
/= :: RepositoryLoadFlags -> RepositoryLoadFlags -> Bool
Eq)

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

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

instance P.Ord RepositoryLoadFlags where
    compare :: RepositoryLoadFlags -> RepositoryLoadFlags -> Ordering
compare RepositoryLoadFlags
a 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
$cshowsPrec :: Int -> FunctionInfoFlags -> ShowS
showsPrec :: Int -> FunctionInfoFlags -> ShowS
$cshow :: FunctionInfoFlags -> String
show :: FunctionInfoFlags -> String
$cshowList :: [FunctionInfoFlags] -> ShowS
showList :: [FunctionInfoFlags] -> ShowS
Show, FunctionInfoFlags -> FunctionInfoFlags -> Bool
(FunctionInfoFlags -> FunctionInfoFlags -> Bool)
-> (FunctionInfoFlags -> FunctionInfoFlags -> Bool)
-> Eq FunctionInfoFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
== :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
$c/= :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
/= :: FunctionInfoFlags -> FunctionInfoFlags -> Bool
Eq)

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

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

instance P.Ord FunctionInfoFlags where
    compare :: FunctionInfoFlags -> FunctionInfoFlags -> Ordering
compare FunctionInfoFlags
a 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
$cshowsPrec :: Int -> FieldInfoFlags -> ShowS
showsPrec :: Int -> FieldInfoFlags -> ShowS
$cshow :: FieldInfoFlags -> String
show :: FieldInfoFlags -> String
$cshowList :: [FieldInfoFlags] -> ShowS
showList :: [FieldInfoFlags] -> ShowS
Show, FieldInfoFlags -> FieldInfoFlags -> Bool
(FieldInfoFlags -> FieldInfoFlags -> Bool)
-> (FieldInfoFlags -> FieldInfoFlags -> Bool) -> Eq FieldInfoFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FieldInfoFlags -> FieldInfoFlags -> Bool
== :: FieldInfoFlags -> FieldInfoFlags -> Bool
$c/= :: FieldInfoFlags -> FieldInfoFlags -> Bool
/= :: FieldInfoFlags -> FieldInfoFlags -> Bool
Eq)

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

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

instance P.Ord FieldInfoFlags where
    compare :: FieldInfoFlags -> FieldInfoFlags -> Ordering
compare FieldInfoFlags
a 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