1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
module Data.GI.GIR.Interface
( Interface(..)
, parseInterface
) where
import Data.Text (Text)
import Data.GI.GIR.Allocation (AllocationInfo, unknownAllocationInfo)
import Data.GI.GIR.Method (Method, MethodType(..), parseMethod)
import Data.GI.GIR.Property (Property, parseProperty)
import Data.GI.GIR.Signal (Signal, parseSignal)
import Data.GI.GIR.Parser
import Data.GI.GIR.Type (queryCType)
data Interface = Interface {
ifTypeInit :: Maybe Text,
ifCType :: Maybe Text,
ifDocumentation :: Documentation,
ifPrerequisites :: [Name],
ifProperties :: [Property],
ifSignals :: [Signal],
ifMethods :: [Method],
ifAllocationInfo :: AllocationInfo,
ifDeprecated :: Maybe DeprecationInfo
} deriving Show
parseInterface :: Parser (Name, Interface)
parseInterface = do
name <- parseName
props <- parseChildrenWithLocalName "property" parseProperty
signals <- parseChildrenWithNSName GLibGIRNS "signal" parseSignal
typeInit <- queryAttrWithNamespace GLibGIRNS "get-type"
methods <- parseChildrenWithLocalName "method" (parseMethod OrdinaryMethod)
functions <- parseChildrenWithLocalName "function" (parseMethod MemberFunction)
constructors <- parseChildrenWithLocalName "constructor" (parseMethod Constructor)
deprecated <- parseDeprecation
doc <- parseDocumentation
ctype <- queryCType
return (name,
Interface {
ifProperties = props
, ifPrerequisites = error ("unfixed interface " ++ show name)
, ifSignals = signals
, ifTypeInit = typeInit
, ifCType = ctype
, ifDocumentation = doc
, ifMethods = constructors ++ methods ++ functions
, ifAllocationInfo = unknownAllocationInfo
, ifDeprecated = deprecated
})
|