{- |
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 #GDate-struct is obtained from g_date_new(), 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 g_date_clear(). g_date_clear() 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.
-}

module GI.GLib.Structs.Date
    ( 

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


 -- * Methods
-- ** dateAddDays
    dateAddDays                             ,


-- ** dateAddMonths
    dateAddMonths                           ,


-- ** dateAddYears
    dateAddYears                            ,


-- ** dateClamp
    dateClamp                               ,


-- ** dateClear
    dateClear                               ,


-- ** dateCompare
    dateCompare                             ,


-- ** dateDaysBetween
    dateDaysBetween                         ,


-- ** dateFree
    dateFree                                ,


-- ** dateGetDay
    dateGetDay                              ,


-- ** dateGetDayOfYear
    dateGetDayOfYear                        ,


-- ** dateGetIso8601WeekOfYear
    dateGetIso8601WeekOfYear                ,


-- ** dateGetJulian
    dateGetJulian                           ,


-- ** dateGetMondayWeekOfYear
    dateGetMondayWeekOfYear                 ,


-- ** dateGetMonth
    dateGetMonth                            ,


-- ** dateGetSundayWeekOfYear
    dateGetSundayWeekOfYear                 ,


-- ** dateGetWeekday
    dateGetWeekday                          ,


-- ** dateGetYear
    dateGetYear                             ,


-- ** dateIsFirstOfMonth
    dateIsFirstOfMonth                      ,


-- ** dateIsLastOfMonth
    dateIsLastOfMonth                       ,


-- ** dateNew
    dateNew                                 ,


-- ** dateNewDmy
    dateNewDmy                              ,


-- ** dateNewJulian
    dateNewJulian                           ,


-- ** dateOrder
    dateOrder                               ,


-- ** dateSetDay
    dateSetDay                              ,


-- ** dateSetDmy
    dateSetDmy                              ,


-- ** dateSetJulian
    dateSetJulian                           ,


-- ** dateSetMonth
    dateSetMonth                            ,


-- ** dateSetParse
    dateSetParse                            ,


-- ** dateSetTime
    dateSetTime                             ,


-- ** dateSetTimeT
    dateSetTimeT                            ,


-- ** dateSetTimeVal
    dateSetTimeVal                          ,


-- ** dateSetYear
    dateSetYear                             ,


-- ** dateSubtractDays
    dateSubtractDays                        ,


-- ** dateSubtractMonths
    dateSubtractMonths                      ,


-- ** dateSubtractYears
    dateSubtractYears                       ,


-- ** dateToStructTm
    dateToStructTm                          ,


-- ** dateValid
    dateValid                               ,




 -- * Properties
-- ** Day
    dateReadDay                             ,


-- ** Dmy
    dateReadDmy                             ,


-- ** Julian
    dateReadJulian                          ,


-- ** JulianDays
    dateReadJulianDays                      ,


-- ** Month
    dateReadMonth                           ,


-- ** Year
    dateReadYear                            ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.GLib.Types
import GI.GLib.Callbacks

newtype Date = Date (ForeignPtr Date)
foreign import ccall "g_date_get_type" c_g_date_get_type :: 
    IO GType

instance BoxedObject Date where
    boxedType _ = c_g_date_get_type

noDate :: Maybe Date
noDate = Nothing

dateReadJulianDays :: Date -> IO Word32
dateReadJulianDays s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Word32
    return val

dateReadJulian :: Date -> IO Word32
dateReadJulian s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO Word32
    return val

dateReadDmy :: Date -> IO Word32
dateReadDmy s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Word32
    return val

dateReadDay :: Date -> IO Word32
dateReadDay s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 12) :: IO Word32
    return val

dateReadMonth :: Date -> IO Word32
dateReadMonth s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word32
    return val

dateReadYear :: Date -> IO Word32
dateReadYear s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Word32
    return val

-- method Date::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "GLib" "Date"
-- throws : False
-- Skip return : False

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


dateNew ::
    (MonadIO m) =>
    m Date
dateNew  = liftIO $ do
    result <- g_date_new
    checkUnexpectedReturnNULL "g_date_new" result
    result' <- (wrapBoxed Date) result
    return result'

-- method Date::new_dmy
-- method type : Constructor
-- Args : [Arg {argName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TInterface "GLib" "DateMonth", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TInterface "GLib" "DateMonth", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "Date"
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new_dmy" g_date_new_dmy :: 
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface "GLib" "DateMonth"
    Word16 ->                               -- year : TBasicType TUInt16
    IO (Ptr Date)


dateNewDmy ::
    (MonadIO m) =>
    Word8 ->                                -- day
    DateMonth ->                            -- month
    Word16 ->                               -- year
    m Date
dateNewDmy day month year = liftIO $ do
    let month' = (fromIntegral . fromEnum) month
    result <- g_date_new_dmy day month' year
    checkUnexpectedReturnNULL "g_date_new_dmy" result
    result' <- (wrapBoxed Date) result
    return result'

-- method Date::new_julian
-- method type : Constructor
-- Args : [Arg {argName = "julian_day", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "julian_day", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "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)


dateNewJulian ::
    (MonadIO m) =>
    Word32 ->                               -- julian_day
    m Date
dateNewJulian julian_day = liftIO $ do
    result <- g_date_new_julian julian_day
    checkUnexpectedReturnNULL "g_date_new_julian" result
    result' <- (wrapBoxed Date) result
    return result'

-- method Date::add_days
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_days", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_days", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_days" g_date_add_days :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_days : TBasicType TUInt32
    IO ()


dateAddDays ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_days
    m ()
dateAddDays _obj n_days = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_add_days _obj' n_days
    touchManagedPtr _obj
    return ()

-- method Date::add_months
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_months", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_months", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_months" g_date_add_months :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_months : TBasicType TUInt32
    IO ()


dateAddMonths ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_months
    m ()
dateAddMonths _obj n_months = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_add_months _obj' n_months
    touchManagedPtr _obj
    return ()

-- method Date::add_years
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_years", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_years", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_years" g_date_add_years :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_years : TBasicType TUInt32
    IO ()


dateAddYears ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_years
    m ()
dateAddYears _obj n_years = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_add_years _obj' n_years
    touchManagedPtr _obj
    return ()

-- method Date::clamp
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "min_date", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_date", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "min_date", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_date", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_clamp" g_date_clamp :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Ptr Date ->                             -- min_date : TInterface "GLib" "Date"
    Ptr Date ->                             -- max_date : TInterface "GLib" "Date"
    IO ()


dateClamp ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Date ->                                 -- min_date
    Date ->                                 -- max_date
    m ()
dateClamp _obj min_date max_date = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let min_date' = unsafeManagedPtrGetPtr min_date
    let max_date' = unsafeManagedPtrGetPtr max_date
    g_date_clamp _obj' min_date' max_date'
    touchManagedPtr _obj
    touchManagedPtr min_date
    touchManagedPtr max_date
    return ()

-- method Date::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_dates", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_dates", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_clear" g_date_clear :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_dates : TBasicType TUInt32
    IO ()


dateClear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_dates
    m ()
dateClear _obj n_dates = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_clear _obj' n_dates
    touchManagedPtr _obj
    return ()

-- method Date::compare
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rhs", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rhs", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_compare" g_date_compare :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Ptr Date ->                             -- rhs : TInterface "GLib" "Date"
    IO Int32


dateCompare ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Date ->                                 -- rhs
    m Int32
dateCompare _obj rhs = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let rhs' = unsafeManagedPtrGetPtr rhs
    result <- g_date_compare _obj' rhs'
    touchManagedPtr _obj
    touchManagedPtr rhs
    return result

-- method Date::days_between
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "date2", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "date2", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_days_between" g_date_days_between :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Ptr Date ->                             -- date2 : TInterface "GLib" "Date"
    IO Int32


dateDaysBetween ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Date ->                                 -- date2
    m Int32
dateDaysBetween _obj date2 = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let date2' = unsafeManagedPtrGetPtr date2
    result <- g_date_days_between _obj' date2'
    touchManagedPtr _obj
    touchManagedPtr date2
    return result

-- method Date::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_free" g_date_free :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO ()


dateFree ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m ()
dateFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_free _obj'
    touchManagedPtr _obj
    return ()

-- method Date::get_day
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt8
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_day" g_date_get_day :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word8


dateGetDay ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word8
dateGetDay _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_day _obj'
    touchManagedPtr _obj
    return result

-- method Date::get_day_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_day_of_year" g_date_get_day_of_year :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word32


dateGetDayOfYear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word32
dateGetDayOfYear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_day_of_year _obj'
    touchManagedPtr _obj
    return result

-- method Date::get_iso8601_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_iso8601_week_of_year" g_date_get_iso8601_week_of_year :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word32


dateGetIso8601WeekOfYear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word32
dateGetIso8601WeekOfYear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_iso8601_week_of_year _obj'
    touchManagedPtr _obj
    return result

-- method Date::get_julian
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_julian" g_date_get_julian :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word32


dateGetJulian ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word32
dateGetJulian _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_julian _obj'
    touchManagedPtr _obj
    return result

-- method Date::get_monday_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_monday_week_of_year" g_date_get_monday_week_of_year :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word32


dateGetMondayWeekOfYear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word32
dateGetMondayWeekOfYear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_monday_week_of_year _obj'
    touchManagedPtr _obj
    return result

-- method Date::get_month
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "DateMonth"
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_month" g_date_get_month :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO CUInt


dateGetMonth ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m DateMonth
dateGetMonth _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_month _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method Date::get_sunday_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_sunday_week_of_year" g_date_get_sunday_week_of_year :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word32


dateGetSundayWeekOfYear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word32
dateGetSundayWeekOfYear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_sunday_week_of_year _obj'
    touchManagedPtr _obj
    return result

-- method Date::get_weekday
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "DateWeekday"
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_weekday" g_date_get_weekday :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO CUInt


dateGetWeekday ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m DateWeekday
dateGetWeekday _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_weekday _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method Date::get_year
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt16
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_year" g_date_get_year :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO Word16


dateGetYear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Word16
dateGetYear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_get_year _obj'
    touchManagedPtr _obj
    return result

-- method Date::is_first_of_month
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_first_of_month" g_date_is_first_of_month :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO CInt


dateIsFirstOfMonth ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Bool
dateIsFirstOfMonth _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_is_first_of_month _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Date::is_last_of_month
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_last_of_month" g_date_is_last_of_month :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO CInt


dateIsLastOfMonth ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Bool
dateIsLastOfMonth _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_is_last_of_month _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Date::order
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "date2", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "date2", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_order" g_date_order :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Ptr Date ->                             -- date2 : TInterface "GLib" "Date"
    IO ()


dateOrder ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Date ->                                 -- date2
    m ()
dateOrder _obj date2 = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let date2' = unsafeManagedPtrGetPtr date2
    g_date_order _obj' date2'
    touchManagedPtr _obj
    touchManagedPtr date2
    return ()

-- method Date::set_day
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_day" g_date_set_day :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word8 ->                                -- day : TBasicType TUInt8
    IO ()


dateSetDay ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word8 ->                                -- day
    m ()
dateSetDay _obj day = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_set_day _obj' day
    touchManagedPtr _obj
    return ()

-- method Date::set_dmy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TInterface "GLib" "DateMonth", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TInterface "GLib" "DateMonth", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_dmy" g_date_set_dmy :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface "GLib" "DateMonth"
    Word16 ->                               -- y : TBasicType TUInt16
    IO ()


dateSetDmy ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word8 ->                                -- day
    DateMonth ->                            -- month
    Word16 ->                               -- y
    m ()
dateSetDmy _obj day month y = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let month' = (fromIntegral . fromEnum) month
    g_date_set_dmy _obj' day month' y
    touchManagedPtr _obj
    return ()

-- method Date::set_julian
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "julian_date", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "julian_date", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_julian" g_date_set_julian :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- julian_date : TBasicType TUInt32
    IO ()


dateSetJulian ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- julian_date
    m ()
dateSetJulian _obj julian_date = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_set_julian _obj' julian_date
    touchManagedPtr _obj
    return ()

-- method Date::set_month
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TInterface "GLib" "DateMonth", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TInterface "GLib" "DateMonth", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_month" g_date_set_month :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    CUInt ->                                -- month : TInterface "GLib" "DateMonth"
    IO ()


dateSetMonth ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    DateMonth ->                            -- month
    m ()
dateSetMonth _obj month = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let month' = (fromIntegral . fromEnum) month
    g_date_set_month _obj' month'
    touchManagedPtr _obj
    return ()

-- method Date::set_parse
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_parse" g_date_set_parse :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    CString ->                              -- str : TBasicType TUTF8
    IO ()


dateSetParse ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    T.Text ->                               -- str
    m ()
dateSetParse _obj str = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    str' <- textToCString str
    g_date_set_parse _obj' str'
    touchManagedPtr _obj
    freeMem str'
    return ()

-- method Date::set_time
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time" g_date_set_time :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Int32 ->                                -- time_ : TBasicType TInt32
    IO ()

{-# DEPRECATED dateSetTime ["(Since version 2.10)","Use g_date_set_time_t() instead."]#-}
dateSetTime ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Int32 ->                                -- time_
    m ()
dateSetTime _obj time_ = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_set_time _obj' time_
    touchManagedPtr _obj
    return ()

-- method Date::set_time_t
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timet", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timet", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time_t" g_date_set_time_t :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Int64 ->                                -- timet : TBasicType TInt64
    IO ()


dateSetTimeT ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Int64 ->                                -- timet
    m ()
dateSetTimeT _obj timet = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_set_time_t _obj' timet
    touchManagedPtr _obj
    return ()

-- method Date::set_time_val
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeval", argType = TInterface "GLib" "TimeVal", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeval", argType = TInterface "GLib" "TimeVal", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time_val" g_date_set_time_val :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Ptr TimeVal ->                          -- timeval : TInterface "GLib" "TimeVal"
    IO ()


dateSetTimeVal ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    TimeVal ->                              -- timeval
    m ()
dateSetTimeVal _obj timeval = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let timeval' = unsafeManagedPtrGetPtr timeval
    g_date_set_time_val _obj' timeval'
    touchManagedPtr _obj
    touchManagedPtr timeval
    return ()

-- method Date::set_year
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_year" g_date_set_year :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word16 ->                               -- year : TBasicType TUInt16
    IO ()


dateSetYear ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word16 ->                               -- year
    m ()
dateSetYear _obj year = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_set_year _obj' year
    touchManagedPtr _obj
    return ()

-- method Date::subtract_days
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_days", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_days", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_days" g_date_subtract_days :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_days : TBasicType TUInt32
    IO ()


dateSubtractDays ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_days
    m ()
dateSubtractDays _obj n_days = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_subtract_days _obj' n_days
    touchManagedPtr _obj
    return ()

-- method Date::subtract_months
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_months", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_months", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_months" g_date_subtract_months :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_months : TBasicType TUInt32
    IO ()


dateSubtractMonths ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_months
    m ()
dateSubtractMonths _obj n_months = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_subtract_months _obj' n_months
    touchManagedPtr _obj
    return ()

-- method Date::subtract_years
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_years", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_years", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_years" g_date_subtract_years :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Word32 ->                               -- n_years : TBasicType TUInt32
    IO ()


dateSubtractYears ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Word32 ->                               -- n_years
    m ()
dateSubtractYears _obj n_years = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_subtract_years _obj' n_years
    touchManagedPtr _obj
    return ()

-- method Date::to_struct_tm
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tm", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tm", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_date_to_struct_tm" g_date_to_struct_tm :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    Ptr () ->                               -- tm : TBasicType TVoid
    IO ()


dateToStructTm ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    Ptr () ->                               -- tm
    m ()
dateToStructTm _obj tm = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_date_to_struct_tm _obj' tm
    touchManagedPtr _obj
    return ()

-- method Date::valid
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid" g_date_valid :: 
    Ptr Date ->                             -- _obj : TInterface "GLib" "Date"
    IO CInt


dateValid ::
    (MonadIO m) =>
    Date ->                                 -- _obj
    m Bool
dateValid _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_date_valid _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'