selection.hpp file
Select file readers by format and codec.
Namespaces
- namespace arcsdec
- APIs of libarcsdec.
- namespace arcsdec::v_1_0_0 inline
- libarcsdec API version 1.0.0.
Classes
-
template<class ReaderType>struct arcsdec::v_1_0_0::details::CreateReader
- Functor to safely create a unique_ptr to a downcasted FileReader.
- class arcsdec::DefaultPreference
- Preference for the most specific descriptor.
- class arcsdec::DefaultSelector
- Selector for highest preference.
- class arcsdec::DescriptorPreference
- Interface for a descriptor preference.
-
template<typename P, typename S>class arcsdec::FileReaderPreferenceSelection
- FileReaderSelection of FileReaderDescriptors.
- class arcsdec::FileReaderRegistry
- Hold all available FileReaderDescriptors and all supported Formats.
- class arcsdec::FileReaderSelection
- Interface to select a FileReaderDescriptor by Format and Codec.
- class arcsdec::FileReaderSelector
- Interface for a selector on a set of FileReaderDescriptor instances.
- class arcsdec::FormatPreference
- Preference for the most specific descriptor accepting the Format.
- class arcsdec::IdSelector
- FileReaderSelector for a specific descriptor id.
- class arcsdec::MinPreference
- DescriptorPreference equivalent to MIN_PREFERENCE.
-
template<class D>struct arcsdec::RegisterDescriptor
- Register a FileReaderDescriptor type.
-
template<enum Format F>struct arcsdec::RegisterFormat
- Register a Format.
Functions
-
template<class ReaderType>auto cast_reader(std::unique_ptr<FileReader> file_reader) -> std::pair<std::unique_ptr<ReaderType>, std::unique_ptr<FileReader>> noexcept
- Downcast a FileReader to a specialized ReaderType.
-
template<class T, typename... Args>auto make_descriptor(Args && ... args) -> std::unique_ptr<FileReaderDescriptor>
- Instantiate FileReaderDescriptor.
- auto select_descriptor(const std::string& filename, const FileReaderSelection& selection, const FormatList& formats, const FileReaders& readers) -> std::unique_ptr<FileReaderDescriptor>
- Select a FileReaderDescriptor.
- auto select_reader(const std::string& filename, const FileReaderSelection& selection, const FormatList& formats, const FileReaders& readers) -> std::unique_ptr<FileReader>
- Select a FileReader.
Function documentation
template<class ReaderType>
std::pair<std::unique_ptr<ReaderType>, std::unique_ptr<FileReader>> cast_reader(std::unique_ptr<FileReader> file_reader) noexcept
Downcast a FileReader to a specialized ReaderType.
| Template parameters | |
|---|---|
| ReaderType | Concrete FileReader type to cast to |
| Parameters | |
| file_reader in | The pointer to cast |
| Returns | Pair of casting result and the original input pointer. |
The first element of the returned pair is a pointer to the requested input object with the requested cast performed. If the cast fails, the first element is a nullptr. The unaltered input pointer is returned as a second element in any case.
template<class T, typename... Args>
std::unique_ptr<FileReaderDescriptor> make_descriptor(Args && ... args)
Instantiate FileReaderDescriptor.
| Template parameters | |
|---|---|
| T | The type to instantiate |
| Args | The constructor arguments |
| Parameters | |
| args in | Input arguments |
| Returns | FileReaderDescriptor |
std::unique_ptr<FileReaderDescriptor> select_descriptor(const std::string& filename, const FileReaderSelection& selection, const FormatList& formats, const FileReaders& readers)
Select a FileReaderDescriptor.
| Parameters | |
|---|---|
| filename in | Name of the file to read |
| selection in | FileReaderSelection to select from |
| formats in | Set of file formats to check filename for |
| readers in | Set of available file readers |
| Returns | Descriptor that accepts the input file. |
Select a reader that is guaranteed to accept the current input file or return a nullptr.
std::unique_ptr<FileReader> select_reader(const std::string& filename, const FileReaderSelection& selection, const FormatList& formats, const FileReaders& readers)
Select a FileReader.
| Parameters | |
|---|---|
| filename in | Name of the file to read |
| selection in | FileReaderSelection to select from |
| formats in | Set of file formats to check filename for |
| readers in | Set of available file readers |
| Returns | FileReader that accepts the input file. |
Select a reader that is guaranteed to accept the current input file or return a null pointer.