MCPcopy Create free account
hub / github.com/Kitware/CMake / GetLanguageFromExtension

Method GetLanguageFromExtension

Source/cmGlobalGenerator.cxx:1113–1133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111}
1112
1113cm::string_view cmGlobalGenerator::GetLanguageFromExtension(
1114 cm::string_view ext) const
1115{
1116 // if there is an extension and it starts with . then move past the
1117 // . because the extensions are not stored with a . in the map
1118 if (ext.empty()) {
1119 return "";
1120 }
1121 if (ext.front() == '.') {
1122 ext = ext.substr(1);
1123 }
1124#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
1125 auto const it = this->ExtensionToLanguage.find(ext);
1126#else
1127 auto const it = this->ExtensionToLanguage.find(std::string(ext));
1128#endif
1129 if (it != this->ExtensionToLanguage.end()) {
1130 return it->second;
1131 }
1132 return "";
1133}
1134
1135/* SetLanguageEnabled() is now split in two parts:
1136at first the enabled-flag is set. This can then be used in EnabledLanguage()

Callers 6

IgnoreFileMethod · 0.95
CheckLanguageMethod · 0.80
UpdateExtensionMethod · 0.80
TryCompileCodeMethod · 0.80

Calls 5

emptyMethod · 0.45
frontMethod · 0.45
substrMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected