diff options
author | Brad King <brad.king@kitware.com> | 2020-05-19 13:49:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-05-19 13:54:39 (GMT) |
commit | e14894c4f71d3c46409843ade362e12d639df4a6 (patch) | |
tree | b8e6da602f7f30ebabd9950142208fbda4934e12 /Source/cmState.cxx | |
parent | 2fe2d47b33df7fb89877348a6990a6320414f7ed (diff) | |
parent | 6728f0fa858c1782e6c619661f32c016d84d1ad6 (diff) | |
download | CMake-e14894c4f71d3c46409843ade362e12d639df4a6.zip CMake-e14894c4f71d3c46409843ade362e12d639df4a6.tar.gz CMake-e14894c4f71d3c46409843ade362e12d639df4a6.tar.bz2 |
Merge topic 'simplify_cmPropertyDefinitionMap'
6728f0fa85 cmPropertyDefinitionMap: simplify and shorten
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4753
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index df013f4..18d8537 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -265,7 +265,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, cmStateSnapshot cmState::Reset() { this->GlobalProperties.Clear(); - this->PropertyDefinitions.clear(); + this->PropertyDefinitions = {}; this->GlobVerificationManager->Reset(); cmStateDetail::PositionType pos = this->SnapshotData.Truncate(); @@ -331,39 +331,23 @@ void cmState::DefineProperty(const std::string& name, const std::string& ShortDescription, const std::string& FullDescription, bool chained) { - this->PropertyDefinitions[scope].DefineProperty( - name, scope, ShortDescription, FullDescription, chained); + this->PropertyDefinitions.DefineProperty(name, scope, ShortDescription, + FullDescription, chained); } cmPropertyDefinition const* cmState::GetPropertyDefinition( const std::string& name, cmProperty::ScopeType scope) const { - if (this->IsPropertyDefined(name, scope)) { - cmPropertyDefinitionMap const& defs = - this->PropertyDefinitions.find(scope)->second; - return &defs.find(name)->second; - } - return nullptr; -} - -bool cmState::IsPropertyDefined(const std::string& name, - cmProperty::ScopeType scope) const -{ - auto it = this->PropertyDefinitions.find(scope); - if (it == this->PropertyDefinitions.end()) { - return false; - } - return it->second.IsPropertyDefined(name); + return this->PropertyDefinitions.GetPropertyDefinition(name, scope); } bool cmState::IsPropertyChained(const std::string& name, cmProperty::ScopeType scope) const { - auto it = this->PropertyDefinitions.find(scope); - if (it == this->PropertyDefinitions.end()) { - return false; + if (auto def = this->GetPropertyDefinition(name, scope)) { + return def->IsChained(); } - return it->second.IsPropertyChained(name); + return false; } void cmState::SetLanguageEnabled(std::string const& l) |