descriptor.hpp file

Toolkit for recognizing file types and selecting file readers.

Namespaces

namespace arcsdec
Main namespace for libarcsdec.
namespace arcsdec::v_1_0_0 inline
API version 1.0.0.

Classes

class arcsdec::v_1_0_0::Bytes
A sequence of bytes read from a specific offset in a file.
class arcsdec::v_1_0_0::ByteSeq
Byte sequence with or without wildcards.
class arcsdec::v_1_0_0::FileReader
Abstract base class for FileReaders.
class arcsdec::v_1_0_0::FileReaderDescriptor
Abstract base class for the properties of a FileReader.
class arcsdec::v_1_0_0::FileReadException
Reports an error while reading a file.
template<enum Format F>
class arcsdec::v_1_0_0::FormatMatcher
Matcher for file formats.
class arcsdec::v_1_0_0::InputFormatException
Reports an error concerning the input file format.
class arcsdec::v_1_0_0::Matcher
Interface for matchers.

Enums

enum class Codec: unsigned { UNKNOWN, PCM_S16BE, PCM_S16BE_PLANAR, PCM_S16LE, PCM_S16LE_PLANAR, PCM_S32BE, PCM_S32BE_PLANAR, PCM_S32LE, PCM_S32LE_PLANAR, FLAC, WAVPACK, MONKEY, ALAC, NONE }
A supported audio codec.
enum class Format: unsigned { UNKNOWN, CUE, CDRDAO, WAV, FLAC, APE, CAF, M4A, OGG, WV, AIFF }
List of supported file formats for metadata and audio.
enum class InputType: unsigned { AUDIO, TOC }
Input filetype.

Typedefs

using ByteSequence = ByteSeq
A sequence of bytes.
using LibInfo = std::list<LibInfoEntry>
Represents a list of pairs of a library name and an additional string.
using LibInfoEntry = std::pair<std::string, std::string>
Entry of a LibInfo.
using SuffixSet = std::set<details::ci_string>
A set of filename suffices.

Functions

auto ci_match_suffix(const SuffixSet& suffices, const std::string& filename) -> bool
Worker: default implementation for checking a filename.
auto get_suffix(const std::string& filename, const std::string& delimiter) -> std::string
Worker: Provides the suffix of a given filename.
auto libinfo_entry_filepath(const std::string& libname) -> LibInfoEntry
Create a LibInfoEntry for libname, lookup filepath of library.
auto name(Codec codec) -> std::string
Name of the codec.
auto name(Format format) -> std::string
Name of the format.
auto read_bytes(const std::string& filename, const uint32_t& offset, const uint32_t& length) -> Bytes
Worker: Read length bytes from file filename starting at position offset.

Function documentation

bool ci_match_suffix(const SuffixSet& suffices, const std::string& filename)

Worker: default implementation for checking a filename.

Returns TRUE if the filename suffix matches one of the internal suffices

Returns TRUE if the suffix of the filename equals one of the internal suffices. The check is done case-insensitive.

std::string get_suffix(const std::string& filename, const std::string& delimiter)

Worker: Provides the suffix of a given filename.

Parameters
filename in The filename to check
delimiter in The delimiter to separate the suffix from the base
Returns The relevant suffix or the entire filename

The suffix is the part of filename following the last occurrence of delimiter. If filename does not contain the delimiter, the entire filename is returned as suffix.

Bytes read_bytes(const std::string& filename, const uint32_t& offset, const uint32_t& length)

Worker: Read length bytes from file filename starting at position offset.

Parameters
filename in Name of the file to read from
offset in 0-based byte offset to start
length in Number of bytes to read
Returns Byte sequence read from file
Exceptions
FileReadException If the specified number of bytes could not be read from the specified file and position
InputFormatException On unspecified error