| Copyright | Copyright (C) 2004-2011 John Goerzen |
|---|---|
| License | BSD3 |
| Maintainer | John Goerzen <jgoerzen@complete.org> |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell98 |
System.IO.HVFS.InstanceHelpers
Description
Utilities for creating instances of the items defined in System.IO.HVFS.
Synopsis
- data SimpleStat = SimpleStat {
- isFile :: Bool
- fileSize :: FileOffset
- data MemoryVFS
- newMemoryVFS :: [MemoryNode] -> IO MemoryVFS
- newMemoryVFSRef :: IORef [MemoryNode] -> IO MemoryVFS
- type MemoryNode = (String, MemoryEntry)
- data MemoryEntry
- nice_slice :: String -> [String]
- getFullPath :: HVFS a => a -> String -> IO String
- getFullSlice :: HVFS a => a -> String -> IO [String]
HVFSStat objects
data SimpleStat #
A simple System.IO.HVFS.HVFSStat class that assumes that everything is either a file or a directory.
Constructors
| SimpleStat | |
Fields
| |
Instances
| Eq SimpleStat # | |
Defined in System.IO.HVFS.InstanceHelpers | |
| Show SimpleStat # | |
Defined in System.IO.HVFS.InstanceHelpers Methods showsPrec :: Int -> SimpleStat -> ShowS # show :: SimpleStat -> String # showList :: [SimpleStat] -> ShowS # | |
| HVFSStat SimpleStat # | |
Defined in System.IO.HVFS.InstanceHelpers Methods vDeviceID :: SimpleStat -> DeviceID # vFileID :: SimpleStat -> FileID # vFileMode :: SimpleStat -> FileMode # vLinkCount :: SimpleStat -> LinkCount # vFileOwner :: SimpleStat -> UserID # vFileGroup :: SimpleStat -> GroupID # vSpecialDeviceID :: SimpleStat -> DeviceID # vFileSize :: SimpleStat -> FileOffset # vAccessTime :: SimpleStat -> EpochTime # vModificationTime :: SimpleStat -> EpochTime # vStatusChangeTime :: SimpleStat -> EpochTime # vIsBlockDevice :: SimpleStat -> Bool # vIsCharacterDevice :: SimpleStat -> Bool # vIsNamedPipe :: SimpleStat -> Bool # vIsRegularFile :: SimpleStat -> Bool # vIsDirectory :: SimpleStat -> Bool # vIsSymbolicLink :: SimpleStat -> Bool # vIsSocket :: SimpleStat -> Bool # | |
HVFS objects & types
MemoryVFS
An in-memory read/write filesystem. Think of it as a dynamically resizable ramdisk written in Haskell.
Instances
newMemoryVFS :: [MemoryNode] -> IO MemoryVFS #
Create a new MemoryVFS object from an existing tree.
An empty filesystem may be created by using [] for the parameter.
newMemoryVFSRef :: IORef [MemoryNode] -> IO MemoryVFS #
Create a new MemoryVFS object using an IORef to an
existing tree.
type MemoryNode = (String, MemoryEntry) #
The basic node of a MemoryVFS. The String corresponds to the filename,
and the entry to the contents.
data MemoryEntry #
The content of a file or directory in a MemoryVFS.
Constructors
| MemoryDirectory [MemoryNode] | |
| MemoryFile String |
Instances
| Eq MemoryEntry # | |
Defined in System.IO.HVFS.InstanceHelpers | |
| Show MemoryEntry # | |
Defined in System.IO.HVFS.InstanceHelpers Methods showsPrec :: Int -> MemoryEntry -> ShowS # show :: MemoryEntry -> String # showList :: [MemoryEntry] -> ShowS # | |
Utilities
nice_slice :: String -> [String] #
Similar to NameManip but the first element
won't be /.
nice_slice "/" -> [] nice_slice "/foo/bar" -> ["foo", "bar"]
getFullSlice :: HVFS a => a -> String -> IO [String] #
Gets the full path via getFullPath, then splits it via nice_slice.