Registry that provides convenient access to IFileReader service instances.
More...
#include <mitkFileReaderRegistry.h>
Registry that provides convenient access to IFileReader service instances.
FileReaderRegistry manages the life-cycle of IFileReader service objects obtained from the CppMicroServices registry. It provides methods to look up readers by mime-type and to resolve the best-matching mime-type for a given file path.
- Note
- The life-time of all mitk::IFileReader objects returned by an instance of this class ends with the destruction of that instance. Readers obtained via GetReader() or GetReaders() must not be used after the owning FileReaderRegistry is destroyed, or after UngetReader() / UngetReaders() has been called on them.
- See also
- IFileReader
-
FileReaderSelector
-
MimeType
Definition at line 50 of file mitkFileReaderRegistry.h.
◆ ReaderReference
◆ FileReaderRegistry()
| mitk::FileReaderRegistry::FileReaderRegistry |
( |
| ) |
|
◆ ~FileReaderRegistry()
| mitk::FileReaderRegistry::~FileReaderRegistry |
( |
| ) |
|
Destroy the registry, releasing all obtained reader service objects.
◆ GetMimeTypeForFile()
Get the highest-ranked mime-type for the given file path.
- Parameters
-
| [in] | path | The file path to match (must not be empty). |
| [in] | context | The module context for service look-up. Defaults to the current module context. |
- Returns
- The highest-ranked MimeType whose extensions match
path, or an invalid MimeType if none matched.
- Exceptions
-
◆ GetReader()
Get a reader instance for the given service reference.
- Parameters
-
| [in] | ref | The service reference to resolve. |
| [in] | context | The module context for service look-up. |
- Returns
- A pointer to the IFileReader instance. The reader is owned by this registry and must be released via UngetReader().
◆ GetReaders()
Get all reader instances for the given mime-type, sorted by ranking.
- Parameters
-
| [in] | mimeType | The mime-type to filter by. |
| [in] | context | The module context for service look-up. |
- Returns
- A vector of IFileReader pointers, sorted by descending service ranking. Each reader is owned by this registry and must be released via UngetReader() or UngetReaders().
◆ GetReferences()
Get service references for all readers supporting the given mime-type.
- Parameters
-
| [in] | mimeType | The mime-type to filter by. |
| [in] | context | The module context for service look-up. |
- Returns
- A vector of service references for matching IFileReader services.
◆ UngetReader()
◆ UngetReaders()
| void mitk::FileReaderRegistry::UngetReaders |
( |
const std::vector< mitk::IFileReader * > & |
readers | ) |
|
Release multiple readers previously obtained via GetReaders().
- Parameters
-
| [in] | readers | The readers to release. |
The documentation for this class was generated from the following file: