packages feed

gi-webkit-0.2.4.13: GI/WebKit/Structs/WebPluginMIMEType.hs


{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

A structure representing one of the MIME types associated with a
plugin. A #GSList of these objects will be returned by
#webkit_web_plugin_get_mimetypes, use
#webkit_web_plugin_mime_type_list_free to free it.
-}

module GI.WebKit.Structs.WebPluginMIMEType
    ( 

-- * Exported types
    WebPluginMIMEType(..)                   ,
    newZeroWebPluginMIMEType                ,
    noWebPluginMIMEType                     ,


 -- * Properties
-- ** Description
    webPluginMIMETypeReadDescription        ,


-- ** Extensions
    webPluginMIMETypeReadExtensions         ,


-- ** Name
    webPluginMIMETypeReadName               ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.WebKit.Types
import GI.WebKit.Callbacks

newtype WebPluginMIMEType = WebPluginMIMEType (ForeignPtr WebPluginMIMEType)
-- | Construct a `WebPluginMIMEType` struct initialized to zero.
newZeroWebPluginMIMEType :: MonadIO m => m WebPluginMIMEType
newZeroWebPluginMIMEType = liftIO $ callocBytes 24 >>= wrapPtr WebPluginMIMEType

noWebPluginMIMEType :: Maybe WebPluginMIMEType
noWebPluginMIMEType = Nothing

webPluginMIMETypeReadName :: WebPluginMIMEType -> IO T.Text
webPluginMIMETypeReadName s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CString
    val' <- cstringToText val
    return val'

webPluginMIMETypeReadDescription :: WebPluginMIMEType -> IO T.Text
webPluginMIMETypeReadDescription s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    val' <- cstringToText val
    return val'

webPluginMIMETypeReadExtensions :: WebPluginMIMEType -> IO T.Text
webPluginMIMETypeReadExtensions s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO CString
    val' <- cstringToText val
    return val'

type family ResolveWebPluginMIMETypeMethod (t :: Symbol) (o :: *) :: * where
    ResolveWebPluginMIMETypeMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveWebPluginMIMETypeMethod t WebPluginMIMEType, MethodInfo info WebPluginMIMEType p) => IsLabelProxy t (WebPluginMIMEType -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveWebPluginMIMETypeMethod t WebPluginMIMEType, MethodInfo info WebPluginMIMEType p) => IsLabel t (WebPluginMIMEType -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif