MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ create_reader()

std::unique_ptr< FileReader > MayaFlux::IO::FileReaderRegistry::create_reader ( const std::string &  filepath) const
inline

Create appropriate reader for a file based on extension.

Parameters
filepathPath to file.
Returns
Reader instance or nullptr if no suitable reader.

Definition at line 340 of file FileReader.hpp.

341 {
342 auto resolved = FileReader::resolve_path(filepath);
343
344 auto ext = std::filesystem::path(resolved).extension().string();
345 if (!ext.empty() && ext[0] == '.') {
346 ext = ext.substr(1);
347 }
348
349 auto it = m_factories.find(ext);
350 if (it != m_factories.end()) {
351 return it->second();
352 }
353 return nullptr;
354 }
std::unordered_map< std::string, FileReaderFactory > m_factories
static std::string resolve_path(const std::string &filepath)
Resolve a filepath against the project source root if not found as-is.

References m_factories, and MayaFlux::IO::FileReader::resolve_path().

+ Here is the call graph for this function: