diff --git a/src/Targets/TargetDescription/PropertyGroup.hpp b/src/Targets/TargetDescription/PropertyGroup.hpp index 8062c762..ec7b4213 100644 --- a/src/Targets/TargetDescription/PropertyGroup.hpp +++ b/src/Targets/TargetDescription/PropertyGroup.hpp @@ -27,25 +27,25 @@ namespace Targets::TargetDescription struct PropertyGroup { std::string key; - std::map> propertiesMappedByKey; - std::map> subgroupsMappedByKey; + std::map> propertiesByKey; + std::map> subgroupByKey; PropertyGroup( const std::string& key, - const std::map>& propertiesMappedByKey, - const std::map>& subgroupsMappedByKey + const std::map>& propertiesByKey, + const std::map>& subgroupByKey ) : key(key) - , propertiesMappedByKey(propertiesMappedByKey) - , subgroupsMappedByKey(subgroupsMappedByKey) + , propertiesByKey(propertiesByKey) + , subgroupByKey(subgroupByKey) {} template requires std::ranges::sized_range std::optional> tryGetSubgroup(KeysType keys) const { - auto firstSubgroupIt = this->subgroupsMappedByKey.find(*(keys.begin())); - if (firstSubgroupIt == this->subgroupsMappedByKey.end()) { + auto firstSubgroupIt = this->subgroupByKey.find(*(keys.begin())); + if (firstSubgroupIt == this->subgroupByKey.end()) { return std::nullopt; } @@ -78,9 +78,9 @@ namespace Targets::TargetDescription } std::optional> tryGetProperty(std::string_view key) const { - const auto propertyIt = this->propertiesMappedByKey.find(key); + const auto propertyIt = this->propertiesByKey.find(key); - if (propertyIt == this->propertiesMappedByKey.end()) { + if (propertyIt == this->propertiesByKey.end()) { return std::nullopt; } diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/TargetDescription/TargetDescriptionFile.cpp index 51fd6d50..2dc659dd 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.cpp @@ -53,10 +53,10 @@ namespace Targets::TargetDescription std::optional> TargetDescriptionFile::tryGetPropertyGroup( std::string_view keyStr ) const { - auto keys = StringService::split(keyStr, '.'); + const auto keys = StringService::split(keyStr, '.'); - const auto firstSubgroupIt = this->propertyGroupsMappedByKey.find(*keys.begin()); - return firstSubgroupIt != this->propertyGroupsMappedByKey.end() + const auto firstSubgroupIt = this->propertyGroupsByKey.find(*keys.begin()); + return firstSubgroupIt != this->propertyGroupsByKey.end() ? keys.size() > 1 ? firstSubgroupIt->second.tryGetSubgroup(keys | std::ranges::views::drop(1)) : std::optional(std::cref(firstSubgroupIt->second)) @@ -136,7 +136,7 @@ namespace Targets::TargetDescription element = element.nextSiblingElement("property-group") ) { auto propertyGroup = TargetDescriptionFile::propertyGroupFromXml(element); - this->propertyGroupsMappedByKey.insert( + this->propertyGroupsByKey.insert( std::pair(propertyGroup.key, std::move(propertyGroup)) ); } @@ -190,7 +190,7 @@ namespace Targets::TargetDescription element = element.nextSiblingElement("property") ) { auto property = TargetDescriptionFile::propertyFromXml(element); - output.propertiesMappedByKey.insert(std::pair(property.key, std::move(property))); + output.propertiesByKey.insert(std::pair(property.key, std::move(property))); } for ( @@ -199,7 +199,7 @@ namespace Targets::TargetDescription element = element.nextSiblingElement("property-group") ) { auto subgroup = TargetDescriptionFile::propertyGroupFromXml(element); - output.subgroupsMappedByKey.insert(std::pair(subgroup.key, std::move(subgroup))); + output.subgroupByKey.insert(std::pair(subgroup.key, std::move(subgroup))); } return output; diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.hpp b/src/Targets/TargetDescription/TargetDescriptionFile.hpp index 9c3136a9..d240902d 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.hpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.hpp @@ -9,9 +9,9 @@ #include #include +#include "PropertyGroup.hpp" #include "AddressSpace.hpp" #include "MemorySegment.hpp" -#include "PropertyGroup.hpp" #include "MemorySegmentSection.hpp" #include "RegisterGroup.hpp" #include "Module.hpp" @@ -102,7 +102,7 @@ namespace Targets::TargetDescription protected: std::map deviceAttributesByName; std::map> addressSpacesByKey; - std::map> propertyGroupsMappedByKey; + std::map> propertyGroupsByKey; std::map modulesMappedByName; std::map peripheralModulesMappedByName; std::map> peripheralRegisterGroupsMappedByModuleRegisterGroupName;