packages feed

haskell-gi 0.10 → 0.10.1

raw patch · 2 files changed

+53/−1 lines, 2 files

Files

haskell-gi.cabal view
@@ -1,5 +1,5 @@ name:                haskell-gi-version:             0.10+version:             0.10.1 synopsis:            Generate Haskell bindings for GObject Introspection capable libraries description:         Generate Haskell bindings for GObject Introspection capable libraries. This includes most notably                      Gtk+, but many other libraries in the GObject ecosystem provide introspection data too.@@ -57,6 +57,7 @@                        GI.GIR.Method,                        GI.GIR.Object,                        GI.GIR.Parser,+                       GI.GIR.Property,                        GI.GIR.Repository,                        GI.GIR.Signal,                        GI.GIR.Struct,
+ src/GI/GIR/Property.hs view
@@ -0,0 +1,51 @@+module GI.GIR.Property+    ( Property(..)+    , PropertyFlag(..)+    , parseProperty+    ) where++import Data.Text (Text)+import Data.Monoid ((<>))++import GI.Type (Type)++import GI.GIR.Arg (parseTransfer)+import GI.GIR.BasicTypes (Transfer)+import GI.GIR.Parser+import GI.GIR.Type (parseType)++data PropertyFlag = PropertyReadable+                  | PropertyWritable+                  | PropertyConstruct+                  | PropertyConstructOnly+                    deriving (Show,Eq)++data Property = Property {+        propName :: Text,+        propType :: Type,+        propFlags :: [PropertyFlag],+        propTransfer :: Transfer,+        propDeprecated :: Maybe DeprecationInfo+    } deriving (Show, Eq)++parseProperty :: Parser Property+parseProperty = do+  name <- getAttr "name"+  t <- parseType+  transfer <- parseTransfer+  deprecated <- parseDeprecation+  readable <- optionalAttr "readable" True parseBool+  writable <- optionalAttr "writable" False parseBool+  construct <- optionalAttr "construct" False parseBool+  constructOnly <- optionalAttr "construct-only" False parseBool+  let flags = (if readable then [PropertyReadable] else [])+              <> (if writable then [PropertyWritable] else [])+              <> (if construct then [PropertyConstruct] else [])+              <> (if constructOnly then [PropertyConstructOnly] else [])+  return $ Property {+                  propName = name+                , propType = t+                , propFlags = flags+                , propTransfer = transfer+                , propDeprecated = deprecated+                }