------------------------------------------------------------------------------------------------ Find a loader plugin for a given file extension
| 1004 | // ------------------------------------------------------------------------------------------------ |
| 1005 | // Find a loader plugin for a given file extension |
| 1006 | size_t Importer::GetImporterIndex (const char* szExtension) const { |
| 1007 | ai_assert(nullptr != pimpl); |
| 1008 | ai_assert(nullptr != szExtension); |
| 1009 | |
| 1010 | ASSIMP_BEGIN_EXCEPTION_REGION(); |
| 1011 | |
| 1012 | // skip over wild-card and dot characters at string head -- |
| 1013 | for ( ; *szExtension == '*' || *szExtension == '.'; ++szExtension ); |
| 1014 | |
| 1015 | std::string ext(szExtension); |
| 1016 | if (ext.empty()) { |
| 1017 | return static_cast<size_t>(-1); |
| 1018 | } |
| 1019 | ext = ai_tolower(ext); |
| 1020 | std::set<std::string> str; |
| 1021 | for (std::vector<BaseImporter*>::const_iterator i = pimpl->mImporter.begin();i != pimpl->mImporter.end();++i) { |
| 1022 | str.clear(); |
| 1023 | |
| 1024 | (*i)->GetExtensionList(str); |
| 1025 | for (std::set<std::string>::const_iterator it = str.begin(); it != str.end(); ++it) { |
| 1026 | if (ext == *it) { |
| 1027 | return std::distance(static_cast< std::vector<BaseImporter*>::const_iterator >(pimpl->mImporter.begin()), i); |
| 1028 | } |
| 1029 | } |
| 1030 | } |
| 1031 | ASSIMP_END_EXCEPTION_REGION(size_t); |
| 1032 | return static_cast<size_t>(-1); |
| 1033 | } |
| 1034 | |
| 1035 | // ------------------------------------------------------------------------------------------------ |
| 1036 | // Helper function to build a list of all file extensions supported by ASSIMP |
nothing calls this directly
no test coverage detected