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

Represents a day between January 1, Year 1 and a few thousand years in
the future. None of its members should be accessed directly.

If the 'GI.GLib.Structs.Date.Date'-struct is obtained from 'GI.GLib.Structs.Date.dateNew', it will be safe
to mutate but invalid and thus not safe for calendrical computations.

If it\'s declared on the stack, it will contain garbage so must be
initialized with 'GI.GLib.Structs.Date.dateClear'. 'GI.GLib.Structs.Date.dateClear' makes the date invalid
but sane. An invalid date doesn\'t represent a day, it\'s \"empty.\" A date
becomes valid after you set it to a Julian day or you set a day, month,
and year.
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.GLib.Structs.Date
    ( 

-- * Exported types
    Date(..)                                ,
    newZeroDate                             ,
    noDate                                  ,


 -- * Methods
-- ** addDays #method:addDays#

#if ENABLE_OVERLOADING
    DateAddDaysMethodInfo                   ,
#endif
    dateAddDays                             ,


-- ** addMonths #method:addMonths#

#if ENABLE_OVERLOADING
    DateAddMonthsMethodInfo                 ,
#endif
    dateAddMonths                           ,


-- ** addYears #method:addYears#

#if ENABLE_OVERLOADING
    DateAddYearsMethodInfo                  ,
#endif
    dateAddYears                            ,


-- ** clamp #method:clamp#

#if ENABLE_OVERLOADING
    DateClampMethodInfo                     ,
#endif
    dateClamp                               ,


-- ** clear #method:clear#

#if ENABLE_OVERLOADING
    DateClearMethodInfo                     ,
#endif
    dateClear                               ,


-- ** compare #method:compare#

#if ENABLE_OVERLOADING
    DateCompareMethodInfo                   ,
#endif
    dateCompare                             ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    DateCopyMethodInfo                      ,
#endif
    dateCopy                                ,


-- ** daysBetween #method:daysBetween#

#if ENABLE_OVERLOADING
    DateDaysBetweenMethodInfo               ,
#endif
    dateDaysBetween                         ,


-- ** free #method:free#

#if ENABLE_OVERLOADING
    DateFreeMethodInfo                      ,
#endif
    dateFree                                ,


-- ** getDay #method:getDay#

#if ENABLE_OVERLOADING
    DateGetDayMethodInfo                    ,
#endif
    dateGetDay                              ,


-- ** getDayOfYear #method:getDayOfYear#

#if ENABLE_OVERLOADING
    DateGetDayOfYearMethodInfo              ,
#endif
    dateGetDayOfYear                        ,


-- ** getDaysInMonth #method:getDaysInMonth#

    dateGetDaysInMonth                      ,


-- ** getIso8601WeekOfYear #method:getIso8601WeekOfYear#

#if ENABLE_OVERLOADING
    DateGetIso8601WeekOfYearMethodInfo      ,
#endif
    dateGetIso8601WeekOfYear                ,


-- ** getJulian #method:getJulian#

#if ENABLE_OVERLOADING
    DateGetJulianMethodInfo                 ,
#endif
    dateGetJulian                           ,


-- ** getMondayWeekOfYear #method:getMondayWeekOfYear#

#if ENABLE_OVERLOADING
    DateGetMondayWeekOfYearMethodInfo       ,
#endif
    dateGetMondayWeekOfYear                 ,


-- ** getMondayWeeksInYear #method:getMondayWeeksInYear#

    dateGetMondayWeeksInYear                ,


-- ** getMonth #method:getMonth#

#if ENABLE_OVERLOADING
    DateGetMonthMethodInfo                  ,
#endif
    dateGetMonth                            ,


-- ** getSundayWeekOfYear #method:getSundayWeekOfYear#

#if ENABLE_OVERLOADING
    DateGetSundayWeekOfYearMethodInfo       ,
#endif
    dateGetSundayWeekOfYear                 ,


-- ** getSundayWeeksInYear #method:getSundayWeeksInYear#

    dateGetSundayWeeksInYear                ,


-- ** getWeekday #method:getWeekday#

#if ENABLE_OVERLOADING
    DateGetWeekdayMethodInfo                ,
#endif
    dateGetWeekday                          ,


-- ** getYear #method:getYear#

#if ENABLE_OVERLOADING
    DateGetYearMethodInfo                   ,
#endif
    dateGetYear                             ,


-- ** isFirstOfMonth #method:isFirstOfMonth#

#if ENABLE_OVERLOADING
    DateIsFirstOfMonthMethodInfo            ,
#endif
    dateIsFirstOfMonth                      ,


-- ** isLastOfMonth #method:isLastOfMonth#

#if ENABLE_OVERLOADING
    DateIsLastOfMonthMethodInfo             ,
#endif
    dateIsLastOfMonth                       ,


-- ** isLeapYear #method:isLeapYear#

    dateIsLeapYear                          ,


-- ** new #method:new#

    dateNew                                 ,


-- ** newDmy #method:newDmy#

    dateNewDmy                              ,


-- ** newJulian #method:newJulian#

    dateNewJulian                           ,


-- ** order #method:order#

#if ENABLE_OVERLOADING
    DateOrderMethodInfo                     ,
#endif
    dateOrder                               ,


-- ** setDay #method:setDay#

#if ENABLE_OVERLOADING
    DateSetDayMethodInfo                    ,
#endif
    dateSetDay                              ,


-- ** setDmy #method:setDmy#

#if ENABLE_OVERLOADING
    DateSetDmyMethodInfo                    ,
#endif
    dateSetDmy                              ,


-- ** setJulian #method:setJulian#

#if ENABLE_OVERLOADING
    DateSetJulianMethodInfo                 ,
#endif
    dateSetJulian                           ,


-- ** setMonth #method:setMonth#

#if ENABLE_OVERLOADING
    DateSetMonthMethodInfo                  ,
#endif
    dateSetMonth                            ,


-- ** setParse #method:setParse#

#if ENABLE_OVERLOADING
    DateSetParseMethodInfo                  ,
#endif
    dateSetParse                            ,


-- ** setTime #method:setTime#

#if ENABLE_OVERLOADING
    DateSetTimeMethodInfo                   ,
#endif
    dateSetTime                             ,


-- ** setTimeT #method:setTimeT#

#if ENABLE_OVERLOADING
    DateSetTimeTMethodInfo                  ,
#endif
    dateSetTimeT                            ,


-- ** setTimeVal #method:setTimeVal#

#if ENABLE_OVERLOADING
    DateSetTimeValMethodInfo                ,
#endif
    dateSetTimeVal                          ,


-- ** setYear #method:setYear#

#if ENABLE_OVERLOADING
    DateSetYearMethodInfo                   ,
#endif
    dateSetYear                             ,


-- ** strftime #method:strftime#

    dateStrftime                            ,


-- ** subtractDays #method:subtractDays#

#if ENABLE_OVERLOADING
    DateSubtractDaysMethodInfo              ,
#endif
    dateSubtractDays                        ,


-- ** subtractMonths #method:subtractMonths#

#if ENABLE_OVERLOADING
    DateSubtractMonthsMethodInfo            ,
#endif
    dateSubtractMonths                      ,


-- ** subtractYears #method:subtractYears#

#if ENABLE_OVERLOADING
    DateSubtractYearsMethodInfo             ,
#endif
    dateSubtractYears                       ,


-- ** toStructTm #method:toStructTm#

#if ENABLE_OVERLOADING
    DateToStructTmMethodInfo                ,
#endif
    dateToStructTm                          ,


-- ** valid #method:valid#

#if ENABLE_OVERLOADING
    DateValidMethodInfo                     ,
#endif
    dateValid                               ,


-- ** validDay #method:validDay#

    dateValidDay                            ,


-- ** validDmy #method:validDmy#

    dateValidDmy                            ,


-- ** validJulian #method:validJulian#

    dateValidJulian                         ,


-- ** validMonth #method:validMonth#

    dateValidMonth                          ,


-- ** validWeekday #method:validWeekday#

    dateValidWeekday                        ,


-- ** validYear #method:validYear#

    dateValidYear                           ,




 -- * Properties
-- ** day #attr:day#
{- | the day of the day-month-year representation of the date,
    as a number between 1 and 31
-}
#if ENABLE_OVERLOADING
    date_day                                ,
#endif
    getDateDay                              ,
    setDateDay                              ,


-- ** dmy #attr:dmy#
{- | this is set if /@day@/, /@month@/ and /@year@/ are valid
-}
#if ENABLE_OVERLOADING
    date_dmy                                ,
#endif
    getDateDmy                              ,
    setDateDmy                              ,


-- ** julian #attr:julian#
{- | this bit is set if /@julianDays@/ is valid
-}
#if ENABLE_OVERLOADING
    date_julian                             ,
#endif
    getDateJulian                           ,
    setDateJulian                           ,


-- ** julianDays #attr:julianDays#
{- | the Julian representation of the date
-}
#if ENABLE_OVERLOADING
    date_julianDays                         ,
#endif
    getDateJulianDays                       ,
    setDateJulianDays                       ,


-- ** month #attr:month#
{- | the day of the day-month-year representation of the date,
    as a number between 1 and 12
-}
#if ENABLE_OVERLOADING
    date_month                              ,
#endif
    getDateMonth                            ,
    setDateMonth                            ,


-- ** year #attr:year#
{- | the day of the day-month-year representation of the date
-}
#if ENABLE_OVERLOADING
    date_year                               ,
#endif
    getDateYear                             ,
    setDateYear                             ,




    ) 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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums
import {-# SOURCE #-} qualified GI.GLib.Structs.TimeVal as GLib.TimeVal

-- | Memory-managed wrapper type.
newtype Date = Date (ManagedPtr Date)
foreign import ccall "g_date_get_type" c_g_date_get_type :: 
    IO GType

instance BoxedObject Date where
    boxedType :: Date -> IO GType
boxedType _ = IO GType
c_g_date_get_type

-- | Construct a `Date` struct initialized to zero.
newZeroDate :: MonadIO m => m Date
newZeroDate :: m Date
newZeroDate = IO Date -> m Date
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Date -> m Date) -> IO Date -> m Date
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Date)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 24 IO (Ptr Date) -> (Ptr Date -> IO Date) -> IO Date
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Date -> Date) -> Ptr Date -> IO Date
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Date -> Date
Date

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


-- | A convenience alias for `Nothing` :: `Maybe` `Date`.
noDate :: Maybe Date
noDate :: Maybe Date
noDate = Maybe Date
forall a. Maybe a
Nothing

{- |
Get the value of the “@julian_days@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' date #julianDays
@
-}
getDateJulianDays :: MonadIO m => Date -> m Word32
getDateJulianDays :: Date -> m Word32
getDateJulianDays s :: Date
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO Word32) -> IO Word32)
-> (Ptr Date -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

{- |
Set the value of the “@julian_days@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' date [ #julianDays 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateJulianDays :: MonadIO m => Date -> Word32 -> m ()
setDateJulianDays :: Date -> Word32 -> m ()
setDateJulianDays s :: Date
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO ()) -> IO ()) -> (Ptr Date -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Word32
val :: Word32)

#if ENABLE_OVERLOADING
data DateJulianDaysFieldInfo
instance AttrInfo DateJulianDaysFieldInfo where
    type AttrAllowedOps DateJulianDaysFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateJulianDaysFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateJulianDaysFieldInfo = (~) Date
    type AttrGetType DateJulianDaysFieldInfo = Word32
    type AttrLabel DateJulianDaysFieldInfo = "julian_days"
    type AttrOrigin DateJulianDaysFieldInfo = Date
    attrGet _ = getDateJulianDays
    attrSet _ = setDateJulianDays
    attrConstruct = undefined
    attrClear _ = undefined

date_julianDays :: AttrLabelProxy "julianDays"
date_julianDays = AttrLabelProxy

#endif


{- |
Get the value of the “@julian@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' date #julian
@
-}
getDateJulian :: MonadIO m => Date -> m Word32
getDateJulian :: Date -> m Word32
getDateJulian s :: Date
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO Word32) -> IO Word32)
-> (Ptr Date -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

{- |
Set the value of the “@julian@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' date [ #julian 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateJulian :: MonadIO m => Date -> Word32 -> m ()
setDateJulian :: Date -> Word32 -> m ()
setDateJulian s :: Date
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO ()) -> IO ()) -> (Ptr Date -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4) (Word32
val :: Word32)

#if ENABLE_OVERLOADING
data DateJulianFieldInfo
instance AttrInfo DateJulianFieldInfo where
    type AttrAllowedOps DateJulianFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateJulianFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateJulianFieldInfo = (~) Date
    type AttrGetType DateJulianFieldInfo = Word32
    type AttrLabel DateJulianFieldInfo = "julian"
    type AttrOrigin DateJulianFieldInfo = Date
    attrGet _ = getDateJulian
    attrSet _ = setDateJulian
    attrConstruct = undefined
    attrClear _ = undefined

date_julian :: AttrLabelProxy "julian"
date_julian = AttrLabelProxy

#endif


{- |
Get the value of the “@dmy@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' date #dmy
@
-}
getDateDmy :: MonadIO m => Date -> m Word32
getDateDmy :: Date -> m Word32
getDateDmy s :: Date
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO Word32) -> IO Word32)
-> (Ptr Date -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

{- |
Set the value of the “@dmy@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' date [ #dmy 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateDmy :: MonadIO m => Date -> Word32 -> m ()
setDateDmy :: Date -> Word32 -> m ()
setDateDmy s :: Date
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO ()) -> IO ()) -> (Ptr Date -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (Word32
val :: Word32)

#if ENABLE_OVERLOADING
data DateDmyFieldInfo
instance AttrInfo DateDmyFieldInfo where
    type AttrAllowedOps DateDmyFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateDmyFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateDmyFieldInfo = (~) Date
    type AttrGetType DateDmyFieldInfo = Word32
    type AttrLabel DateDmyFieldInfo = "dmy"
    type AttrOrigin DateDmyFieldInfo = Date
    attrGet _ = getDateDmy
    attrSet _ = setDateDmy
    attrConstruct = undefined
    attrClear _ = undefined

date_dmy :: AttrLabelProxy "dmy"
date_dmy = AttrLabelProxy

#endif


{- |
Get the value of the “@day@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' date #day
@
-}
getDateDay :: MonadIO m => Date -> m Word32
getDateDay :: Date -> m Word32
getDateDay s :: Date
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO Word32) -> IO Word32)
-> (Ptr Date -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

{- |
Set the value of the “@day@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' date [ #day 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateDay :: MonadIO m => Date -> Word32 -> m ()
setDateDay :: Date -> Word32 -> m ()
setDateDay s :: Date
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO ()) -> IO ()) -> (Ptr Date -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12) (Word32
val :: Word32)

#if ENABLE_OVERLOADING
data DateDayFieldInfo
instance AttrInfo DateDayFieldInfo where
    type AttrAllowedOps DateDayFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateDayFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateDayFieldInfo = (~) Date
    type AttrGetType DateDayFieldInfo = Word32
    type AttrLabel DateDayFieldInfo = "day"
    type AttrOrigin DateDayFieldInfo = Date
    attrGet _ = getDateDay
    attrSet _ = setDateDay
    attrConstruct = undefined
    attrClear _ = undefined

date_day :: AttrLabelProxy "day"
date_day = AttrLabelProxy

#endif


{- |
Get the value of the “@month@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' date #month
@
-}
getDateMonth :: MonadIO m => Date -> m Word32
getDateMonth :: Date -> m Word32
getDateMonth s :: Date
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO Word32) -> IO Word32)
-> (Ptr Date -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

{- |
Set the value of the “@month@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' date [ #month 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateMonth :: MonadIO m => Date -> Word32 -> m ()
setDateMonth :: Date -> Word32 -> m ()
setDateMonth s :: Date
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO ()) -> IO ()) -> (Ptr Date -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (Word32
val :: Word32)

#if ENABLE_OVERLOADING
data DateMonthFieldInfo
instance AttrInfo DateMonthFieldInfo where
    type AttrAllowedOps DateMonthFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateMonthFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateMonthFieldInfo = (~) Date
    type AttrGetType DateMonthFieldInfo = Word32
    type AttrLabel DateMonthFieldInfo = "month"
    type AttrOrigin DateMonthFieldInfo = Date
    attrGet _ = getDateMonth
    attrSet _ = setDateMonth
    attrConstruct = undefined
    attrClear _ = undefined

date_month :: AttrLabelProxy "month"
date_month = AttrLabelProxy

#endif


{- |
Get the value of the “@year@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' date #year
@
-}
getDateYear :: MonadIO m => Date -> m Word32
getDateYear :: Date -> m Word32
getDateYear s :: Date
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO Word32) -> IO Word32)
-> (Ptr Date -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

{- |
Set the value of the “@year@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' date [ #year 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateYear :: MonadIO m => Date -> Word32 -> m ()
setDateYear :: Date -> Word32 -> m ()
setDateYear s :: Date
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Date -> (Ptr Date -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Date
s ((Ptr Date -> IO ()) -> IO ()) -> (Ptr Date -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Date
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Date
ptr Ptr Date -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20) (Word32
val :: Word32)

#if ENABLE_OVERLOADING
data DateYearFieldInfo
instance AttrInfo DateYearFieldInfo where
    type AttrAllowedOps DateYearFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateYearFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateYearFieldInfo = (~) Date
    type AttrGetType DateYearFieldInfo = Word32
    type AttrLabel DateYearFieldInfo = "year"
    type AttrOrigin DateYearFieldInfo = Date
    attrGet _ = getDateYear
    attrSet _ = setDateYear
    attrConstruct = undefined
    attrClear _ = undefined

date_year :: AttrLabelProxy "year"
date_year = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList Date
type instance O.AttributeList Date = DateAttributeList
type DateAttributeList = ('[ '("julianDays", DateJulianDaysFieldInfo), '("julian", DateJulianFieldInfo), '("dmy", DateDmyFieldInfo), '("day", DateDayFieldInfo), '("month", DateMonthFieldInfo), '("year", DateYearFieldInfo)] :: [(Symbol, *)])
#endif

-- method Date::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new" g_date_new :: 
    IO (Ptr Date)

{- |
Allocates a 'GI.GLib.Structs.Date.Date' and initializes
it to a sane state. The new date will
be cleared (as if you\'d called 'GI.GLib.Structs.Date.dateClear') but invalid (it won\'t
represent an existing day). Free the return value with 'GI.GLib.Structs.Date.dateFree'.
-}
dateNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' -}
dateNew :: m Date
dateNew  = IO Date -> m Date
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Date -> m Date) -> IO Date -> m Date
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
result <- IO (Ptr Date)
g_date_new
    Text -> Ptr Date -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dateNew" Ptr Date
result
    Date
result' <- ((ManagedPtr Date -> Date) -> Ptr Date -> IO Date
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Date -> Date
Date) Ptr Date
result
    Date -> IO Date
forall (m :: * -> *) a. Monad m => a -> m a
return Date
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::new_dmy
-- method type : Constructor
-- Args : [Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day of the month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month of the year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new_dmy" g_date_new_dmy :: 
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO (Ptr Date)

{- |
Like 'GI.GLib.Structs.Date.dateNew', but also sets the value of the date. Assuming the
day-month-year triplet you pass in represents an existing day, the
returned date will be valid.
-}
dateNewDmy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    {- ^ /@day@/: day of the month -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month of the year -}
    -> Word16
    {- ^ /@year@/: year -}
    -> m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' initialized with /@day@/, /@month@/, and /@year@/ -}
dateNewDmy :: Word8 -> DateMonth -> Word16 -> m Date
dateNewDmy day :: Word8
day month :: DateMonth
month year :: Word16
year = IO Date -> m Date
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Date -> m Date) -> IO Date -> m Date
forall a b. (a -> b) -> a -> b
$ do
    let month' :: CUInt
month' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateMonth -> Int) -> DateMonth -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateMonth -> Int
forall a. Enum a => a -> Int
fromEnum) DateMonth
month
    Ptr Date
result <- Word8 -> CUInt -> Word16 -> IO (Ptr Date)
g_date_new_dmy Word8
day CUInt
month' Word16
year
    Text -> Ptr Date -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dateNewDmy" Ptr Date
result
    Date
result' <- ((ManagedPtr Date -> Date) -> Ptr Date -> IO Date
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Date -> Date
Date) Ptr Date
result
    Date -> IO Date
forall (m :: * -> *) a. Monad m => a -> m a
return Date
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::new_julian
-- method type : Constructor
-- Args : [Arg {argCName = "julian_day", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "days since January 1, Year 1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new_julian" g_date_new_julian :: 
    Word32 ->                               -- julian_day : TBasicType TUInt32
    IO (Ptr Date)

{- |
Like 'GI.GLib.Structs.Date.dateNew', but also sets the value of the date. Assuming the
Julian day number you pass in is valid (greater than 0, less than an
unreasonably large number), the returned date will be valid.
-}
dateNewJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@julianDay@/: days since January 1, Year 1 -}
    -> m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' initialized with /@julianDay@/ -}
dateNewJulian :: Word32 -> m Date
dateNewJulian julianDay :: Word32
julianDay = IO Date -> m Date
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Date -> m Date) -> IO Date -> m Date
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
result <- Word32 -> IO (Ptr Date)
g_date_new_julian Word32
julianDay
    Text -> Ptr Date -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dateNewJulian" Ptr Date
result
    Date
result' <- ((ManagedPtr Date -> Date) -> Ptr Date -> IO Date
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Date -> Date
Date) Ptr Date
result
    Date -> IO Date
forall (m :: * -> *) a. Monad m => a -> m a
return Date
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::add_days
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to increment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_days", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of days to move the date forward", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_days" g_date_add_days :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_days : TBasicType TUInt
    IO ()

{- |
Increments a date some number of days.
To move forward by weeks, add weeks*7 days.
The date must be valid.
-}
dateAddDays ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to increment -}
    -> Word32
    {- ^ /@nDays@/: number of days to move the date forward -}
    -> m ()
dateAddDays :: Date -> Word32 -> m ()
dateAddDays date :: Date
date nDays :: Word32
nDays = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_add_days Ptr Date
date' Word32
nDays
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateAddDaysMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateAddDaysMethodInfo Date signature where
    overloadedMethod _ = dateAddDays

#endif

-- method Date::add_months
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to increment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_months", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of months to move forward", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_months" g_date_add_months :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_months : TBasicType TUInt
    IO ()

{- |
Increments a date by some number of months.
If the day of the month is greater than 28,
this routine may change the day of the month
(because the destination month may not have
the current day in it). The date must be valid.
-}
dateAddMonths ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to increment -}
    -> Word32
    {- ^ /@nMonths@/: number of months to move forward -}
    -> m ()
dateAddMonths :: Date -> Word32 -> m ()
dateAddMonths date :: Date
date nMonths :: Word32
nMonths = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_add_months Ptr Date
date' Word32
nMonths
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateAddMonthsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateAddMonthsMethodInfo Date signature where
    overloadedMethod _ = dateAddMonths

#endif

-- method Date::add_years
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to increment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_years", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of years to move forward", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_years" g_date_add_years :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_years : TBasicType TUInt
    IO ()

{- |
Increments a date by some number of years.
If the date is February 29, and the destination
year is not a leap year, the date will be changed
to February 28. The date must be valid.
-}
dateAddYears ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to increment -}
    -> Word32
    {- ^ /@nYears@/: number of years to move forward -}
    -> m ()
dateAddYears :: Date -> Word32 -> m ()
dateAddYears date :: Date
date nYears :: Word32
nYears = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_add_years Ptr Date
date' Word32
nYears
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateAddYearsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateAddYearsMethodInfo Date signature where
    overloadedMethod _ = dateAddYears

#endif

-- method Date::clamp
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to clamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "minimum accepted value for @date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "maximum accepted value for @date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_clamp" g_date_clamp :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- min_date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- max_date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO ()

{- |
If /@date@/ is prior to /@minDate@/, sets /@date@/ equal to /@minDate@/.
If /@date@/ falls after /@maxDate@/, sets /@date@/ equal to /@maxDate@/.
Otherwise, /@date@/ is unchanged.
Either of /@minDate@/ and /@maxDate@/ may be 'Nothing'.
All non-'Nothing' dates must be valid.
-}
dateClamp ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to clamp -}
    -> Date
    {- ^ /@minDate@/: minimum accepted value for /@date@/ -}
    -> Date
    {- ^ /@maxDate@/: maximum accepted value for /@date@/ -}
    -> m ()
dateClamp :: Date -> Date -> Date -> m ()
dateClamp date :: Date
date minDate :: Date
minDate maxDate :: Date
maxDate = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date
minDate' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
minDate
    Ptr Date
maxDate' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
maxDate
    Ptr Date -> Ptr Date -> Ptr Date -> IO ()
g_date_clamp Ptr Date
date' Ptr Date
minDate' Ptr Date
maxDate'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
minDate
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
maxDate
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateClampMethodInfo
instance (signature ~ (Date -> Date -> m ()), MonadIO m) => O.MethodInfo DateClampMethodInfo Date signature where
    overloadedMethod _ = dateClamp

#endif

-- method Date::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to one or more dates to clear", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_dates", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of dates to clear", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_clear" g_date_clear :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_dates : TBasicType TUInt
    IO ()

{- |
Initializes one or more 'GI.GLib.Structs.Date.Date' structs to a sane but invalid
state. The cleared dates will not represent an existing date, but will
not contain garbage. Useful to init a date declared on the stack.
Validity can be tested with 'GI.GLib.Structs.Date.dateValid'.
-}
dateClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: pointer to one or more dates to clear -}
    -> Word32
    {- ^ /@nDates@/: number of dates to clear -}
    -> m ()
dateClear :: Date -> Word32 -> m ()
dateClear date :: Date
date nDates :: Word32
nDates = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_clear Ptr Date
date' Word32
nDates
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateClearMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateClearMethodInfo Date signature where
    overloadedMethod _ = dateClear

#endif

-- method Date::compare
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "lhs", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "first date to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rhs", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "second date to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_compare" g_date_compare :: 
    Ptr Date ->                             -- lhs : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- rhs : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Int32

{- |
@/qsort()/@-style comparison function for dates.
Both dates must be valid.
-}
dateCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@lhs@/: first date to compare -}
    -> Date
    {- ^ /@rhs@/: second date to compare -}
    -> m Int32
    {- ^ __Returns:__ 0 for equal, less than zero if /@lhs@/ is less than /@rhs@/,
    greater than zero if /@lhs@/ is greater than /@rhs@/ -}
dateCompare :: Date -> Date -> m Int32
dateCompare lhs :: Date
lhs rhs :: Date
rhs = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
lhs' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
lhs
    Ptr Date
rhs' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
rhs
    Int32
result <- Ptr Date -> Ptr Date -> IO Int32
g_date_compare Ptr Date
lhs' Ptr Date
rhs'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
lhs
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
rhs
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if ENABLE_OVERLOADING
data DateCompareMethodInfo
instance (signature ~ (Date -> m Int32), MonadIO m) => O.MethodInfo DateCompareMethodInfo Date signature where
    overloadedMethod _ = dateCompare

#endif

-- method Date::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to copy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_copy" g_date_copy :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO (Ptr Date)

{- |
Copies a GDate to a newly-allocated GDate. If the input was invalid
(as determined by 'GI.GLib.Structs.Date.dateValid'), the invalid state will be copied
as is into the new object.

/Since: 2.56/
-}
dateCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to copy -}
    -> m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' initialized from /@date@/ -}
dateCopy :: Date -> m Date
dateCopy date :: Date
date = IO Date -> m Date
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Date -> m Date) -> IO Date -> m Date
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date
result <- Ptr Date -> IO (Ptr Date)
g_date_copy Ptr Date
date'
    Text -> Ptr Date -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dateCopy" Ptr Date
result
    Date
result' <- ((ManagedPtr Date -> Date) -> Ptr Date -> IO Date
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Date -> Date
Date) Ptr Date
result
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Date -> IO Date
forall (m :: * -> *) a. Monad m => a -> m a
return Date
result'

#if ENABLE_OVERLOADING
data DateCopyMethodInfo
instance (signature ~ (m Date), MonadIO m) => O.MethodInfo DateCopyMethodInfo Date signature where
    overloadedMethod _ = dateCopy

#endif

-- method Date::days_between
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date1", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "date2", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_days_between" g_date_days_between :: 
    Ptr Date ->                             -- date1 : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- date2 : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Int32

{- |
Computes the number of days between two dates.
If /@date2@/ is prior to /@date1@/, the returned value is negative.
Both dates must be valid.
-}
dateDaysBetween ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date1@/: the first date -}
    -> Date
    {- ^ /@date2@/: the second date -}
    -> m Int32
    {- ^ __Returns:__ the number of days between /@date1@/ and /@date2@/ -}
dateDaysBetween :: Date -> Date -> m Int32
dateDaysBetween date1 :: Date
date1 date2 :: Date
date2 = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date1' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date1
    Ptr Date
date2' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date2
    Int32
result <- Ptr Date -> Ptr Date -> IO Int32
g_date_days_between Ptr Date
date1' Ptr Date
date2'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date1
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date2
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if ENABLE_OVERLOADING
data DateDaysBetweenMethodInfo
instance (signature ~ (Date -> m Int32), MonadIO m) => O.MethodInfo DateDaysBetweenMethodInfo Date signature where
    overloadedMethod _ = dateDaysBetween

#endif

-- method Date::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to free", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_free" g_date_free :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO ()

{- |
Frees a 'GI.GLib.Structs.Date.Date' returned from 'GI.GLib.Structs.Date.dateNew'.
-}
dateFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to free -}
    -> m ()
dateFree :: Date -> m ()
dateFree date :: Date
date = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> IO ()
g_date_free Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DateFreeMethodInfo Date signature where
    overloadedMethod _ = dateFree

#endif

-- method Date::get_day
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to extract the day of the month from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_day" g_date_get_day :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word8

{- |
Returns the day of the month. The date must be valid.
-}
dateGetDay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to extract the day of the month from -}
    -> m Word8
    {- ^ __Returns:__ day of the month -}
dateGetDay :: Date -> m Word8
dateGetDay date :: Date
date = IO Word8 -> m Word8
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word8
result <- Ptr Date -> IO Word8
g_date_get_day Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word8 -> IO Word8
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result

#if ENABLE_OVERLOADING
data DateGetDayMethodInfo
instance (signature ~ (m Word8), MonadIO m) => O.MethodInfo DateGetDayMethodInfo Date signature where
    overloadedMethod _ = dateGetDay

#endif

-- method Date::get_day_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to extract day of year from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_day_of_year" g_date_get_day_of_year :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the day of the year, where Jan 1 is the first day of the
year. The date must be valid.
-}
dateGetDayOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to extract day of year from -}
    -> m Word32
    {- ^ __Returns:__ day of the year -}
dateGetDayOfYear :: Date -> m Word32
dateGetDayOfYear date :: Date
date = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word32
result <- Ptr Date -> IO Word32
g_date_get_day_of_year Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if ENABLE_OVERLOADING
data DateGetDayOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetDayOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetDayOfYear

#endif

-- method Date::get_iso8601_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_iso8601_week_of_year" g_date_get_iso8601_week_of_year :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the week of the year, where weeks are interpreted according
to ISO 8601.

/Since: 2.6/
-}
dateGetIso8601WeekOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a valid 'GI.GLib.Structs.Date.Date' -}
    -> m Word32
    {- ^ __Returns:__ ISO 8601 week number of the year. -}
dateGetIso8601WeekOfYear :: Date -> m Word32
dateGetIso8601WeekOfYear date :: Date
date = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word32
result <- Ptr Date -> IO Word32
g_date_get_iso8601_week_of_year Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if ENABLE_OVERLOADING
data DateGetIso8601WeekOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetIso8601WeekOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetIso8601WeekOfYear

#endif

-- method Date::get_julian
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to extract the Julian day from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_julian" g_date_get_julian :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the Julian day or \"serial number\" of the 'GI.GLib.Structs.Date.Date'. The
Julian day is simply the number of days since January 1, Year 1; i.e.,
January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
etc. The date must be valid.
-}
dateGetJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to extract the Julian day from -}
    -> m Word32
    {- ^ __Returns:__ Julian day -}
dateGetJulian :: Date -> m Word32
dateGetJulian date :: Date
date = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word32
result <- Ptr Date -> IO Word32
g_date_get_julian Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if ENABLE_OVERLOADING
data DateGetJulianMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetJulianMethodInfo Date signature where
    overloadedMethod _ = dateGetJulian

#endif

-- method Date::get_monday_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_monday_week_of_year" g_date_get_monday_week_of_year :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the week of the year, where weeks are understood to start on
Monday. If the date is before the first Monday of the year, return 0.
The date must be valid.
-}
dateGetMondayWeekOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m Word32
    {- ^ __Returns:__ week of the year -}
dateGetMondayWeekOfYear :: Date -> m Word32
dateGetMondayWeekOfYear date :: Date
date = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word32
result <- Ptr Date -> IO Word32
g_date_get_monday_week_of_year Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if ENABLE_OVERLOADING
data DateGetMondayWeekOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetMondayWeekOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetMondayWeekOfYear

#endif

-- method Date::get_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to get the month from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "DateMonth"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_month" g_date_get_month :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CUInt

{- |
Returns the month of the year. The date must be valid.
-}
dateGetMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to get the month from -}
    -> m GLib.Enums.DateMonth
    {- ^ __Returns:__ month of the year as a 'GI.GLib.Enums.DateMonth' -}
dateGetMonth :: Date -> m DateMonth
dateGetMonth date :: Date
date = IO DateMonth -> m DateMonth
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DateMonth -> m DateMonth) -> IO DateMonth -> m DateMonth
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    CUInt
result <- Ptr Date -> IO CUInt
g_date_get_month Ptr Date
date'
    let result' :: DateMonth
result' = (Int -> DateMonth
forall a. Enum a => Int -> a
toEnum (Int -> DateMonth) -> (CUInt -> Int) -> CUInt -> DateMonth
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    DateMonth -> IO DateMonth
forall (m :: * -> *) a. Monad m => a -> m a
return DateMonth
result'

#if ENABLE_OVERLOADING
data DateGetMonthMethodInfo
instance (signature ~ (m GLib.Enums.DateMonth), MonadIO m) => O.MethodInfo DateGetMonthMethodInfo Date signature where
    overloadedMethod _ = dateGetMonth

#endif

-- method Date::get_sunday_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_sunday_week_of_year" g_date_get_sunday_week_of_year :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the week of the year during which this date falls, if
weeks are understood to begin on Sunday. The date must be valid.
Can return 0 if the day is before the first Sunday of the year.
-}
dateGetSundayWeekOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m Word32
    {- ^ __Returns:__ week number -}
dateGetSundayWeekOfYear :: Date -> m Word32
dateGetSundayWeekOfYear date :: Date
date = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word32
result <- Ptr Date -> IO Word32
g_date_get_sunday_week_of_year Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if ENABLE_OVERLOADING
data DateGetSundayWeekOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetSundayWeekOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetSundayWeekOfYear

#endif

-- method Date::get_weekday
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "DateWeekday"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_weekday" g_date_get_weekday :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CUInt

{- |
Returns the day of the week for a 'GI.GLib.Structs.Date.Date'. The date must be valid.
-}
dateGetWeekday ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m GLib.Enums.DateWeekday
    {- ^ __Returns:__ day of the week as a 'GI.GLib.Enums.DateWeekday'. -}
dateGetWeekday :: Date -> m DateWeekday
dateGetWeekday date :: Date
date = IO DateWeekday -> m DateWeekday
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DateWeekday -> m DateWeekday)
-> IO DateWeekday -> m DateWeekday
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    CUInt
result <- Ptr Date -> IO CUInt
g_date_get_weekday Ptr Date
date'
    let result' :: DateWeekday
result' = (Int -> DateWeekday
forall a. Enum a => Int -> a
toEnum (Int -> DateWeekday) -> (CUInt -> Int) -> CUInt -> DateWeekday
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    DateWeekday -> IO DateWeekday
forall (m :: * -> *) a. Monad m => a -> m a
return DateWeekday
result'

#if ENABLE_OVERLOADING
data DateGetWeekdayMethodInfo
instance (signature ~ (m GLib.Enums.DateWeekday), MonadIO m) => O.MethodInfo DateGetWeekdayMethodInfo Date signature where
    overloadedMethod _ = dateGetWeekday

#endif

-- method Date::get_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_year" g_date_get_year :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word16

{- |
Returns the year of a 'GI.GLib.Structs.Date.Date'. The date must be valid.
-}
dateGetYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m Word16
    {- ^ __Returns:__ year in which the date falls -}
dateGetYear :: Date -> m Word16
dateGetYear date :: Date
date = IO Word16 -> m Word16
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word16 -> m Word16) -> IO Word16 -> m Word16
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word16
result <- Ptr Date -> IO Word16
g_date_get_year Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return Word16
result

#if ENABLE_OVERLOADING
data DateGetYearMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo DateGetYearMethodInfo Date signature where
    overloadedMethod _ = dateGetYear

#endif

-- method Date::is_first_of_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_first_of_month" g_date_is_first_of_month :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Returns 'True' if the date is on the first of a month.
The date must be valid.
-}
dateIsFirstOfMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the date is the first of the month -}
dateIsFirstOfMonth :: Date -> m Bool
dateIsFirstOfMonth date :: Date
date = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    CInt
result <- Ptr Date -> IO CInt
g_date_is_first_of_month Ptr Date
date'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
data DateIsFirstOfMonthMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo DateIsFirstOfMonthMethodInfo Date signature where
    overloadedMethod _ = dateIsFirstOfMonth

#endif

-- method Date::is_last_of_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_last_of_month" g_date_is_last_of_month :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Returns 'True' if the date is the last day of the month.
The date must be valid.
-}
dateIsLastOfMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the date is the last day of the month -}
dateIsLastOfMonth :: Date -> m Bool
dateIsLastOfMonth date :: Date
date = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    CInt
result <- Ptr Date -> IO CInt
g_date_is_last_of_month Ptr Date
date'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
data DateIsLastOfMonthMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo DateIsLastOfMonthMethodInfo Date signature where
    overloadedMethod _ = dateIsLastOfMonth

#endif

-- method Date::order
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date1", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "date2", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_order" g_date_order :: 
    Ptr Date ->                             -- date1 : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- date2 : TInterface (Name {namespace = "GLib", name = "Date"})
    IO ()

{- |
Checks if /@date1@/ is less than or equal to /@date2@/,
and swap the values if this is not the case.
-}
dateOrder ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date1@/: the first date -}
    -> Date
    {- ^ /@date2@/: the second date -}
    -> m ()
dateOrder :: Date -> Date -> m ()
dateOrder date1 :: Date
date1 date2 :: Date
date2 = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date1' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date1
    Ptr Date
date2' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date2
    Ptr Date -> Ptr Date -> IO ()
g_date_order Ptr Date
date1' Ptr Date
date2'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date1
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date2
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateOrderMethodInfo
instance (signature ~ (Date -> m ()), MonadIO m) => O.MethodInfo DateOrderMethodInfo Date signature where
    overloadedMethod _ = dateOrder

#endif

-- method Date::set_day
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_day" g_date_set_day :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word8 ->                                -- day : TBasicType TUInt8
    IO ()

{- |
Sets the day of the month for a 'GI.GLib.Structs.Date.Date'. If the resulting
day-month-year triplet is invalid, the date will be invalid.
-}
dateSetDay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word8
    {- ^ /@day@/: day to set -}
    -> m ()
dateSetDay :: Date -> Word8 -> m ()
dateSetDay date :: Date
date day :: Word8
day = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word8 -> IO ()
g_date_set_day Ptr Date
date' Word8
day
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetDayMethodInfo
instance (signature ~ (Word8 -> m ()), MonadIO m) => O.MethodInfo DateSetDayMethodInfo Date signature where
    overloadedMethod _ = dateSetDay

#endif

-- method Date::set_dmy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "y", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_dmy" g_date_set_dmy :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- y : TBasicType TUInt16
    IO ()

{- |
Sets the value of a 'GI.GLib.Structs.Date.Date' from a day, month, and year.
The day-month-year triplet must be valid; if you aren\'t
sure it is, call 'GI.GLib.Functions.dateValidDmy' to check before you
set it.
-}
dateSetDmy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word8
    {- ^ /@day@/: day -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> Word16
    {- ^ /@y@/: year -}
    -> m ()
dateSetDmy :: Date -> Word8 -> DateMonth -> Word16 -> m ()
dateSetDmy date :: Date
date day :: Word8
day month :: DateMonth
month y :: Word16
y = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    let month' :: CUInt
month' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateMonth -> Int) -> DateMonth -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateMonth -> Int
forall a. Enum a => a -> Int
fromEnum) DateMonth
month
    Ptr Date -> Word8 -> CUInt -> Word16 -> IO ()
g_date_set_dmy Ptr Date
date' Word8
day CUInt
month' Word16
y
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetDmyMethodInfo
instance (signature ~ (Word8 -> GLib.Enums.DateMonth -> Word16 -> m ()), MonadIO m) => O.MethodInfo DateSetDmyMethodInfo Date signature where
    overloadedMethod _ = dateSetDmy

#endif

-- method Date::set_julian
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "julian_date", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Julian day number (days since January 1, Year 1)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_julian" g_date_set_julian :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- julian_date : TBasicType TUInt32
    IO ()

{- |
Sets the value of a 'GI.GLib.Structs.Date.Date' from a Julian day number.
-}
dateSetJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word32
    {- ^ /@julianDate@/: Julian day number (days since January 1, Year 1) -}
    -> m ()
dateSetJulian :: Date -> Word32 -> m ()
dateSetJulian date :: Date
date julianDate :: Word32
julianDate = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_set_julian Ptr Date
date' Word32
julianDate
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetJulianMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSetJulianMethodInfo Date signature where
    overloadedMethod _ = dateSetJulian

#endif

-- method Date::set_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_month" g_date_set_month :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    IO ()

{- |
Sets the month of the year for a 'GI.GLib.Structs.Date.Date'.  If the resulting
day-month-year triplet is invalid, the date will be invalid.
-}
dateSetMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month to set -}
    -> m ()
dateSetMonth :: Date -> DateMonth -> m ()
dateSetMonth date :: Date
date month :: DateMonth
month = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    let month' :: CUInt
month' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateMonth -> Int) -> DateMonth -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateMonth -> Int
forall a. Enum a => a -> Int
fromEnum) DateMonth
month
    Ptr Date -> CUInt -> IO ()
g_date_set_month Ptr Date
date' CUInt
month'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetMonthMethodInfo
instance (signature ~ (GLib.Enums.DateMonth -> m ()), MonadIO m) => O.MethodInfo DateSetMonthMethodInfo Date signature where
    overloadedMethod _ = dateSetMonth

#endif

-- method Date::set_parse
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to fill in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "string to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_parse" g_date_set_parse :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    CString ->                              -- str : TBasicType TUTF8
    IO ()

{- |
Parses a user-inputted string /@str@/, and try to figure out what date it
represents, taking the [current locale][setlocale] into account. If the
string is successfully parsed, the date will be valid after the call.
Otherwise, it will be invalid. You should check using 'GI.GLib.Structs.Date.dateValid'
to see whether the parsing succeeded.

This function is not appropriate for file formats and the like; it
isn\'t very precise, and its exact behavior varies with the locale.
It\'s intended to be a heuristic routine that guesses what the user
means by a given string (and it does work pretty well in that
capacity).
-}
dateSetParse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to fill in -}
    -> T.Text
    {- ^ /@str@/: string to parse -}
    -> m ()
dateSetParse :: Date -> Text -> m ()
dateSetParse date :: Date
date str :: Text
str = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr Date -> CString -> IO ()
g_date_set_parse Ptr Date
date' CString
str'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetParseMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo DateSetParseMethodInfo Date signature where
    overloadedMethod _ = dateSetParse

#endif

-- method Date::set_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "time_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GTime value to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time" g_date_set_time :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Int32 ->                                -- time_ : TBasicType TInt32
    IO ()

{-# DEPRECATED dateSetTime ["(Since version 2.10)","Use 'GI.GLib.Structs.Date.dateSetTimeT' instead."] #-}
{- |
Sets the value of a date from a @/GTime/@ value.
The time to date conversion is done using the user\'s current timezone.
-}
dateSetTime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date'. -}
    -> Int32
    {- ^ /@time_@/: @/GTime/@ value to set. -}
    -> m ()
dateSetTime :: Date -> Int32 -> m ()
dateSetTime date :: Date
date time_ :: Int32
time_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Int32 -> IO ()
g_date_set_time Ptr Date
date' Int32
time_
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetTimeMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.MethodInfo DateSetTimeMethodInfo Date signature where
    overloadedMethod _ = dateSetTime

#endif

-- method Date::set_time_t
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timet", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "time_t value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time_t" g_date_set_time_t :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    CLong ->                                -- timet : TBasicType TLong
    IO ()

{- |
Sets the value of a date to the date corresponding to a time
specified as a time_t. The time to date conversion is done using
the user\'s current timezone.

To set the value of a date to the current day, you could write:

=== /C code/
>
> time_t now = time (NULL);
> if (now == (time_t) -1)
>   // handle the error
> g_date_set_time_t (date, now);


/Since: 2.10/
-}
dateSetTimeT ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> CLong
    {- ^ /@timet@/: time_t value to set -}
    -> m ()
dateSetTimeT :: Date -> CLong -> m ()
dateSetTimeT date :: Date
date timet :: CLong
timet = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> CLong -> IO ()
g_date_set_time_t Ptr Date
date' CLong
timet
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetTimeTMethodInfo
instance (signature ~ (CLong -> m ()), MonadIO m) => O.MethodInfo DateSetTimeTMethodInfo Date signature where
    overloadedMethod _ = dateSetTimeT

#endif

-- method Date::set_time_val
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeval", argType = TInterface (Name {namespace = "GLib", name = "TimeVal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GTimeVal value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time_val" g_date_set_time_val :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr GLib.TimeVal.TimeVal ->             -- timeval : TInterface (Name {namespace = "GLib", name = "TimeVal"})
    IO ()

{-# DEPRECATED dateSetTimeVal ["(Since version 2.62)","'GI.GLib.Structs.TimeVal.TimeVal' is not year-2038-safe. Use 'GI.GLib.Structs.Date.dateSetTimeT'","   instead."] #-}
{- |
Sets the value of a date from a 'GI.GLib.Structs.TimeVal.TimeVal' value.  Note that the
/@tvUsec@/ member is ignored, because 'GI.GLib.Structs.Date.Date' can\'t make use of the
additional precision.

The time to date conversion is done using the user\'s current timezone.

/Since: 2.10/
-}
dateSetTimeVal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> GLib.TimeVal.TimeVal
    {- ^ /@timeval@/: 'GI.GLib.Structs.TimeVal.TimeVal' value to set -}
    -> m ()
dateSetTimeVal :: Date -> TimeVal -> m ()
dateSetTimeVal date :: Date
date timeval :: TimeVal
timeval = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr TimeVal
timeval' <- TimeVal -> IO (Ptr TimeVal)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TimeVal
timeval
    Ptr Date -> Ptr TimeVal -> IO ()
g_date_set_time_val Ptr Date
date' Ptr TimeVal
timeval'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    TimeVal -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TimeVal
timeval
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetTimeValMethodInfo
instance (signature ~ (GLib.TimeVal.TimeVal -> m ()), MonadIO m) => O.MethodInfo DateSetTimeValMethodInfo Date signature where
    overloadedMethod _ = dateSetTimeVal

#endif

-- method Date::set_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_year" g_date_set_year :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO ()

{- |
Sets the year for a 'GI.GLib.Structs.Date.Date'. If the resulting day-month-year
triplet is invalid, the date will be invalid.
-}
dateSetYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word16
    {- ^ /@year@/: year to set -}
    -> m ()
dateSetYear :: Date -> Word16 -> m ()
dateSetYear date :: Date
date year :: Word16
year = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word16 -> IO ()
g_date_set_year Ptr Date
date' Word16
year
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSetYearMethodInfo
instance (signature ~ (Word16 -> m ()), MonadIO m) => O.MethodInfo DateSetYearMethodInfo Date signature where
    overloadedMethod _ = dateSetYear

#endif

-- method Date::subtract_days
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to decrement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_days", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of days to move", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_days" g_date_subtract_days :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_days : TBasicType TUInt
    IO ()

{- |
Moves a date some number of days into the past.
To move by weeks, just move by weeks*7 days.
The date must be valid.
-}
dateSubtractDays ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to decrement -}
    -> Word32
    {- ^ /@nDays@/: number of days to move -}
    -> m ()
dateSubtractDays :: Date -> Word32 -> m ()
dateSubtractDays date :: Date
date nDays :: Word32
nDays = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_subtract_days Ptr Date
date' Word32
nDays
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSubtractDaysMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSubtractDaysMethodInfo Date signature where
    overloadedMethod _ = dateSubtractDays

#endif

-- method Date::subtract_months
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to decrement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_months", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of months to move", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_months" g_date_subtract_months :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_months : TBasicType TUInt
    IO ()

{- |
Moves a date some number of months into the past.
If the current day of the month doesn\'t exist in
the destination month, the day of the month
may change. The date must be valid.
-}
dateSubtractMonths ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to decrement -}
    -> Word32
    {- ^ /@nMonths@/: number of months to move -}
    -> m ()
dateSubtractMonths :: Date -> Word32 -> m ()
dateSubtractMonths date :: Date
date nMonths :: Word32
nMonths = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_subtract_months Ptr Date
date' Word32
nMonths
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSubtractMonthsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSubtractMonthsMethodInfo Date signature where
    overloadedMethod _ = dateSubtractMonths

#endif

-- method Date::subtract_years
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to decrement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_years", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of years to move", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_years" g_date_subtract_years :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_years : TBasicType TUInt
    IO ()

{- |
Moves a date some number of years into the past.
If the current day doesn\'t exist in the destination
year (i.e. it\'s February 29 and you move to a non-leap-year)
then the day is changed to February 29. The date
must be valid.
-}
dateSubtractYears ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to decrement -}
    -> Word32
    {- ^ /@nYears@/: number of years to move -}
    -> m ()
dateSubtractYears :: Date -> Word32 -> m ()
dateSubtractYears date :: Date
date nYears :: Word32
nYears = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Word32 -> IO ()
g_date_subtract_years Ptr Date
date' Word32
nYears
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateSubtractYearsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSubtractYearsMethodInfo Date signature where
    overloadedMethod _ = dateSubtractYears

#endif

-- method Date::to_struct_tm
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to set the struct tm from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tm", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "struct tm to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_to_struct_tm" g_date_to_struct_tm :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr () ->                               -- tm : TBasicType TPtr
    IO ()

{- |
Fills in the date-related bits of a struct tm using the /@date@/ value.
Initializes the non-date parts with something sane but meaningless.
-}
dateToStructTm ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to set the struct tm from -}
    -> Ptr ()
    {- ^ /@tm@/: struct tm to fill -}
    -> m ()
dateToStructTm :: Date -> Ptr () -> m ()
dateToStructTm date :: Date
date tm :: Ptr ()
tm = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Ptr Date -> Ptr () -> IO ()
g_date_to_struct_tm Ptr Date
date' Ptr ()
tm
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data DateToStructTmMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.MethodInfo DateToStructTmMethodInfo Date signature where
    overloadedMethod _ = dateToStructTm

#endif

-- method Date::valid
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid" g_date_valid :: 
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Returns 'True' if the 'GI.GLib.Structs.Date.Date' represents an existing day. The date must not
contain garbage; it should have been initialized with 'GI.GLib.Structs.Date.dateClear'
if it wasn\'t allocated by one of the 'GI.GLib.Structs.Date.dateNew' variants.
-}
dateValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to check -}
    -> m Bool
    {- ^ __Returns:__ Whether the date is valid -}
dateValid :: Date -> m Bool
dateValid date :: Date
date = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    CInt
result <- Ptr Date -> IO CInt
g_date_valid Ptr Date
date'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
data DateValidMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo DateValidMethodInfo Date signature where
    overloadedMethod _ = dateValid

#endif

-- method Date::get_days_in_month
-- method type : MemberFunction
-- Args : [Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_days_in_month" g_date_get_days_in_month :: 
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO Word8

{- |
Returns the number of days in a month, taking leap
years into account.
-}
dateGetDaysInMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> Word16
    {- ^ /@year@/: year -}
    -> m Word8
    {- ^ __Returns:__ number of days in /@month@/ during the /@year@/ -}
dateGetDaysInMonth :: DateMonth -> Word16 -> m Word8
dateGetDaysInMonth month :: DateMonth
month year :: Word16
year = IO Word8 -> m Word8
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    let month' :: CUInt
month' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateMonth -> Int) -> DateMonth -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateMonth -> Int
forall a. Enum a => a -> Int
fromEnum) DateMonth
month
    Word8
result <- CUInt -> Word16 -> IO Word8
g_date_get_days_in_month CUInt
month' Word16
year
    Word8 -> IO Word8
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result

#if ENABLE_OVERLOADING
#endif

-- method Date::get_monday_weeks_in_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_monday_weeks_in_year" g_date_get_monday_weeks_in_year :: 
    Word16 ->                               -- year : TBasicType TUInt16
    IO Word8

{- |
Returns the number of weeks in the year, where weeks
are taken to start on Monday. Will be 52 or 53. The
date must be valid. (Years always have 52 7-day periods,
plus 1 or 2 extra days depending on whether it\'s a leap
year. This function is basically telling you how many
Mondays are in the year, i.e. there are 53 Mondays if
one of the extra days happens to be a Monday.)
-}
dateGetMondayWeeksInYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: a year -}
    -> m Word8
    {- ^ __Returns:__ number of Mondays in the year -}
dateGetMondayWeeksInYear :: Word16 -> m Word8
dateGetMondayWeeksInYear year :: Word16
year = IO Word8 -> m Word8
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    Word8
result <- Word16 -> IO Word8
g_date_get_monday_weeks_in_year Word16
year
    Word8 -> IO Word8
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result

#if ENABLE_OVERLOADING
#endif

-- method Date::get_sunday_weeks_in_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year to count weeks in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_sunday_weeks_in_year" g_date_get_sunday_weeks_in_year :: 
    Word16 ->                               -- year : TBasicType TUInt16
    IO Word8

{- |
Returns the number of weeks in the year, where weeks
are taken to start on Sunday. Will be 52 or 53. The
date must be valid. (Years always have 52 7-day periods,
plus 1 or 2 extra days depending on whether it\'s a leap
year. This function is basically telling you how many
Sundays are in the year, i.e. there are 53 Sundays if
one of the extra days happens to be a Sunday.)
-}
dateGetSundayWeeksInYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: year to count weeks in -}
    -> m Word8
    {- ^ __Returns:__ the number of weeks in /@year@/ -}
dateGetSundayWeeksInYear :: Word16 -> m Word8
dateGetSundayWeeksInYear year :: Word16
year = IO Word8 -> m Word8
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    Word8
result <- Word16 -> IO Word8
g_date_get_sunday_weeks_in_year Word16
year
    Word8 -> IO Word8
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result

#if ENABLE_OVERLOADING
#endif

-- method Date::is_leap_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_leap_year" g_date_is_leap_year :: 
    Word16 ->                               -- year : TBasicType TUInt16
    IO CInt

{- |
Returns 'True' if the year is a leap year.

For the purposes of this function, leap year is every year
divisible by 4 unless that year is divisible by 100. If it
is divisible by 100 it would be a leap year only if that year
is also divisible by 400.
-}
dateIsLeapYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: year to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the year is a leap year -}
dateIsLeapYear :: Word16 -> m Bool
dateIsLeapYear year :: Word16
year = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word16 -> IO CInt
g_date_is_leap_year Word16
year
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::strftime
-- method type : MemberFunction
-- Args : [Arg {argCName = "s", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "destination buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "slen", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "buffer size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "format string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "valid #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_strftime" g_date_strftime :: 
    CString ->                              -- s : TBasicType TUTF8
    Word64 ->                               -- slen : TBasicType TUInt64
    CString ->                              -- format : TBasicType TUTF8
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word64

{- |
Generates a printed representation of the date, in a
[locale][setlocale]-specific way.
Works just like the platform\'s C library @/strftime()/@ function,
but only accepts date-related formats; time-related formats
give undefined results. Date must be valid. Unlike @/strftime()/@
(which uses the locale encoding), works on a UTF-8 format
string and stores a UTF-8 result.

This function does not provide any conversion specifiers in
addition to those implemented by the platform\'s C library.
For example, don\'t expect that using 'GI.GLib.Functions.dateStrftime' would
make the %F provided by the C99 @/strftime()/@ work on Windows
where the C library only complies to C89.
-}
dateStrftime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@s@/: destination buffer -}
    -> Word64
    {- ^ /@slen@/: buffer size -}
    -> T.Text
    {- ^ /@format@/: format string -}
    -> Date
    {- ^ /@date@/: valid 'GI.GLib.Structs.Date.Date' -}
    -> m Word64
    {- ^ __Returns:__ number of characters written to the buffer, or 0 the buffer was too small -}
dateStrftime :: Text -> Word64 -> Text -> Date -> m Word64
dateStrftime s :: Text
s slen :: Word64
slen format :: Text
format date :: Date
date = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    CString
s' <- Text -> IO CString
textToCString Text
s
    CString
format' <- Text -> IO CString
textToCString Text
format
    Ptr Date
date' <- Date -> IO (Ptr Date)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Date
date
    Word64
result <- CString -> Word64 -> CString -> Ptr Date -> IO Word64
g_date_strftime CString
s' Word64
slen CString
format' Ptr Date
date'
    Date -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Date
date
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
s'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
format'
    Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_day
-- method type : MemberFunction
-- Args : [Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_day" g_date_valid_day :: 
    Word8 ->                                -- day : TBasicType TUInt8
    IO CInt

{- |
Returns 'True' if the day of the month is valid (a day is valid if it\'s
between 1 and 31 inclusive).
-}
dateValidDay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    {- ^ /@day@/: day to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the day is valid -}
dateValidDay :: Word8 -> m Bool
dateValidDay day :: Word8
day = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word8 -> IO CInt
g_date_valid_day Word8
day
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_dmy
-- method type : MemberFunction
-- Args : [Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_dmy" g_date_valid_dmy :: 
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO CInt

{- |
Returns 'True' if the day-month-year triplet forms a valid, existing day
in the range of days 'GI.GLib.Structs.Date.Date' understands (Year 1 or later, no more than
a few thousand years in the future).
-}
dateValidDmy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    {- ^ /@day@/: day -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> Word16
    {- ^ /@year@/: year -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the date is a valid one -}
dateValidDmy :: Word8 -> DateMonth -> Word16 -> m Bool
dateValidDmy day :: Word8
day month :: DateMonth
month year :: Word16
year = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let month' :: CUInt
month' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateMonth -> Int) -> DateMonth -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateMonth -> Int
forall a. Enum a => a -> Int
fromEnum) DateMonth
month
    CInt
result <- Word8 -> CUInt -> Word16 -> IO CInt
g_date_valid_dmy Word8
day CUInt
month' Word16
year
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_julian
-- method type : MemberFunction
-- Args : [Arg {argCName = "julian_date", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Julian day to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_julian" g_date_valid_julian :: 
    Word32 ->                               -- julian_date : TBasicType TUInt32
    IO CInt

{- |
Returns 'True' if the Julian day is valid. Anything greater than zero
is basically a valid Julian, though there is a 32-bit limit.
-}
dateValidJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@julianDate@/: Julian day to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the Julian day is valid -}
dateValidJulian :: Word32 -> m Bool
dateValidJulian julianDate :: Word32
julianDate = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word32 -> IO CInt
g_date_valid_julian Word32
julianDate
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_month
-- method type : MemberFunction
-- Args : [Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_month" g_date_valid_month :: 
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    IO CInt

{- |
Returns 'True' if the month value is valid. The 12 'GI.GLib.Enums.DateMonth'
enumeration values are the only valid months.
-}
dateValidMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the month is valid -}
dateValidMonth :: DateMonth -> m Bool
dateValidMonth month :: DateMonth
month = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let month' :: CUInt
month' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateMonth -> Int) -> DateMonth -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateMonth -> Int
forall a. Enum a => a -> Int
fromEnum) DateMonth
month
    CInt
result <- CUInt -> IO CInt
g_date_valid_month CUInt
month'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_weekday
-- method type : MemberFunction
-- Args : [Arg {argCName = "weekday", argType = TInterface (Name {namespace = "GLib", name = "DateWeekday"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "weekday", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_weekday" g_date_valid_weekday :: 
    CUInt ->                                -- weekday : TInterface (Name {namespace = "GLib", name = "DateWeekday"})
    IO CInt

{- |
Returns 'True' if the weekday is valid. The seven 'GI.GLib.Enums.DateWeekday' enumeration
values are the only valid weekdays.
-}
dateValidWeekday ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.DateWeekday
    {- ^ /@weekday@/: weekday -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the weekday is valid -}
dateValidWeekday :: DateWeekday -> m Bool
dateValidWeekday weekday :: DateWeekday
weekday = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let weekday' :: CUInt
weekday' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DateWeekday -> Int) -> DateWeekday -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateWeekday -> Int
forall a. Enum a => a -> Int
fromEnum) DateWeekday
weekday
    CInt
result <- CUInt -> IO CInt
g_date_valid_weekday CUInt
weekday'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_year" g_date_valid_year :: 
    Word16 ->                               -- year : TBasicType TUInt16
    IO CInt

{- |
Returns 'True' if the year is valid. Any year greater than 0 is valid,
though there is a 16-bit limit to what 'GI.GLib.Structs.Date.Date' will understand.
-}
dateValidYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: year -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the year is valid -}
dateValidYear :: Word16 -> m Bool
dateValidYear year :: Word16
year = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word16 -> IO CInt
g_date_valid_year Word16
year
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveDateMethod (t :: Symbol) (o :: *) :: * where
    ResolveDateMethod "addDays" o = DateAddDaysMethodInfo
    ResolveDateMethod "addMonths" o = DateAddMonthsMethodInfo
    ResolveDateMethod "addYears" o = DateAddYearsMethodInfo
    ResolveDateMethod "clamp" o = DateClampMethodInfo
    ResolveDateMethod "clear" o = DateClearMethodInfo
    ResolveDateMethod "compare" o = DateCompareMethodInfo
    ResolveDateMethod "copy" o = DateCopyMethodInfo
    ResolveDateMethod "daysBetween" o = DateDaysBetweenMethodInfo
    ResolveDateMethod "free" o = DateFreeMethodInfo
    ResolveDateMethod "isFirstOfMonth" o = DateIsFirstOfMonthMethodInfo
    ResolveDateMethod "isLastOfMonth" o = DateIsLastOfMonthMethodInfo
    ResolveDateMethod "order" o = DateOrderMethodInfo
    ResolveDateMethod "subtractDays" o = DateSubtractDaysMethodInfo
    ResolveDateMethod "subtractMonths" o = DateSubtractMonthsMethodInfo
    ResolveDateMethod "subtractYears" o = DateSubtractYearsMethodInfo
    ResolveDateMethod "toStructTm" o = DateToStructTmMethodInfo
    ResolveDateMethod "valid" o = DateValidMethodInfo
    ResolveDateMethod "getDay" o = DateGetDayMethodInfo
    ResolveDateMethod "getDayOfYear" o = DateGetDayOfYearMethodInfo
    ResolveDateMethod "getIso8601WeekOfYear" o = DateGetIso8601WeekOfYearMethodInfo
    ResolveDateMethod "getJulian" o = DateGetJulianMethodInfo
    ResolveDateMethod "getMondayWeekOfYear" o = DateGetMondayWeekOfYearMethodInfo
    ResolveDateMethod "getMonth" o = DateGetMonthMethodInfo
    ResolveDateMethod "getSundayWeekOfYear" o = DateGetSundayWeekOfYearMethodInfo
    ResolveDateMethod "getWeekday" o = DateGetWeekdayMethodInfo
    ResolveDateMethod "getYear" o = DateGetYearMethodInfo
    ResolveDateMethod "setDay" o = DateSetDayMethodInfo
    ResolveDateMethod "setDmy" o = DateSetDmyMethodInfo
    ResolveDateMethod "setJulian" o = DateSetJulianMethodInfo
    ResolveDateMethod "setMonth" o = DateSetMonthMethodInfo
    ResolveDateMethod "setParse" o = DateSetParseMethodInfo
    ResolveDateMethod "setTime" o = DateSetTimeMethodInfo
    ResolveDateMethod "setTimeT" o = DateSetTimeTMethodInfo
    ResolveDateMethod "setTimeVal" o = DateSetTimeValMethodInfo
    ResolveDateMethod "setYear" o = DateSetYearMethodInfo
    ResolveDateMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDateMethod t Date, O.MethodInfo info Date p) => O.IsLabelProxy t (Date -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDateMethod t Date, O.MethodInfo info Date p) => O.IsLabel t (Date -> 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

#endif