packages feed

qtah-qt5-0.8.0: src/Graphics/UI/Qtah/Generated/Core/QPluginLoader.hs

{-# LANGUAGE FlexibleContexts, FlexibleInstances, ForeignFunctionInterface, MonoLocalBinds, MultiParamTypeClasses, ScopedTypeVariables, TypeSynonymInstances, UndecidableInstances #-}
---------- GENERATED FILE, EDITS WILL BE LOST ----------

module Graphics.UI.Qtah.Generated.Core.QPluginLoader (
  castQPluginLoaderToQObject,
  castQObjectToQPluginLoader,
  QPluginLoaderValue (..),
  QPluginLoaderConstPtr (..),
  errorString,
  isLoaded,
  fileName,
  loadHints,
  QPluginLoaderPtr (..),
  getInstance,
  load,
  unload,
  setFileName,
  setLoadHints,
  staticInstances,
  QPluginLoaderConst (..),
  castQPluginLoaderToConst,
  QPluginLoader (..),
  castQPluginLoaderToNonconst,
  new,
  newWithParent,
  newWithFilename,
  newWithFilenameAndParent,
  QPluginLoaderSuper (..),
  QPluginLoaderSuperConst (..),
  ) where

import qualified Foreign as HoppyF
import qualified Foreign.C as HoppyFC
import qualified Foreign.Hoppy.Runtime as HoppyFHR
import qualified Graphics.UI.Qtah.Flags as QtahFlags
import qualified Graphics.UI.Qtah.Generated.Core.QLibrary as M60
import qualified Graphics.UI.Qtah.Generated.Core.QList.QObject as M202
import qualified Graphics.UI.Qtah.Generated.Core.QObject as M94
import qualified Graphics.UI.Qtah.Generated.Core.QString as M142
import Prelude (($), (.), (/=), (=<<), (==), (>>=))
import qualified Prelude as HoppyP
import qualified Prelude as QtahP

foreign import ccall "genpop__QPluginLoader_new" new' ::  HoppyP.IO (HoppyF.Ptr QPluginLoader)
foreign import ccall "genpop__QPluginLoader_newWithParent" newWithParent' ::  HoppyF.Ptr M94.QObject -> HoppyP.IO (HoppyF.Ptr QPluginLoader)
foreign import ccall "genpop__QPluginLoader_newWithFilename" newWithFilename' ::  HoppyF.Ptr M142.QStringConst -> HoppyP.IO (HoppyF.Ptr QPluginLoader)
foreign import ccall "genpop__QPluginLoader_newWithFilenameAndParent" newWithFilenameAndParent' ::  HoppyF.Ptr M142.QStringConst -> HoppyF.Ptr M94.QObject -> HoppyP.IO (HoppyF.Ptr QPluginLoader)
foreign import ccall "genpop__QPluginLoader_errorString" errorString' ::  HoppyF.Ptr QPluginLoaderConst -> HoppyP.IO (HoppyF.Ptr M142.QStringConst)
foreign import ccall "genpop__QPluginLoader_getInstance" getInstance' ::  HoppyF.Ptr QPluginLoader -> HoppyP.IO (HoppyF.Ptr M94.QObject)
foreign import ccall "genpop__QPluginLoader_isLoaded" isLoaded' ::  HoppyF.Ptr QPluginLoaderConst -> HoppyP.IO HoppyFC.CBool
foreign import ccall "genpop__QPluginLoader_load" load' ::  HoppyF.Ptr QPluginLoader -> HoppyP.IO HoppyFC.CBool
foreign import ccall "genpop__QPluginLoader_staticInstances" staticInstances' ::  HoppyP.IO (HoppyF.Ptr M202.QListQObjectConst)
foreign import ccall "genpop__QPluginLoader_unload" unload' ::  HoppyF.Ptr QPluginLoader -> HoppyP.IO HoppyFC.CBool
foreign import ccall "genpop__QPluginLoader_fileName" fileName' ::  HoppyF.Ptr QPluginLoaderConst -> HoppyP.IO (HoppyF.Ptr M142.QStringConst)
foreign import ccall "genpop__QPluginLoader_setFileName" setFileName' ::  HoppyF.Ptr QPluginLoader -> HoppyF.Ptr M142.QStringConst -> HoppyP.IO ()
foreign import ccall "genpop__QPluginLoader_loadHints" loadHints' ::  HoppyF.Ptr QPluginLoaderConst -> HoppyP.IO HoppyFC.CInt
foreign import ccall "genpop__QPluginLoader_setLoadHints" setLoadHints' ::  HoppyF.Ptr QPluginLoader -> HoppyFC.CInt -> HoppyP.IO ()
foreign import ccall "gencast__QPluginLoader__QObject" castQPluginLoaderToQObject :: HoppyF.Ptr QPluginLoaderConst -> HoppyF.Ptr M94.QObjectConst
foreign import ccall "gencast__QObject__QPluginLoader" castQObjectToQPluginLoader :: HoppyF.Ptr M94.QObjectConst -> HoppyF.Ptr QPluginLoaderConst
foreign import ccall "gendel__QPluginLoader" delete'QPluginLoader :: HoppyF.Ptr QPluginLoaderConst -> HoppyP.IO ()
foreign import ccall "&gendel__QPluginLoader" deletePtr'QPluginLoader :: HoppyF.FunPtr (HoppyF.Ptr QPluginLoaderConst -> HoppyP.IO ())

class QPluginLoaderValue a where
  withQPluginLoaderPtr :: a -> (QPluginLoaderConst -> HoppyP.IO b) -> HoppyP.IO b

instance {-# OVERLAPPABLE #-} QPluginLoaderConstPtr a => QPluginLoaderValue a where
  withQPluginLoaderPtr = HoppyP.flip ($) . toQPluginLoaderConst

class (M94.QObjectConstPtr this) => QPluginLoaderConstPtr this where
  toQPluginLoaderConst :: this -> QPluginLoaderConst

errorString :: (QPluginLoaderValue this) => (this) {- ^ this -} -> (HoppyP.IO QtahP.String)
errorString arg'1 =
  withQPluginLoaderPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (HoppyFHR.decodeAndDelete . M142.QStringConst) =<<
  (errorString' arg'1')

isLoaded :: (QPluginLoaderValue this) => (this) {- ^ this -} -> (HoppyP.IO HoppyP.Bool)
isLoaded arg'1 =
  withQPluginLoaderPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (
    (HoppyP.return . (/= 0))
  ) =<<
  (isLoaded' arg'1')

fileName :: (QPluginLoaderValue this) => (this) {- ^ this -} -> (HoppyP.IO QtahP.String)
fileName arg'1 =
  withQPluginLoaderPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (HoppyFHR.decodeAndDelete . M142.QStringConst) =<<
  (fileName' arg'1')

loadHints :: (QPluginLoaderValue this) => (this) {- ^ this -} -> (HoppyP.IO M60.QLibraryLoadHints)
loadHints arg'1 =
  withQPluginLoaderPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (
    QtahP.return . QtahFlags.numToFlags
  ) =<<
  (loadHints' arg'1')

class (QPluginLoaderConstPtr this, M94.QObjectPtr this) => QPluginLoaderPtr this where
  toQPluginLoader :: this -> QPluginLoader

getInstance :: (QPluginLoaderPtr this) => (this) {- ^ this -} -> (HoppyP.IO M94.QObject)
getInstance arg'1 =
  HoppyFHR.withCppPtr (toQPluginLoader arg'1) $ \arg'1' ->
  HoppyP.fmap M94.QObject
  (getInstance' arg'1')

load :: (QPluginLoaderPtr this) => (this) {- ^ this -} -> (HoppyP.IO HoppyP.Bool)
load arg'1 =
  HoppyFHR.withCppPtr (toQPluginLoader arg'1) $ \arg'1' ->
  (
    (HoppyP.return . (/= 0))
  ) =<<
  (load' arg'1')

unload :: (QPluginLoaderPtr this) => (this) {- ^ this -} -> (HoppyP.IO HoppyP.Bool)
unload arg'1 =
  HoppyFHR.withCppPtr (toQPluginLoader arg'1) $ \arg'1' ->
  (
    (HoppyP.return . (/= 0))
  ) =<<
  (unload' arg'1')

setFileName :: (QPluginLoaderPtr this, M142.QStringValue arg'2) => (this) {- ^ this -} -> (arg'2) -> (HoppyP.IO ())
setFileName arg'1 arg'2 =
  HoppyFHR.withCppPtr (toQPluginLoader arg'1) $ \arg'1' ->
  M142.withQStringPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' ->
  (setFileName' arg'1' arg'2')

setLoadHints :: (QPluginLoaderPtr this, M60.IsQLibraryLoadHints arg'2) => (this) {- ^ this -} -> (arg'2) -> (HoppyP.IO ())
setLoadHints arg'1 arg'2 =
  HoppyFHR.withCppPtr (toQPluginLoader arg'1) $ \arg'1' ->
  (
    QtahP.return . QtahFlags.flagsToNum . M60.toQLibraryLoadHints
  ) arg'2 >>= \arg'2' ->
  (setLoadHints' arg'1' arg'2')

staticInstances :: (HoppyP.IO [M94.QObject])
staticInstances =
  (HoppyFHR.decodeAndDelete . M202.QListQObjectConst) =<<
  (staticInstances')

data QPluginLoaderConst =
    QPluginLoaderConst (HoppyF.Ptr QPluginLoaderConst)
  | QPluginLoaderConstGc (HoppyF.ForeignPtr ()) (HoppyF.Ptr QPluginLoaderConst)
  deriving (HoppyP.Show)

instance HoppyP.Eq QPluginLoaderConst where
  x == y = HoppyFHR.toPtr x == HoppyFHR.toPtr y

instance HoppyP.Ord QPluginLoaderConst where
  compare x y = HoppyP.compare (HoppyFHR.toPtr x) (HoppyFHR.toPtr y)

castQPluginLoaderToConst :: QPluginLoader -> QPluginLoaderConst
castQPluginLoaderToConst (QPluginLoader ptr') = QPluginLoaderConst $ HoppyF.castPtr ptr'
castQPluginLoaderToConst (QPluginLoaderGc fptr' ptr') = QPluginLoaderConstGc fptr' $ HoppyF.castPtr ptr'

instance HoppyFHR.CppPtr QPluginLoaderConst where
  nullptr = QPluginLoaderConst HoppyF.nullPtr
  
  withCppPtr (QPluginLoaderConst ptr') f' = f' ptr'
  withCppPtr (QPluginLoaderConstGc fptr' ptr') f' = HoppyF.withForeignPtr fptr' $ \_ -> f' ptr'
  
  toPtr (QPluginLoaderConst ptr') = ptr'
  toPtr (QPluginLoaderConstGc _ ptr') = ptr'
  
  touchCppPtr (QPluginLoaderConst _) = HoppyP.return ()
  touchCppPtr (QPluginLoaderConstGc fptr' _) = HoppyF.touchForeignPtr fptr'

instance HoppyFHR.Deletable QPluginLoaderConst where
  delete (QPluginLoaderConst ptr') = delete'QPluginLoader ptr'
  delete (QPluginLoaderConstGc _ _) = HoppyP.fail $ HoppyP.concat ["Deletable.delete: Asked to delete a GC-managed ", "QPluginLoaderConst", " object."]
  
  toGc this'@(QPluginLoaderConst ptr') = if ptr' == HoppyF.nullPtr then HoppyP.return this' else HoppyP.fmap (HoppyP.flip QPluginLoaderConstGc ptr') $ HoppyF.newForeignPtr (HoppyF.castFunPtr deletePtr'QPluginLoader :: HoppyF.FunPtr (HoppyF.Ptr () -> HoppyP.IO ())) (HoppyF.castPtr ptr' :: HoppyF.Ptr ())
  toGc this'@(QPluginLoaderConstGc {}) = HoppyP.return this'

instance QPluginLoaderConstPtr QPluginLoaderConst where
  toQPluginLoaderConst = HoppyP.id

instance M94.QObjectConstPtr QPluginLoaderConst where
  toQObjectConst (QPluginLoaderConst ptr') = M94.QObjectConst $ castQPluginLoaderToQObject ptr'
  toQObjectConst (QPluginLoaderConstGc fptr' ptr') = M94.QObjectConstGc fptr' $ castQPluginLoaderToQObject ptr'

data QPluginLoader =
    QPluginLoader (HoppyF.Ptr QPluginLoader)
  | QPluginLoaderGc (HoppyF.ForeignPtr ()) (HoppyF.Ptr QPluginLoader)
  deriving (HoppyP.Show)

instance HoppyP.Eq QPluginLoader where
  x == y = HoppyFHR.toPtr x == HoppyFHR.toPtr y

instance HoppyP.Ord QPluginLoader where
  compare x y = HoppyP.compare (HoppyFHR.toPtr x) (HoppyFHR.toPtr y)

castQPluginLoaderToNonconst :: QPluginLoaderConst -> QPluginLoader
castQPluginLoaderToNonconst (QPluginLoaderConst ptr') = QPluginLoader $ HoppyF.castPtr ptr'
castQPluginLoaderToNonconst (QPluginLoaderConstGc fptr' ptr') = QPluginLoaderGc fptr' $ HoppyF.castPtr ptr'

instance HoppyFHR.CppPtr QPluginLoader where
  nullptr = QPluginLoader HoppyF.nullPtr
  
  withCppPtr (QPluginLoader ptr') f' = f' ptr'
  withCppPtr (QPluginLoaderGc fptr' ptr') f' = HoppyF.withForeignPtr fptr' $ \_ -> f' ptr'
  
  toPtr (QPluginLoader ptr') = ptr'
  toPtr (QPluginLoaderGc _ ptr') = ptr'
  
  touchCppPtr (QPluginLoader _) = HoppyP.return ()
  touchCppPtr (QPluginLoaderGc fptr' _) = HoppyF.touchForeignPtr fptr'

instance HoppyFHR.Deletable QPluginLoader where
  delete (QPluginLoader ptr') = delete'QPluginLoader $ (HoppyF.castPtr ptr' :: HoppyF.Ptr QPluginLoaderConst)
  delete (QPluginLoaderGc _ _) = HoppyP.fail $ HoppyP.concat ["Deletable.delete: Asked to delete a GC-managed ", "QPluginLoader", " object."]
  
  toGc this'@(QPluginLoader ptr') = if ptr' == HoppyF.nullPtr then HoppyP.return this' else HoppyP.fmap (HoppyP.flip QPluginLoaderGc ptr') $ HoppyF.newForeignPtr (HoppyF.castFunPtr deletePtr'QPluginLoader :: HoppyF.FunPtr (HoppyF.Ptr () -> HoppyP.IO ())) (HoppyF.castPtr ptr' :: HoppyF.Ptr ())
  toGc this'@(QPluginLoaderGc {}) = HoppyP.return this'

instance QPluginLoaderConstPtr QPluginLoader where
  toQPluginLoaderConst (QPluginLoader ptr') = QPluginLoaderConst $ (HoppyF.castPtr :: HoppyF.Ptr QPluginLoader -> HoppyF.Ptr QPluginLoaderConst) ptr'
  toQPluginLoaderConst (QPluginLoaderGc fptr' ptr') = QPluginLoaderConstGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr QPluginLoader -> HoppyF.Ptr QPluginLoaderConst) ptr'

instance QPluginLoaderPtr QPluginLoader where
  toQPluginLoader = HoppyP.id

instance M94.QObjectConstPtr QPluginLoader where
  toQObjectConst (QPluginLoader ptr') = M94.QObjectConst $ castQPluginLoaderToQObject $ (HoppyF.castPtr :: HoppyF.Ptr QPluginLoader -> HoppyF.Ptr QPluginLoaderConst) ptr'
  toQObjectConst (QPluginLoaderGc fptr' ptr') = M94.QObjectConstGc fptr' $ castQPluginLoaderToQObject $ (HoppyF.castPtr :: HoppyF.Ptr QPluginLoader -> HoppyF.Ptr QPluginLoaderConst) ptr'

instance M94.QObjectPtr QPluginLoader where
  toQObject (QPluginLoader ptr') = M94.QObject $ (HoppyF.castPtr :: HoppyF.Ptr M94.QObjectConst -> HoppyF.Ptr M94.QObject) $ castQPluginLoaderToQObject $ (HoppyF.castPtr :: HoppyF.Ptr QPluginLoader -> HoppyF.Ptr QPluginLoaderConst) ptr'
  toQObject (QPluginLoaderGc fptr' ptr') = M94.QObjectGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr M94.QObjectConst -> HoppyF.Ptr M94.QObject) $ castQPluginLoaderToQObject $ (HoppyF.castPtr :: HoppyF.Ptr QPluginLoader -> HoppyF.Ptr QPluginLoaderConst) ptr'

new :: (HoppyP.IO QPluginLoader)
new =
  HoppyP.fmap QPluginLoader
  (new')

newWithParent :: (M94.QObjectPtr arg'1) => (arg'1) -> (HoppyP.IO QPluginLoader)
newWithParent arg'1 =
  HoppyFHR.withCppPtr (M94.toQObject arg'1) $ \arg'1' ->
  HoppyP.fmap QPluginLoader
  (newWithParent' arg'1')

newWithFilename :: (M142.QStringValue arg'1) => (arg'1) -> (HoppyP.IO QPluginLoader)
newWithFilename arg'1 =
  M142.withQStringPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  HoppyP.fmap QPluginLoader
  (newWithFilename' arg'1')

newWithFilenameAndParent :: (M142.QStringValue arg'1, M94.QObjectPtr arg'2) => (arg'1) -> (arg'2) -> (HoppyP.IO QPluginLoader)
newWithFilenameAndParent arg'1 arg'2 =
  M142.withQStringPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  HoppyFHR.withCppPtr (M94.toQObject arg'2) $ \arg'2' ->
  HoppyP.fmap QPluginLoader
  (newWithFilenameAndParent' arg'1' arg'2')

class QPluginLoaderSuper a where
  downToQPluginLoader :: a -> QPluginLoader

instance QPluginLoaderSuper M94.QObject where
  downToQPluginLoader = castQPluginLoaderToNonconst . cast' . M94.castQObjectToConst
    where
      cast' (M94.QObjectConst ptr') = QPluginLoaderConst $ castQObjectToQPluginLoader ptr'
      cast' (M94.QObjectConstGc fptr' ptr') = QPluginLoaderConstGc fptr' $ castQObjectToQPluginLoader ptr'

class QPluginLoaderSuperConst a where
  downToQPluginLoaderConst :: a -> QPluginLoaderConst

instance QPluginLoaderSuperConst M94.QObjectConst where
  downToQPluginLoaderConst = cast'
    where
      cast' (M94.QObjectConst ptr') = QPluginLoaderConst $ castQObjectToQPluginLoader ptr'
      cast' (M94.QObjectConstGc fptr' ptr') = QPluginLoaderConstGc fptr' $ castQObjectToQPluginLoader ptr'

instance HoppyFHR.Assignable (HoppyF.Ptr (HoppyF.Ptr QPluginLoader)) QPluginLoader where
  assign ptr' value' = HoppyF.poke ptr' $ HoppyFHR.toPtr value'

instance HoppyFHR.Decodable (HoppyF.Ptr (HoppyF.Ptr QPluginLoader)) QPluginLoader where
  decode = HoppyP.fmap QPluginLoader . HoppyF.peek