{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GES.Objects.CommandLineFormatter
    ( 

-- * Exported types
    CommandLineFormatter(..)                ,
    IsCommandLineFormatter                  ,
    toCommandLineFormatter                  ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [loadFromUri]("GI.GES.Objects.Formatter#g:method:loadFromUri"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [saveToUri]("GI.GES.Objects.Formatter#g:method:saveToUri"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getAsset]("GI.GES.Interfaces.Extractable#g:method:getAsset"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getId]("GI.GES.Interfaces.Extractable#g:method:getId"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setAsset]("GI.GES.Interfaces.Extractable#g:method:setAsset"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveCommandLineFormatterMethod       ,
#endif

-- ** getHelp #method:getHelp#

    commandLineFormatterGetHelp             ,


-- ** getTimelineUri #method:getTimelineUri#

    commandLineFormatterGetTimelineUri      ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import {-# SOURCE #-} qualified GI.GES.Interfaces.Extractable as GES.Extractable
import {-# SOURCE #-} qualified GI.GES.Objects.Formatter as GES.Formatter
import {-# SOURCE #-} qualified GI.GES.Objects.Timeline as GES.Timeline
import qualified GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype CommandLineFormatter = CommandLineFormatter (SP.ManagedPtr CommandLineFormatter)
    deriving (CommandLineFormatter -> CommandLineFormatter -> Bool
(CommandLineFormatter -> CommandLineFormatter -> Bool)
-> (CommandLineFormatter -> CommandLineFormatter -> Bool)
-> Eq CommandLineFormatter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CommandLineFormatter -> CommandLineFormatter -> Bool
== :: CommandLineFormatter -> CommandLineFormatter -> Bool
$c/= :: CommandLineFormatter -> CommandLineFormatter -> Bool
/= :: CommandLineFormatter -> CommandLineFormatter -> Bool
Eq)

instance SP.ManagedPtrNewtype CommandLineFormatter where
    toManagedPtr :: CommandLineFormatter -> ManagedPtr CommandLineFormatter
toManagedPtr (CommandLineFormatter ManagedPtr CommandLineFormatter
p) = ManagedPtr CommandLineFormatter
p

foreign import ccall "ges_command_line_formatter_get_type"
    c_ges_command_line_formatter_get_type :: IO B.Types.GType

instance B.Types.TypedObject CommandLineFormatter where
    glibType :: IO GType
glibType = IO GType
c_ges_command_line_formatter_get_type

instance B.Types.GObject CommandLineFormatter

-- | Type class for types which can be safely cast to `CommandLineFormatter`, for instance with `toCommandLineFormatter`.
class (SP.GObject o, O.IsDescendantOf CommandLineFormatter o) => IsCommandLineFormatter o
instance (SP.GObject o, O.IsDescendantOf CommandLineFormatter o) => IsCommandLineFormatter o

instance O.HasParentTypes CommandLineFormatter
type instance O.ParentTypes CommandLineFormatter = '[GES.Formatter.Formatter, GObject.Object.Object, GES.Extractable.Extractable]

-- | Cast to `CommandLineFormatter`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toCommandLineFormatter :: (MIO.MonadIO m, IsCommandLineFormatter o) => o -> m CommandLineFormatter
toCommandLineFormatter :: forall (m :: * -> *) o.
(MonadIO m, IsCommandLineFormatter o) =>
o -> m CommandLineFormatter
toCommandLineFormatter = IO CommandLineFormatter -> m CommandLineFormatter
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO CommandLineFormatter -> m CommandLineFormatter)
-> (o -> IO CommandLineFormatter) -> o -> m CommandLineFormatter
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr CommandLineFormatter -> CommandLineFormatter)
-> o -> IO CommandLineFormatter
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr CommandLineFormatter -> CommandLineFormatter
CommandLineFormatter

-- | Convert 'CommandLineFormatter' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe CommandLineFormatter) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ges_command_line_formatter_get_type
    gvalueSet_ :: Ptr GValue -> Maybe CommandLineFormatter -> IO ()
gvalueSet_ Ptr GValue
gv Maybe CommandLineFormatter
P.Nothing = Ptr GValue -> Ptr CommandLineFormatter -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr CommandLineFormatter
forall a. Ptr a
FP.nullPtr :: FP.Ptr CommandLineFormatter)
    gvalueSet_ Ptr GValue
gv (P.Just CommandLineFormatter
obj) = CommandLineFormatter
-> (Ptr CommandLineFormatter -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CommandLineFormatter
obj (Ptr GValue -> Ptr CommandLineFormatter -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe CommandLineFormatter)
gvalueGet_ Ptr GValue
gv = do
        Ptr CommandLineFormatter
ptr <- Ptr GValue -> IO (Ptr CommandLineFormatter)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr CommandLineFormatter)
        if Ptr CommandLineFormatter
ptr Ptr CommandLineFormatter -> Ptr CommandLineFormatter -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr CommandLineFormatter
forall a. Ptr a
FP.nullPtr
        then CommandLineFormatter -> Maybe CommandLineFormatter
forall a. a -> Maybe a
P.Just (CommandLineFormatter -> Maybe CommandLineFormatter)
-> IO CommandLineFormatter -> IO (Maybe CommandLineFormatter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr CommandLineFormatter -> CommandLineFormatter)
-> Ptr CommandLineFormatter -> IO CommandLineFormatter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr CommandLineFormatter -> CommandLineFormatter
CommandLineFormatter Ptr CommandLineFormatter
ptr
        else Maybe CommandLineFormatter -> IO (Maybe CommandLineFormatter)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe CommandLineFormatter
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveCommandLineFormatterMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveCommandLineFormatterMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCommandLineFormatterMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCommandLineFormatterMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCommandLineFormatterMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCommandLineFormatterMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveCommandLineFormatterMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCommandLineFormatterMethod "loadFromUri" o = GES.Formatter.FormatterLoadFromUriMethodInfo
    ResolveCommandLineFormatterMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCommandLineFormatterMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCommandLineFormatterMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveCommandLineFormatterMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCommandLineFormatterMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCommandLineFormatterMethod "saveToUri" o = GES.Formatter.FormatterSaveToUriMethodInfo
    ResolveCommandLineFormatterMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCommandLineFormatterMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCommandLineFormatterMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCommandLineFormatterMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveCommandLineFormatterMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCommandLineFormatterMethod "getAsset" o = GES.Extractable.ExtractableGetAssetMethodInfo
    ResolveCommandLineFormatterMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCommandLineFormatterMethod "getId" o = GES.Extractable.ExtractableGetIdMethodInfo
    ResolveCommandLineFormatterMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCommandLineFormatterMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCommandLineFormatterMethod "setAsset" o = GES.Extractable.ExtractableSetAssetMethodInfo
    ResolveCommandLineFormatterMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCommandLineFormatterMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveCommandLineFormatterMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveCommandLineFormatterMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCommandLineFormatterMethod t CommandLineFormatter, O.OverloadedMethod info CommandLineFormatter p) => OL.IsLabel t (CommandLineFormatter -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveCommandLineFormatterMethod t CommandLineFormatter, O.OverloadedMethod info CommandLineFormatter p, R.HasField t CommandLineFormatter p) => R.HasField t CommandLineFormatter p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveCommandLineFormatterMethod t CommandLineFormatter, O.OverloadedMethodInfo info CommandLineFormatter) => OL.IsLabel t (O.MethodProxy info CommandLineFormatter) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList CommandLineFormatter
type instance O.AttributeList CommandLineFormatter = CommandLineFormatterAttributeList
type CommandLineFormatterAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList CommandLineFormatter = CommandLineFormatterSignalList
type CommandLineFormatterSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method CommandLineFormatter::get_help
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "nargs"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of commands in @commands"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "commands"
--           , argType = TCArray False (-1) 0 (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Commands" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "nargs"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Number of commands in @commands"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ges_command_line_formatter_get_help" ges_command_line_formatter_get_help :: 
    Int32 ->                                -- nargs : TBasicType TInt
    Ptr CString ->                          -- commands : TCArray False (-1) 0 (TBasicType TUTF8)
    IO CString

-- | Creates a help string based on /@commands@/.
-- 
-- Result: (transfer full): A help string.
-- 
-- /Since: 1.10/
commandLineFormatterGetHelp ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    -- ^ /@commands@/: Commands
    -> m T.Text
commandLineFormatterGetHelp :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Text] -> m Text
commandLineFormatterGetHelp [Text]
commands = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    let nargs :: Int32
nargs = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Text] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Text]
commands
    Ptr (Ptr CChar)
commands' <- [Text] -> IO (Ptr (Ptr CChar))
packUTF8CArray [Text]
commands
    Ptr CChar
result <- Int32 -> Ptr (Ptr CChar) -> IO (Ptr CChar)
ges_command_line_formatter_get_help Int32
nargs Ptr (Ptr CChar)
commands'
    Text -> Ptr CChar -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"commandLineFormatterGetHelp" Ptr CChar
result
    Text
result' <- HasCallStack => Ptr CChar -> IO Text
Ptr CChar -> IO Text
cstringToText Ptr CChar
result
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
result
    (Int32 -> (Ptr CChar -> IO ()) -> Ptr (Ptr CChar) -> IO ()
forall a b c.
(Storable a, Integral b) =>
b -> (a -> IO c) -> Ptr a -> IO ()
mapCArrayWithLength Int32
nargs) Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CChar)
commands'
    Ptr (Ptr CChar) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CChar)
commands'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method CommandLineFormatter::get_timeline_uri
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "timeline"
--           , argType =
--               TInterface Name { namespace = "GES" , name = "Timeline" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A GESTimeline to serialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ges_command_line_formatter_get_timeline_uri" ges_command_line_formatter_get_timeline_uri :: 
    Ptr GES.Timeline.Timeline ->            -- timeline : TInterface (Name {namespace = "GES", name = "Timeline"})
    IO CString

-- | /No description available in the introspection data./
-- 
-- /Since: 1.10/
commandLineFormatterGetTimelineUri ::
    (B.CallStack.HasCallStack, MonadIO m, GES.Timeline.IsTimeline a) =>
    a
    -- ^ /@timeline@/: A GESTimeline to serialize
    -> m T.Text
commandLineFormatterGetTimelineUri :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTimeline a) =>
a -> m Text
commandLineFormatterGetTimelineUri a
timeline = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Timeline
timeline' <- a -> IO (Ptr Timeline)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
timeline
    Ptr CChar
result <- Ptr Timeline -> IO (Ptr CChar)
ges_command_line_formatter_get_timeline_uri Ptr Timeline
timeline'
    Text -> Ptr CChar -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"commandLineFormatterGetTimelineUri" Ptr CChar
result
    Text
result' <- HasCallStack => Ptr CChar -> IO Text
Ptr CChar -> IO Text
cstringToText Ptr CChar
result
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
timeline
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
#endif