-- | Parsing of bitfields, a.k.a. flags. They are represented in the
-- same way as enums, so this is a thin wrapper over that code.
module Data.GI.GIR.Flags
    ( Flags(..)
    , parseFlags
    ) where

import Data.GI.GIR.Enum (Enumeration, parseEnum)
import Data.GI.GIR.Parser

data Flags = Flags Enumeration
    deriving Int -> Flags -> ShowS
[Flags] -> ShowS
Flags -> String
(Int -> Flags -> ShowS)
-> (Flags -> String) -> ([Flags] -> ShowS) -> Show Flags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Flags] -> ShowS
$cshowList :: [Flags] -> ShowS
show :: Flags -> String
$cshow :: Flags -> String
showsPrec :: Int -> Flags -> ShowS
$cshowsPrec :: Int -> Flags -> ShowS
Show

parseFlags :: Parser (Name, Flags)
parseFlags :: Parser (Name, Flags)
parseFlags = do
  (n :: Name
n, enum :: Enumeration
enum) <- Parser (Name, Enumeration)
parseEnum
  (Name, Flags) -> Parser (Name, Flags)
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
n, Enumeration -> Flags
Flags Enumeration
enum)