packages feed

HsSVN-0.2: Subversion/FileSystem/DirEntry.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/DirEntry.hsc" #-}
{- -*- haskell -*- -}
{-# LINE 2 "Subversion/FileSystem/DirEntry.hsc" #-}

-- |This module only defines the 'DirEntry' type.


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

module Subversion.FileSystem.DirEntry
    ( DirEntry(..)
    )
    where

import           Foreign.C.String
import           Foreign.Storable
import           Subversion.Hash
import           Subversion.Types

-- |The type of a Subversion directory entry.
--
-- Note that @svn_fs_dirent_t.id@ is currently unavailable in this
-- binding. Add one if you really need it.
data DirEntry
    = DirEntry {
        entName :: String   -- ^ The name of this directory entry.
      , entKind :: NodeKind -- ^ The node kind.
      }
    deriving (Show, Eq)


instance HashValue DirEntry where
    marshal ent
        = fail "marshalling DirEntry is not supported"

    unmarshal finalizer entPtr
        = do namePtr <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) entPtr
{-# LINE 35 "Subversion/FileSystem/DirEntry.hsc" #-}
             name    <- peekCString namePtr
             kind    <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) entPtr
{-# LINE 37 "Subversion/FileSystem/DirEntry.hsc" #-}
             finalizer
             return DirEntry {
                              entName = name
                            , entKind = unmarshalNodeKind kind
                            }