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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
-- | Basic types used in GIR parsing.
module Data.GI.GIR.BasicTypes
( Name(..)
, Transfer(..)
, Alias(..)
, Type(..)
, BasicType(..)
) where
import Data.Text (Text)
-- | Name for a symbol in the GIR file.
data Name = Name { namespace :: Text, name :: Text }
deriving (Eq, Ord, Show)
-- | Transfer mode for an argument or property.
data Transfer = TransferNothing
| TransferContainer
| TransferEverything
deriving (Show, Eq, Ord)
-- | An alias, which is simply (Namespace, name).
newtype Alias = Alias Name deriving (Ord, Eq, Show)
-- | Basic types. These are generally trivial to marshal, and the GIR
-- assumes that they are defined.
data BasicType = TBoolean -- ^ gboolean
| TInt -- ^ gint
| TUInt -- ^ guint
| TLong -- ^ glong
| TULong -- ^ gulong
| TInt8 -- ^ gint8
| TUInt8 -- ^ guint8
| TInt16 -- ^ gint16
| TUInt16 -- ^ guint16
| TInt32 -- ^ gint32
| TUInt32 -- ^ guint32
| TInt64 -- ^ gint64
| TUInt64 -- ^ guint64
| TFloat -- ^ gfloat
| TDouble -- ^ gdouble
| TUniChar -- ^ gunichar
| TGType -- ^ GType
| TUTF8 -- ^ gchar*, encoded as UTF-8
| TFileName -- ^ gchar*, encoding a filename
| TPtr -- ^ gpointer
| TIntPtr -- ^ gintptr
| TUIntPtr -- ^ guintptr
| TShort -- ^ gshort
| TUShort -- ^ gushort
| TSize -- ^ gsize
| TSSize -- ^ gssize
| Ttime_t -- ^ time_t
| Toff_t -- ^ off_t
| Tdev_t -- ^ dev_t
| Tgid_t -- ^ gid_t
| Tpid_t -- ^ pid_t
| Tsocklen_t -- ^ socklen_t
| Tuid_t -- ^ uid_t
deriving (Eq, Show, Ord)
-- | This type represents the types found in GObject Introspection
-- interfaces: the types of constants, arguments, etc.
data Type
= TBasicType BasicType
| TError -- ^ GError
| TVariant -- ^ GVariant
| TGValue -- ^ GValue
| TParamSpec -- ^ GParamSpec
| TCArray Bool Int Int Type -- ^ Zero terminated, Array Fixed
-- Size, Array Length, Element Type
| TGArray Type -- ^ GArray
| TPtrArray Type -- ^ GPtrArray
| TByteArray -- ^ GByteArray
| TGList Type -- ^ GList
| TGSList Type -- ^ GSList
| TGHash Type Type -- ^ GHashTable
| TGClosure (Maybe Type) -- ^ GClosure containing the given API (if known)
| TInterface Name -- ^ A reference to some API in the GIR
deriving (Eq, Show, Ord)
|