MayaFlux 1.0.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 337 of file FileReader.hpp.

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