module Data.GI.GIR.Signal
    ( Signal(..)
    , parseSignal
    ) where

import Data.Text (Text)

import Data.GI.GIR.Callable (Callable(..), parseCallable)
import Data.GI.GIR.Parser

data Signal = Signal {
        Signal -> Text
sigName :: Text,
        Signal -> Callable
sigCallable :: Callable,
        Signal -> Maybe DeprecationInfo
sigDeprecated :: Maybe DeprecationInfo,
        Signal -> Bool
sigDetailed :: Bool,
        Signal -> Documentation
sigDoc :: Documentation
    } deriving (Int -> Signal -> ShowS
[Signal] -> ShowS
Signal -> String
(Int -> Signal -> ShowS)
-> (Signal -> String) -> ([Signal] -> ShowS) -> Show Signal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Signal] -> ShowS
$cshowList :: [Signal] -> ShowS
show :: Signal -> String
$cshow :: Signal -> String
showsPrec :: Int -> Signal -> ShowS
$cshowsPrec :: Int -> Signal -> ShowS
Show, Signal -> Signal -> Bool
(Signal -> Signal -> Bool)
-> (Signal -> Signal -> Bool) -> Eq Signal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Signal -> Signal -> Bool
$c/= :: Signal -> Signal -> Bool
== :: Signal -> Signal -> Bool
$c== :: Signal -> Signal -> Bool
Eq)

parseSignal :: Parser Signal
parseSignal :: Parser Signal
parseSignal = do
  Text
n <- Name -> Parser Text
getAttr Name
"name"
  Bool
detailed <- Name -> Bool -> (Text -> Parser Bool) -> Parser Bool
forall a. Name -> a -> (Text -> Parser a) -> Parser a
optionalAttr Name
"detailed" Bool
False Text -> Parser Bool
parseBool
  Maybe DeprecationInfo
deprecated <- Parser (Maybe DeprecationInfo)
parseDeprecation
  Callable
callable <- Parser Callable
parseCallable
  Documentation
doc <- Parser Documentation
parseDocumentation
  Signal -> Parser Signal
forall (m :: * -> *) a. Monad m => a -> m a
return (Signal -> Parser Signal) -> Signal -> Parser Signal
forall a b. (a -> b) -> a -> b
$ Signal :: Text
-> Callable
-> Maybe DeprecationInfo
-> Bool
-> Documentation
-> Signal
Signal {
                sigName :: Text
sigName = Text
n
              , sigCallable :: Callable
sigCallable = Callable
callable
              , sigDeprecated :: Maybe DeprecationInfo
sigDeprecated = Maybe DeprecationInfo
deprecated
              , sigDetailed :: Bool
sigDetailed = Bool
detailed
              , sigDoc :: Documentation
sigDoc = Documentation
doc
              }