packages feed

HsSVN-0.2: Subversion/FileSystem/PathChange.hs

{-# OPTIONS_GHC -optc-D__GLASGOW_HASKELL__=606 #-}
{-# OPTIONS_GHC -optc-DDARWIN #-}
{-# OPTIONS_GHC -optc-DSIGPROCMASK_SETS_THREAD_MASK #-}
{-# INCLUDE "HsSVN.h" #-}
{-# LINE 1 "Subversion/FileSystem/PathChange.hsc" #-}
{- -*- haskell -*- -}
{-# LINE 2 "Subversion/FileSystem/PathChange.hsc" #-}

-- |This module only defines two types; 'PathChange' and 'ChangeKind'.


{-# LINE 6 "Subversion/FileSystem/PathChange.hsc" #-}

module Subversion.FileSystem.PathChange
    ( PathChange(..)
    , ChangeKind(..)
    )
    where

import           Data.Word
import           Foreign.Storable
import           Subversion.Hash
import           Subversion.Types

-- |@'PathChange'@ describes a change in a revision occured on a path.
-- 
-- Note that @svn_fs_path_change_t.node_rev_id@ is currently
-- unavailable in this binding. Add one if you really need it.
data PathChange = PathChange {
      pcChangeKind :: ChangeKind -- ^ Kind of change.
    , pcTextMod    :: Bool       -- ^ Were there text modifications?
    , pcPropMod    :: Bool       -- ^ Were there property modifications?
    } deriving (Show, Eq)


type SVN_FS_PATH_CHANGE_KIND_T = Word32
{-# LINE 30 "Subversion/FileSystem/PathChange.hsc" #-}

-- |The kind of change that occured on the path.
data ChangeKind = ModifiedPath -- ^ defalut value
                | AddedPath    -- ^ path added in txn
                | DeletedPath  -- ^ path removed in txn
                | ReplacedPath -- ^ path removed and re-added in txn
                  deriving (Show, Eq)


unmarshalChangeKind :: SVN_FS_PATH_CHANGE_KIND_T -> ChangeKind
unmarshalChangeKind (0) = ModifiedPath
{-# LINE 41 "Subversion/FileSystem/PathChange.hsc" #-}
unmarshalChangeKind (1) = AddedPath
{-# LINE 42 "Subversion/FileSystem/PathChange.hsc" #-}
unmarshalChangeKind (2) = DeletedPath
{-# LINE 43 "Subversion/FileSystem/PathChange.hsc" #-}
unmarshalChangeKind (3) = ReplacedPath
{-# LINE 44 "Subversion/FileSystem/PathChange.hsc" #-}


instance HashValue PathChange where
    marshal pc
        = fail "marshalling PathChange is not supported"

    unmarshal finalizer pcPtr
        = do kind    <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) pcPtr
{-# LINE 52 "Subversion/FileSystem/PathChange.hsc" #-}
             textMod <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) pcPtr
{-# LINE 53 "Subversion/FileSystem/PathChange.hsc" #-}
             propMod <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) pcPtr
{-# LINE 54 "Subversion/FileSystem/PathChange.hsc" #-}
             finalizer
             return PathChange {
                                pcChangeKind = unmarshalChangeKind kind
                              , pcTextMod    = unmarshalBool       textMod
                              , pcPropMod    = unmarshalBool       propMod
                              }