| Copyright | Copyright (C) 2005 John Goerzen |
|---|---|
| License | BSD-3-Clause |
| Maintainer | Philippe <philippedev101\@gmail.com> |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Magic.Data
Description
The MagicFlags bit-mask, mapping the C libmagic MAGIC_* constants to
Haskell. Flags are combined with (, tested with <>)hasFlag, and narrowed
with removeFlags; the empty set (mempty) is MagicNone.
Synopsis
- newtype MagicFlags = MagicFlags CInt
- hasFlag :: MagicFlags -> MagicFlags -> Bool
- removeFlags :: MagicFlags -> MagicFlags -> MagicFlags
- pattern MagicNone :: MagicFlags
- pattern MagicDebug :: MagicFlags
- pattern MagicSymlink :: MagicFlags
- pattern MagicCompress :: MagicFlags
- pattern MagicDevices :: MagicFlags
- pattern MagicMimeType :: MagicFlags
- pattern MagicMimeEncoding :: MagicFlags
- pattern MagicMime :: MagicFlags
- pattern MagicContinue :: MagicFlags
- pattern MagicCheck :: MagicFlags
- pattern MagicPreserveAtime :: MagicFlags
- pattern MagicRaw :: MagicFlags
- pattern MagicError :: MagicFlags
- pattern MagicApple :: MagicFlags
- pattern MagicExtension :: MagicFlags
- pattern MagicCompressTransp :: MagicFlags
- pattern MagicNoCompressFork :: MagicFlags
- pattern MagicNodesc :: MagicFlags
- pattern MagicNoCheckCompress :: MagicFlags
- pattern MagicNoCheckTar :: MagicFlags
- pattern MagicNoCheckSoft :: MagicFlags
- pattern MagicNoCheckApptype :: MagicFlags
- pattern MagicNoCheckElf :: MagicFlags
- pattern MagicNoCheckText :: MagicFlags
- pattern MagicNoCheckCdf :: MagicFlags
- pattern MagicNoCheckCsv :: MagicFlags
- pattern MagicNoCheckTokens :: MagicFlags
- pattern MagicNoCheckEncoding :: MagicFlags
- pattern MagicNoCheckJson :: MagicFlags
- pattern MagicNoCheckSimh :: MagicFlags
- pattern MagicNoCheckBuiltin :: MagicFlags
Documentation
newtype MagicFlags Source #
A set of libmagic flags, represented as the underlying C bit-mask.
Combine flags with (, start from <>)mempty (no flags), test
membership with hasFlag, and narrow with removeFlags. The
MagicFlags constructor is an escape hatch for passing a raw mask;
prefer the pattern synonyms below.
Since: 2.0.0
Constructors
| MagicFlags CInt |
Instances
| NFData MagicFlags Source # | |||||
Defined in Magic.Data Methods rnf :: MagicFlags -> () | |||||
| Monoid MagicFlags Source # |
| ||||
Defined in Magic.Data Methods mempty :: MagicFlags mappend :: MagicFlags -> MagicFlags -> MagicFlags mconcat :: [MagicFlags] -> MagicFlags | |||||
| Semigroup MagicFlags Source # | Flags combine by bitwise-or. | ||||
Defined in Magic.Data Methods (<>) :: MagicFlags -> MagicFlags -> MagicFlags sconcat :: NonEmpty MagicFlags -> MagicFlags stimes :: Integral b => b -> MagicFlags -> MagicFlags | |||||
| Generic MagicFlags Source # | |||||
Defined in Magic.Data Associated Types
| |||||
| Show MagicFlags Source # | Prints the set flags by name (e.g. | ||||
Defined in Magic.Data Methods showsPrec :: Int -> MagicFlags -> ShowS show :: MagicFlags -> String showList :: [MagicFlags] -> ShowS | |||||
| Eq MagicFlags Source # | |||||
Defined in Magic.Data | |||||
| Ord MagicFlags Source # | |||||
Defined in Magic.Data Methods compare :: MagicFlags -> MagicFlags -> Ordering (<) :: MagicFlags -> MagicFlags -> Bool (<=) :: MagicFlags -> MagicFlags -> Bool (>) :: MagicFlags -> MagicFlags -> Bool (>=) :: MagicFlags -> MagicFlags -> Bool max :: MagicFlags -> MagicFlags -> MagicFlags min :: MagicFlags -> MagicFlags -> MagicFlags | |||||
| type Rep MagicFlags Source # | |||||
Defined in Magic.Data type Rep MagicFlags = D1 ('MetaData "MagicFlags" "Magic.Data" "magic-2.0.0-A9TYcUdA1HUI3Y62VpQyfB" 'True) (C1 ('MetaCons "MagicFlags" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt))) | |||||
hasFlag :: MagicFlags -> MagicFlags -> Bool Source #
removeFlags :: MagicFlags -> MagicFlags -> MagicFlags Source #
clears every bit of removeFlags fs dropdrop from fs (set
difference), e.g. flags `removeFlags` .MagicError
Since: 2.0.0
pattern MagicNone :: MagicFlags Source #
No special handling; return a textual description (the default). This is mempty.
pattern MagicDebug :: MagicFlags Source #
Print debugging messages to stderr.
pattern MagicSymlink :: MagicFlags Source #
Follow symbolic links.
pattern MagicCompress :: MagicFlags Source #
Look inside compressed files.
pattern MagicDevices :: MagicFlags Source #
Look at the contents of block or character special devices.
pattern MagicMimeType :: MagicFlags Source #
Return a MIME type string instead of a textual description.
pattern MagicMimeEncoding :: MagicFlags Source #
Return the MIME encoding (character set) instead of a textual description.
pattern MagicMime :: MagicFlags Source #
Return both the MIME type and the encoding ().MagicMimeType <> MagicMimeEncoding
pattern MagicContinue :: MagicFlags Source #
Return all matches, not just the first.
pattern MagicCheck :: MagicFlags Source #
Check the magic database for consistency and report problems.
pattern MagicPreserveAtime :: MagicFlags Source #
Preserve the access time of examined files.
pattern MagicRaw :: MagicFlags Source #
Do not translate unprintable characters to octal escapes.
pattern MagicError :: MagicFlags Source #
Treat errors while examining a file as real errors instead of embedding them in the result.
pattern MagicApple :: MagicFlags Source #
Return the Apple creator and type.
pattern MagicExtension :: MagicFlags Source #
Return a slash-separated list of valid file extensions for the detected type.
pattern MagicCompressTransp :: MagicFlags Source #
Report on the compressed contents only, without mentioning the compression itself (transparent decompression).
pattern MagicNoCompressFork :: MagicFlags Source #
Do not allow decompression that requires forking a helper process.
pattern MagicNodesc :: MagicFlags Source #
Composite of MagicExtension, MagicMime and MagicApple: return identifiers rather than a textual description.
pattern MagicNoCheckCompress :: MagicFlags Source #
Do not look inside compressed files.
pattern MagicNoCheckTar :: MagicFlags Source #
Do not examine tar archives.
pattern MagicNoCheckSoft :: MagicFlags Source #
Do not consult the magic database entries (soft magic).
pattern MagicNoCheckApptype :: MagicFlags Source #
Do not check for an application type (e.g. EMX).
pattern MagicNoCheckElf :: MagicFlags Source #
Do not examine ELF details.
pattern MagicNoCheckText :: MagicFlags Source #
Do not examine text files.
pattern MagicNoCheckCdf :: MagicFlags Source #
Do not examine CDF (Microsoft Compound Document) files.
pattern MagicNoCheckCsv :: MagicFlags Source #
Do not examine CSV files.
pattern MagicNoCheckTokens :: MagicFlags Source #
Do not look for known text tokens.
pattern MagicNoCheckEncoding :: MagicFlags Source #
Do not check text encodings.
pattern MagicNoCheckJson :: MagicFlags Source #
Do not examine JSON files.
pattern MagicNoCheckSimh :: MagicFlags Source #
Do not examine SIMH tape files.
pattern MagicNoCheckBuiltin :: MagicFlags Source #
Disable all built-in tests; consult only the magic database.