MayaFlux 0.1.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 311 of file FileReader.hpp.

312 {
313 auto ext = std::filesystem::path(filepath).extension().string();
314 if (!ext.empty() && ext[0] == '.') {
315 ext = ext.substr(1);
316 }
317
318 auto it = m_factories.find(ext);
319 if (it != m_factories.end()) {
320 return it->second();
321 }
322 return nullptr;
323 }
std::unordered_map< std::string, FileReaderFactory > m_factories

References m_factories.