summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmStandardLevelResolver.cxx23
-rw-r--r--Source/cmStandardLevelResolver.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 4a149e0..e814690 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -457,6 +457,19 @@ struct StandardLevelComputer
return maxLevel;
}
+ cm::optional<cmStandardLevel> LanguageStandardLevel(
+ std::string const& standardStr) const
+ {
+ cm::optional<cmStandardLevel> langLevel;
+ auto const& stds = this->Levels;
+ auto stdIt =
+ std::find(cm::cbegin(stds), cm::cend(stds), ParseStd(standardStr));
+ if (stdIt != cm::cend(stds)) {
+ langLevel = cmStandardLevel(std::distance(cm::cbegin(stds), stdIt));
+ }
+ return langLevel;
+ }
+
bool IsLaterStandard(int lhs, int rhs) const
{
auto rhsIt =
@@ -661,6 +674,16 @@ cmStandardLevelResolver::CompileFeatureStandardLevel(
return mapping->second.CompileFeatureStandardLevel(this->Makefile, feature);
}
+cm::optional<cmStandardLevel> cmStandardLevelResolver::LanguageStandardLevel(
+ std::string const& lang, std::string const& standardStr) const
+{
+ auto mapping = StandardComputerMapping.find(lang);
+ if (mapping == cm::cend(StandardComputerMapping)) {
+ return cm::nullopt;
+ }
+ return mapping->second.LanguageStandardLevel(standardStr);
+}
+
cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
const std::string& lang, std::string* error) const
{
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 09989ba..29cab55 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -39,6 +39,9 @@ public:
cm::optional<cmStandardLevel> CompileFeatureStandardLevel(
std::string const& lang, std::string const& feature) const;
+ cm::optional<cmStandardLevel> LanguageStandardLevel(
+ std::string const& lang, std::string const& standardStr) const;
+
cmValue CompileFeaturesAvailable(const std::string& lang,
std::string* error) const;