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

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