#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.CharsetConverter
(
CharsetConverter(..) ,
IsCharsetConverter ,
toCharsetConverter ,
noCharsetConverter ,
#if ENABLE_OVERLOADING
CharsetConverterGetNumFallbacksMethodInfo,
#endif
charsetConverterGetNumFallbacks ,
#if ENABLE_OVERLOADING
CharsetConverterGetUseFallbackMethodInfo,
#endif
charsetConverterGetUseFallback ,
charsetConverterNew ,
#if ENABLE_OVERLOADING
CharsetConverterSetUseFallbackMethodInfo,
#endif
charsetConverterSetUseFallback ,
#if ENABLE_OVERLOADING
CharsetConverterFromCharsetPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
charsetConverterFromCharset ,
#endif
constructCharsetConverterFromCharset ,
getCharsetConverterFromCharset ,
#if ENABLE_OVERLOADING
CharsetConverterToCharsetPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
charsetConverterToCharset ,
#endif
constructCharsetConverterToCharset ,
getCharsetConverterToCharset ,
#if ENABLE_OVERLOADING
CharsetConverterUseFallbackPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
charsetConverterUseFallback ,
#endif
constructCharsetConverterUseFallback ,
getCharsetConverterUseFallback ,
setCharsetConverterUseFallback ,
) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Converter as Gio.Converter
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Initable as Gio.Initable
newtype CharsetConverter = CharsetConverter (ManagedPtr CharsetConverter)
foreign import ccall "g_charset_converter_get_type"
c_g_charset_converter_get_type :: IO GType
instance GObject CharsetConverter where
gobjectType = c_g_charset_converter_get_type
class (GObject o, O.IsDescendantOf CharsetConverter o) => IsCharsetConverter o
instance (GObject o, O.IsDescendantOf CharsetConverter o) => IsCharsetConverter o
instance O.HasParentTypes CharsetConverter
type instance O.ParentTypes CharsetConverter = '[GObject.Object.Object, Gio.Converter.Converter, Gio.Initable.Initable]
toCharsetConverter :: (MonadIO m, IsCharsetConverter o) => o -> m CharsetConverter
toCharsetConverter = liftIO . unsafeCastTo CharsetConverter
noCharsetConverter :: Maybe CharsetConverter
noCharsetConverter = Nothing
#if ENABLE_OVERLOADING
type family ResolveCharsetConverterMethod (t :: Symbol) (o :: *) :: * where
ResolveCharsetConverterMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCharsetConverterMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCharsetConverterMethod "convert" o = Gio.Converter.ConverterConvertMethodInfo
ResolveCharsetConverterMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCharsetConverterMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCharsetConverterMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCharsetConverterMethod "init" o = Gio.Initable.InitableInitMethodInfo
ResolveCharsetConverterMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCharsetConverterMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCharsetConverterMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCharsetConverterMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCharsetConverterMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCharsetConverterMethod "reset" o = Gio.Converter.ConverterResetMethodInfo
ResolveCharsetConverterMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCharsetConverterMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCharsetConverterMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCharsetConverterMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCharsetConverterMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCharsetConverterMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCharsetConverterMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCharsetConverterMethod "getNumFallbacks" o = CharsetConverterGetNumFallbacksMethodInfo
ResolveCharsetConverterMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCharsetConverterMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCharsetConverterMethod "getUseFallback" o = CharsetConverterGetUseFallbackMethodInfo
ResolveCharsetConverterMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCharsetConverterMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCharsetConverterMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCharsetConverterMethod "setUseFallback" o = CharsetConverterSetUseFallbackMethodInfo
ResolveCharsetConverterMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCharsetConverterMethod t CharsetConverter, O.MethodInfo info CharsetConverter p) => OL.IsLabel t (CharsetConverter -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
getCharsetConverterFromCharset :: (MonadIO m, IsCharsetConverter o) => o -> m (Maybe T.Text)
getCharsetConverterFromCharset obj = liftIO $ B.Properties.getObjectPropertyString obj "from-charset"
constructCharsetConverterFromCharset :: (IsCharsetConverter o) => T.Text -> IO (GValueConstruct o)
constructCharsetConverterFromCharset val = B.Properties.constructObjectPropertyString "from-charset" (Just val)
#if ENABLE_OVERLOADING
data CharsetConverterFromCharsetPropertyInfo
instance AttrInfo CharsetConverterFromCharsetPropertyInfo where
type AttrAllowedOps CharsetConverterFromCharsetPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CharsetConverterFromCharsetPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint CharsetConverterFromCharsetPropertyInfo = IsCharsetConverter
type AttrGetType CharsetConverterFromCharsetPropertyInfo = (Maybe T.Text)
type AttrLabel CharsetConverterFromCharsetPropertyInfo = "from-charset"
type AttrOrigin CharsetConverterFromCharsetPropertyInfo = CharsetConverter
attrGet _ = getCharsetConverterFromCharset
attrSet _ = undefined
attrConstruct _ = constructCharsetConverterFromCharset
attrClear _ = undefined
#endif
getCharsetConverterToCharset :: (MonadIO m, IsCharsetConverter o) => o -> m (Maybe T.Text)
getCharsetConverterToCharset obj = liftIO $ B.Properties.getObjectPropertyString obj "to-charset"
constructCharsetConverterToCharset :: (IsCharsetConverter o) => T.Text -> IO (GValueConstruct o)
constructCharsetConverterToCharset val = B.Properties.constructObjectPropertyString "to-charset" (Just val)
#if ENABLE_OVERLOADING
data CharsetConverterToCharsetPropertyInfo
instance AttrInfo CharsetConverterToCharsetPropertyInfo where
type AttrAllowedOps CharsetConverterToCharsetPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CharsetConverterToCharsetPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint CharsetConverterToCharsetPropertyInfo = IsCharsetConverter
type AttrGetType CharsetConverterToCharsetPropertyInfo = (Maybe T.Text)
type AttrLabel CharsetConverterToCharsetPropertyInfo = "to-charset"
type AttrOrigin CharsetConverterToCharsetPropertyInfo = CharsetConverter
attrGet _ = getCharsetConverterToCharset
attrSet _ = undefined
attrConstruct _ = constructCharsetConverterToCharset
attrClear _ = undefined
#endif
getCharsetConverterUseFallback :: (MonadIO m, IsCharsetConverter o) => o -> m Bool
getCharsetConverterUseFallback obj = liftIO $ B.Properties.getObjectPropertyBool obj "use-fallback"
setCharsetConverterUseFallback :: (MonadIO m, IsCharsetConverter o) => o -> Bool -> m ()
setCharsetConverterUseFallback obj val = liftIO $ B.Properties.setObjectPropertyBool obj "use-fallback" val
constructCharsetConverterUseFallback :: (IsCharsetConverter o) => Bool -> IO (GValueConstruct o)
constructCharsetConverterUseFallback val = B.Properties.constructObjectPropertyBool "use-fallback" val
#if ENABLE_OVERLOADING
data CharsetConverterUseFallbackPropertyInfo
instance AttrInfo CharsetConverterUseFallbackPropertyInfo where
type AttrAllowedOps CharsetConverterUseFallbackPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint CharsetConverterUseFallbackPropertyInfo = (~) Bool
type AttrBaseTypeConstraint CharsetConverterUseFallbackPropertyInfo = IsCharsetConverter
type AttrGetType CharsetConverterUseFallbackPropertyInfo = Bool
type AttrLabel CharsetConverterUseFallbackPropertyInfo = "use-fallback"
type AttrOrigin CharsetConverterUseFallbackPropertyInfo = CharsetConverter
attrGet _ = getCharsetConverterUseFallback
attrSet _ = setCharsetConverterUseFallback
attrConstruct _ = constructCharsetConverterUseFallback
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList CharsetConverter
type instance O.AttributeList CharsetConverter = CharsetConverterAttributeList
type CharsetConverterAttributeList = ('[ '("fromCharset", CharsetConverterFromCharsetPropertyInfo), '("toCharset", CharsetConverterToCharsetPropertyInfo), '("useFallback", CharsetConverterUseFallbackPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
charsetConverterFromCharset :: AttrLabelProxy "fromCharset"
charsetConverterFromCharset = AttrLabelProxy
charsetConverterToCharset :: AttrLabelProxy "toCharset"
charsetConverterToCharset = AttrLabelProxy
charsetConverterUseFallback :: AttrLabelProxy "useFallback"
charsetConverterUseFallback = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList CharsetConverter = CharsetConverterSignalList
type CharsetConverterSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_charset_converter_new" g_charset_converter_new ::
CString ->
CString ->
Ptr (Ptr GError) ->
IO (Ptr CharsetConverter)
charsetConverterNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> m CharsetConverter
charsetConverterNew toCharset fromCharset = liftIO $ do
toCharset' <- textToCString toCharset
fromCharset' <- textToCString fromCharset
onException (do
result <- propagateGError $ g_charset_converter_new toCharset' fromCharset'
checkUnexpectedReturnNULL "charsetConverterNew" result
result' <- (wrapObject CharsetConverter) result
freeMem toCharset'
freeMem fromCharset'
return result'
) (do
freeMem toCharset'
freeMem fromCharset'
)
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_charset_converter_get_num_fallbacks" g_charset_converter_get_num_fallbacks ::
Ptr CharsetConverter ->
IO Word32
charsetConverterGetNumFallbacks ::
(B.CallStack.HasCallStack, MonadIO m, IsCharsetConverter a) =>
a
-> m Word32
charsetConverterGetNumFallbacks converter = liftIO $ do
converter' <- unsafeManagedPtrCastPtr converter
result <- g_charset_converter_get_num_fallbacks converter'
touchManagedPtr converter
return result
#if ENABLE_OVERLOADING
data CharsetConverterGetNumFallbacksMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsCharsetConverter a) => O.MethodInfo CharsetConverterGetNumFallbacksMethodInfo a signature where
overloadedMethod _ = charsetConverterGetNumFallbacks
#endif
foreign import ccall "g_charset_converter_get_use_fallback" g_charset_converter_get_use_fallback ::
Ptr CharsetConverter ->
IO CInt
charsetConverterGetUseFallback ::
(B.CallStack.HasCallStack, MonadIO m, IsCharsetConverter a) =>
a
-> m Bool
charsetConverterGetUseFallback converter = liftIO $ do
converter' <- unsafeManagedPtrCastPtr converter
result <- g_charset_converter_get_use_fallback converter'
let result' = (/= 0) result
touchManagedPtr converter
return result'
#if ENABLE_OVERLOADING
data CharsetConverterGetUseFallbackMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsCharsetConverter a) => O.MethodInfo CharsetConverterGetUseFallbackMethodInfo a signature where
overloadedMethod _ = charsetConverterGetUseFallback
#endif
foreign import ccall "g_charset_converter_set_use_fallback" g_charset_converter_set_use_fallback ::
Ptr CharsetConverter ->
CInt ->
IO ()
charsetConverterSetUseFallback ::
(B.CallStack.HasCallStack, MonadIO m, IsCharsetConverter a) =>
a
-> Bool
-> m ()
charsetConverterSetUseFallback converter useFallback = liftIO $ do
converter' <- unsafeManagedPtrCastPtr converter
let useFallback' = (fromIntegral . fromEnum) useFallback
g_charset_converter_set_use_fallback converter' useFallback'
touchManagedPtr converter
return ()
#if ENABLE_OVERLOADING
data CharsetConverterSetUseFallbackMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsCharsetConverter a) => O.MethodInfo CharsetConverterSetUseFallbackMethodInfo a signature where
overloadedMethod _ = charsetConverterSetUseFallback
#endif