MayaFlux 0.5.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 339 of file FileReader.hpp.

340 {
341 auto resolved = FileReader::resolve_path(filepath);
342
343 auto ext = std::filesystem::path(resolved).extension().string();
344 if (!ext.empty() && ext[0] == '.') {
345 ext = ext.substr(1);
346 }
347
348 auto it = m_factories.find(ext);
349 if (it != m_factories.end()) {
350 return it->second();
351 }
352 return nullptr;
353 }
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: