module Data.GI.GIR.Callback
( Callback(..)
, parseCallback
) where
import Data.Text (Text)
import Data.GI.GIR.Callable (Callable, parseCallable)
import Data.GI.GIR.Parser
import Data.GI.GIR.Type (queryCType)
data Callback = Callback { Callback -> Callable
cbCallable :: Callable
, Callback -> Maybe Text
cbCType :: Maybe Text
, Callback -> Documentation
cbDocumentation :: Documentation
}
deriving Int -> Callback -> ShowS
[Callback] -> ShowS
Callback -> String
(Int -> Callback -> ShowS)
-> (Callback -> String) -> ([Callback] -> ShowS) -> Show Callback
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Callback] -> ShowS
$cshowList :: [Callback] -> ShowS
show :: Callback -> String
$cshow :: Callback -> String
showsPrec :: Int -> Callback -> ShowS
$cshowsPrec :: Int -> Callback -> ShowS
Show
parseCallback :: Parser (Name, Callback)
parseCallback :: Parser (Name, Callback)
parseCallback = do
Name
name <- Parser Name
parseName
Callable
callable <- Parser Callable
parseCallable
Maybe Text
ctype <- Parser (Maybe Text)
queryCType
Documentation
doc <- Parser Documentation
parseDocumentation
(Name, Callback) -> Parser (Name, Callback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
name, Callback :: Callable -> Maybe Text -> Documentation -> Callback
Callback { cbCallable :: Callable
cbCallable = Callable
callable
, cbCType :: Maybe Text
cbCType = Maybe Text
ctype
, cbDocumentation :: Documentation
cbDocumentation = Documentation
doc })