23{
24
25
26
27
28
29
30
31 std::string ext = boost::filesystem::path(fname).extension().string();
32 boost::algorithm::to_lower(ext);
33
34 std::unique_ptr<SLAArchiveReader> ret;
35
37
38 auto arch_from = registry.begin();
39 auto arch_to = registry.end();
40
41 auto arch_it = registry.find(ArchiveEntry{format_id.c_str()});
42 if (arch_it != registry.end()) {
43 arch_from = arch_it;
44 arch_to = arch_it;
45 }
46
47 if (!ext.empty()) {
48 if (ext.front() == '.')
49 ext.erase(ext.begin());
50
51 for (auto it = arch_from; !ret && it != arch_to; ++it) {
52 const auto &entry = *it;
53 if (entry.rdfactoryfn) {
55 for (const std::string& supportedext : extensions) {
56 if (ext == supportedext) {
57 ret = entry.rdfactoryfn(fname, quality, progr);
58 break;
59 }
60 }
61 }
62 }
63 }
64
65 return ret;
66}
const std::set< ArchiveEntry > & registered_sla_archives()
Definition SLAArchiveFormatRegistry.cpp:95
std::vector< std::string > get_extensions(const ArchiveEntry &entry)
Definition SLAArchiveFormatRegistry.cpp:100