    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson and Iñaki García Etxebarria
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- Provides information about a location in an SVG document.
    --
    -- The information should be considered approximate; it is
    -- meant to provide feedback for errors in an editor.
    --
    -- /Since: 4.22/

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gtk.Structs.SvgLocation
        (

    -- * Exported types
        SvgLocation(..)                         ,
        newZeroSvgLocation                      ,

     -- * Methods

    #if defined(ENABLE_OVERLOADING)
        ResolveSvgLocationMethod                ,
    #endif

     -- * Properties

    -- ** bytes #attr:bytes#
    -- | the byte index in document. If unknown, this will
    --   be zero (which is also a valid value, but only if all
    --   three values are zero)

        getSvgLocationBytes                     ,
        setSvgLocationBytes                     ,
    #if defined(ENABLE_OVERLOADING)
        svgLocation_bytes                       ,
    #endif

    -- ** lineChars #attr:lineChars#
    -- | the char index in the line, 0-based

        getSvgLocationLineChars                 ,
        setSvgLocationLineChars                 ,
    #if defined(ENABLE_OVERLOADING)
        svgLocation_lineChars                   ,
    #endif

    -- ** lines #attr:lines#
    -- | the line index in the document, 0-based

        getSvgLocationLines                     ,
        setSvgLocationLines                     ,
    #if defined(ENABLE_OVERLOADING)
        svgLocation_lines                       ,
    #endif

        ) 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 qualified Data.Word as DW
    import qualified Data.Int as DI
    import qualified System.Posix.Types as SPT
    import qualified Foreign.C.Types as FCT

    -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
    #if MIN_VERSION_base(4,18,0)

    #else

    #endif

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

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

    instance BoxedPtr SvgLocation where
        boxedPtrCopy :: SvgLocation -> IO SvgLocation
    boxedPtrCopy = \SvgLocation
    p -> SvgLocation
    -> (Ptr SvgLocation -> IO SvgLocation) -> IO SvgLocation
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr SvgLocation
    p (Int -> Ptr SvgLocation -> IO (Ptr SvgLocation)
    forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
    copyBytes Int
    24 (Ptr SvgLocation -> IO (Ptr SvgLocation))
    -> (Ptr SvgLocation -> IO SvgLocation)
    -> Ptr SvgLocation
    -> IO SvgLocation
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> (ManagedPtr SvgLocation -> SvgLocation)
    -> Ptr SvgLocation -> IO SvgLocation
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    B.ManagedPtr.wrapPtr ManagedPtr SvgLocation -> SvgLocation
    SvgLocation)
        boxedPtrFree :: SvgLocation -> IO ()
    boxedPtrFree = \SvgLocation
    x -> SvgLocation -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    SP.withManagedPtr SvgLocation
    x Ptr SvgLocation -> IO ()
    forall a. Ptr a -> IO ()
    SP.freeMem
    instance CallocPtr SvgLocation where
        boxedPtrCalloc :: IO (Ptr SvgLocation)
    boxedPtrCalloc = Int -> IO (Ptr SvgLocation)
    forall a. Int -> IO (Ptr a)
    callocBytes Int
    24

    -- | Construct a t'SvgLocation' struct initialized to zero.
    newZeroSvgLocation :: MonadIO m => m SvgLocation
    newZeroSvgLocation :: forall (m :: * -> *). MonadIO m => m SvgLocation
    newZeroSvgLocation = IO SvgLocation -> m SvgLocation
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SvgLocation -> m SvgLocation)
    -> IO SvgLocation -> m SvgLocation
    forall a b. (a -> b) -> a -> b
    $ IO (Ptr SvgLocation)
    forall a. CallocPtr a => IO (Ptr a)
    boxedPtrCalloc IO (Ptr SvgLocation)
    -> (Ptr SvgLocation -> IO SvgLocation) -> IO SvgLocation
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (ManagedPtr SvgLocation -> SvgLocation)
    -> Ptr SvgLocation -> IO SvgLocation
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    wrapPtr ManagedPtr SvgLocation -> SvgLocation
    SvgLocation

    instance tag ~ 'AttrSet => Constructible SvgLocation tag where
        new :: forall (m :: * -> *).
    MonadIO m =>
    (ManagedPtr SvgLocation -> SvgLocation)
    -> [AttrOp SvgLocation tag] -> m SvgLocation
    new ManagedPtr SvgLocation -> SvgLocation
    _ [AttrOp SvgLocation tag]
    attrs = do
            o <- m SvgLocation
    forall (m :: * -> *). MonadIO m => m SvgLocation
    newZeroSvgLocation
            GI.Attributes.set o attrs
            return o

    -- | Get the value of the “@bytes@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' svgLocation #bytes
    -- @
    getSvgLocationBytes :: MonadIO m => SvgLocation -> m FCT.CSize
    getSvgLocationBytes :: forall (m :: * -> *). MonadIO m => SvgLocation -> m CSize
    getSvgLocationBytes SvgLocation
    s = IO CSize -> m CSize
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO CSize -> m CSize) -> IO CSize -> m CSize
    forall a b. (a -> b) -> a -> b
    $ SvgLocation -> (Ptr SvgLocation -> IO CSize) -> IO CSize
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr SvgLocation
    s ((Ptr SvgLocation -> IO CSize) -> IO CSize)
    -> (Ptr SvgLocation -> IO CSize) -> IO CSize
    forall a b. (a -> b) -> a -> b
    $ \Ptr SvgLocation
    ptr -> do
        val <- Ptr CSize -> IO CSize
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr SvgLocation
    ptr Ptr SvgLocation -> Int -> Ptr CSize
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    0) :: IO FCT.CSize
        return val

    -- | Set the value of the “@bytes@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' svgLocation [ #bytes 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setSvgLocationBytes :: MonadIO m => SvgLocation -> FCT.CSize -> m ()
    setSvgLocationBytes :: forall (m :: * -> *). MonadIO m => SvgLocation -> CSize -> m ()
    setSvgLocationBytes SvgLocation
    s CSize
    val = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ SvgLocation -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr SvgLocation
    s ((Ptr SvgLocation -> IO ()) -> IO ())
    -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr SvgLocation
    ptr -> do
        Ptr CSize -> CSize -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr SvgLocation
    ptr Ptr SvgLocation -> Int -> Ptr CSize
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    0) (CSize
    val :: FCT.CSize)

    #if defined(ENABLE_OVERLOADING)
    data SvgLocationBytesFieldInfo
    instance AttrInfo SvgLocationBytesFieldInfo where
        type AttrBaseTypeConstraint SvgLocationBytesFieldInfo = (~) SvgLocation
        type AttrAllowedOps SvgLocationBytesFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint SvgLocationBytesFieldInfo = (~) FCT.CSize
        type AttrTransferTypeConstraint SvgLocationBytesFieldInfo = (~)FCT.CSize
        type AttrTransferType SvgLocationBytesFieldInfo = FCT.CSize
        type AttrGetType SvgLocationBytesFieldInfo = FCT.CSize
        type AttrLabel SvgLocationBytesFieldInfo = "bytes"
        type AttrOrigin SvgLocationBytesFieldInfo = SvgLocation
        attrGet = getSvgLocationBytes
        attrSet = setSvgLocationBytes
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v
        dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Structs.SvgLocation.bytes"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Structs-SvgLocation.html#g:attr:bytes"
            })

    svgLocation_bytes :: AttrLabelProxy "bytes"
    svgLocation_bytes = AttrLabelProxy

    #endif

    -- | Get the value of the “@lines@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' svgLocation #lines
    -- @
    getSvgLocationLines :: MonadIO m => SvgLocation -> m FCT.CSize
    getSvgLocationLines :: forall (m :: * -> *). MonadIO m => SvgLocation -> m CSize
    getSvgLocationLines SvgLocation
    s = IO CSize -> m CSize
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO CSize -> m CSize) -> IO CSize -> m CSize
    forall a b. (a -> b) -> a -> b
    $ SvgLocation -> (Ptr SvgLocation -> IO CSize) -> IO CSize
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr SvgLocation
    s ((Ptr SvgLocation -> IO CSize) -> IO CSize)
    -> (Ptr SvgLocation -> IO CSize) -> IO CSize
    forall a b. (a -> b) -> a -> b
    $ \Ptr SvgLocation
    ptr -> do
        val <- Ptr CSize -> IO CSize
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr SvgLocation
    ptr Ptr SvgLocation -> Int -> Ptr CSize
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    8) :: IO FCT.CSize
        return val

    -- | Set the value of the “@lines@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' svgLocation [ #lines 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setSvgLocationLines :: MonadIO m => SvgLocation -> FCT.CSize -> m ()
    setSvgLocationLines :: forall (m :: * -> *). MonadIO m => SvgLocation -> CSize -> m ()
    setSvgLocationLines SvgLocation
    s CSize
    val = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ SvgLocation -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr SvgLocation
    s ((Ptr SvgLocation -> IO ()) -> IO ())
    -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr SvgLocation
    ptr -> do
        Ptr CSize -> CSize -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr SvgLocation
    ptr Ptr SvgLocation -> Int -> Ptr CSize
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    8) (CSize
    val :: FCT.CSize)

    #if defined(ENABLE_OVERLOADING)
    data SvgLocationLinesFieldInfo
    instance AttrInfo SvgLocationLinesFieldInfo where
        type AttrBaseTypeConstraint SvgLocationLinesFieldInfo = (~) SvgLocation
        type AttrAllowedOps SvgLocationLinesFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint SvgLocationLinesFieldInfo = (~) FCT.CSize
        type AttrTransferTypeConstraint SvgLocationLinesFieldInfo = (~)FCT.CSize
        type AttrTransferType SvgLocationLinesFieldInfo = FCT.CSize
        type AttrGetType SvgLocationLinesFieldInfo = FCT.CSize
        type AttrLabel SvgLocationLinesFieldInfo = "lines"
        type AttrOrigin SvgLocationLinesFieldInfo = SvgLocation
        attrGet = getSvgLocationLines
        attrSet = setSvgLocationLines
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v
        dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Structs.SvgLocation.lines"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Structs-SvgLocation.html#g:attr:lines"
            })

    svgLocation_lines :: AttrLabelProxy "lines"
    svgLocation_lines = AttrLabelProxy

    #endif

    -- | Get the value of the “@line_chars@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' svgLocation #lineChars
    -- @
    getSvgLocationLineChars :: MonadIO m => SvgLocation -> m FCT.CSize
    getSvgLocationLineChars :: forall (m :: * -> *). MonadIO m => SvgLocation -> m CSize
    getSvgLocationLineChars SvgLocation
    s = IO CSize -> m CSize
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO CSize -> m CSize) -> IO CSize -> m CSize
    forall a b. (a -> b) -> a -> b
    $ SvgLocation -> (Ptr SvgLocation -> IO CSize) -> IO CSize
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr SvgLocation
    s ((Ptr SvgLocation -> IO CSize) -> IO CSize)
    -> (Ptr SvgLocation -> IO CSize) -> IO CSize
    forall a b. (a -> b) -> a -> b
    $ \Ptr SvgLocation
    ptr -> do
        val <- Ptr CSize -> IO CSize
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr SvgLocation
    ptr Ptr SvgLocation -> Int -> Ptr CSize
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    16) :: IO FCT.CSize
        return val

    -- | Set the value of the “@line_chars@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' svgLocation [ #lineChars 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setSvgLocationLineChars :: MonadIO m => SvgLocation -> FCT.CSize -> m ()
    setSvgLocationLineChars :: forall (m :: * -> *). MonadIO m => SvgLocation -> CSize -> m ()
    setSvgLocationLineChars SvgLocation
    s CSize
    val = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ SvgLocation -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr SvgLocation
    s ((Ptr SvgLocation -> IO ()) -> IO ())
    -> (Ptr SvgLocation -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr SvgLocation
    ptr -> do
        Ptr CSize -> CSize -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr SvgLocation
    ptr Ptr SvgLocation -> Int -> Ptr CSize
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    16) (CSize
    val :: FCT.CSize)

    #if defined(ENABLE_OVERLOADING)
    data SvgLocationLineCharsFieldInfo
    instance AttrInfo SvgLocationLineCharsFieldInfo where
        type AttrBaseTypeConstraint SvgLocationLineCharsFieldInfo = (~) SvgLocation
        type AttrAllowedOps SvgLocationLineCharsFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint SvgLocationLineCharsFieldInfo = (~) FCT.CSize
        type AttrTransferTypeConstraint SvgLocationLineCharsFieldInfo = (~)FCT.CSize
        type AttrTransferType SvgLocationLineCharsFieldInfo = FCT.CSize
        type AttrGetType SvgLocationLineCharsFieldInfo = FCT.CSize
        type AttrLabel SvgLocationLineCharsFieldInfo = "line_chars"
        type AttrOrigin SvgLocationLineCharsFieldInfo = SvgLocation
        attrGet = getSvgLocationLineChars
        attrSet = setSvgLocationLineChars
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v
        dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Structs.SvgLocation.lineChars"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Structs-SvgLocation.html#g:attr:lineChars"
            })

    svgLocation_lineChars :: AttrLabelProxy "lineChars"
    svgLocation_lineChars = AttrLabelProxy

    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList SvgLocation
    type instance O.AttributeList SvgLocation = SvgLocationAttributeList
    type SvgLocationAttributeList = ('[ '("bytes", SvgLocationBytesFieldInfo), '("lines", SvgLocationLinesFieldInfo), '("lineChars", SvgLocationLineCharsFieldInfo)] :: [(Symbol, DK.Type)])
    #endif

    #if defined(ENABLE_OVERLOADING)
    type family ResolveSvgLocationMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
        ResolveSvgLocationMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveSvgLocationMethod t SvgLocation, O.OverloadedMethod info SvgLocation p) => OL.IsLabel t (SvgLocation -> 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 ~ ResolveSvgLocationMethod t SvgLocation, O.OverloadedMethod info SvgLocation p, R.HasField t SvgLocation p) => R.HasField t SvgLocation p where
        getField = O.overloadedMethod @info

    #endif

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

    #endif