From 4b6e21e43fb54e0b6c729b383a735dd9038df450 Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 12 Feb 2024 19:39:21 +0000 Subject: [PATCH] Typo correction --- .../Targets/TargetDescriptionFiles/Module.php | 6 ++-- .../TargetDescriptionFiles/PropertyGroup.php | 14 +++++----- .../TargetDescriptionFiles/RegisterGroup.php | 28 +++++++++---------- .../Services/ValidationService.php | 20 ++++++------- .../Services/Xml/FromXmlService.php | 4 +-- .../Services/Xml/ToXmlService.php | 4 +-- .../TargetDescriptionFile.php | 16 +++++------ build/scripts/Targets/TargetPeripheral.php | 6 ++-- build/scripts/Targets/TargetRegisterGroup.php | 22 +++++++-------- .../TargetDescription/PropertyGroup.hpp | 28 +++++++++---------- .../TargetDescriptionFile.cpp | 12 ++++---- 11 files changed, 80 insertions(+), 80 deletions(-) diff --git a/build/scripts/Targets/TargetDescriptionFiles/Module.php b/build/scripts/Targets/TargetDescriptionFiles/Module.php index 0303d2b9..a25e506a 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Module.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Module.php @@ -30,10 +30,10 @@ class Module $keys = explode('.', $keys); } - $firstLevelSubGroupId = array_shift($keys); + $firstLevelSubgroupKey = array_shift($keys); foreach ($this->registerGroups as $registerGroup) { - if ($registerGroup->key === $firstLevelSubGroupId) { - return !empty($keys) ? $registerGroup->getSubGroup($keys) : $registerGroup; + if ($registerGroup->key === $firstLevelSubgroupKey) { + return !empty($keys) ? $registerGroup->getSubgroup($keys) : $registerGroup; } } diff --git a/build/scripts/Targets/TargetDescriptionFiles/PropertyGroup.php b/build/scripts/Targets/TargetDescriptionFiles/PropertyGroup.php index 25dca433..827d40a5 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/PropertyGroup.php +++ b/build/scripts/Targets/TargetDescriptionFiles/PropertyGroup.php @@ -23,16 +23,16 @@ class PropertyGroup $this->properties = $properties; } - public function getSubGroup(array|string $subGroupKeys): ?PropertyGroup + public function getSubgroup(array|string $subgroupKeys): ?PropertyGroup { - if (is_string($subGroupKeys)) { - $subGroupKeys = explode('.', $subGroupKeys); + if (is_string($subgroupKeys)) { + $subgroupKeys = explode('.', $subgroupKeys); } - $firstLevelSubGroupKey = array_shift($subGroupKeys); - foreach ($this->subPropertyGroups as $subGroup) { - if ($subGroup->key === $firstLevelSubGroupKey) { - return !empty($subGroupKeys) ? $subGroup->getSubGroup($subGroupKeys) : $subGroup; + $firstLevelSubgroupKey = array_shift($subgroupKeys); + foreach ($this->subPropertyGroups as $subgroup) { + if ($subgroup->key === $firstLevelSubgroupKey) { + return !empty($subgroupKeys) ? $subgroup->getSubgroup($subgroupKeys) : $subgroup; } } diff --git a/build/scripts/Targets/TargetDescriptionFiles/RegisterGroup.php b/build/scripts/Targets/TargetDescriptionFiles/RegisterGroup.php index b92c4cce..df3b4c6b 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/RegisterGroup.php +++ b/build/scripts/Targets/TargetDescriptionFiles/RegisterGroup.php @@ -17,25 +17,25 @@ class RegisterGroup public array $registers = []; /** @var RegisterGroup[] */ - public array $subGroups = []; + public array $subgroups = []; /** @var RegisterGroupReference[] */ - public array $subGroupReferences = []; + public array $subgroupReferences = []; public function __construct( ?string $key, ?string $name, ?int $offset, array $registers, - array $subGroups, - array $subGroupReferences + array $subgroups, + array $subgroupReferences ) { $this->key = $key; $this->name = $name; $this->offset = $offset; $this->registers = $registers; - $this->subGroups = $subGroups; - $this->subGroupReferences = $subGroupReferences; + $this->subgroups = $subgroups; + $this->subgroupReferences = $subgroupReferences; } public function getRegister(array|string $keys): ?Register @@ -45,7 +45,7 @@ class RegisterGroup } $registerKey = array_pop($keys); - $group = !empty($keys) > 1 ? $this->getSubGroup($keys) : $this; + $group = !empty($keys) > 1 ? $this->getSubgroup($keys) : $this; if ($group instanceof RegisterGroup) { foreach ($group->registers as $register) { @@ -58,16 +58,16 @@ class RegisterGroup return null; } - public function getSubGroup(array|string $subGroupKeys): ?RegisterGroup + public function getSubgroup(array|string $subgroupKeys): ?RegisterGroup { - if (is_string($subGroupKeys)) { - $subGroupKeys = explode('.', $subGroupKeys); + if (is_string($subgroupKeys)) { + $subgroupKeys = explode('.', $subgroupKeys); } - $firstLevelSubGroupKey = array_shift($subGroupKeys); - foreach ($this->subGroups as $subGroup) { - if ($subGroup->key === $firstLevelSubGroupKey) { - return !empty($subGroupKeys) ? $subGroup->getSubGroup($subGroupKeys) : $subGroup; + $firstLevelSubgroupKey = array_shift($subgroupKeys); + foreach ($this->subgroups as $subgroup) { + if ($subgroup->key === $firstLevelSubgroupKey) { + return !empty($subgroupKeys) ? $subgroup->getSubgroup($subgroupKeys) : $subgroup; } } diff --git a/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php b/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php index 62094bdf..fd439f2a 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php @@ -460,30 +460,30 @@ class ValidationService $processedChildKeys[] = $register->key; } - foreach ($registerGroup->subGroups as $subGroup) { + foreach ($registerGroup->subgroups as $subgroup) { $failures = array_merge( $failures, - $this->validateRegisterGroup($subGroup, $moduleKey, $tdf) + $this->validateRegisterGroup($subgroup, $moduleKey, $tdf) ); - if ($subGroup->key !== null && in_array($subGroup->key, $processedChildKeys)) { - $failures[] = 'Duplicate register sub group key ("' . $subGroup->key . '") detected'; + if ($subgroup->key !== null && in_array($subgroup->key, $processedChildKeys)) { + $failures[] = 'Duplicate register sub group key ("' . $subgroup->key . '") detected'; } - $processedChildKeys[] = $subGroup->key; + $processedChildKeys[] = $subgroup->key; } - foreach ($registerGroup->subGroupReferences as $subGroupReference) { + foreach ($registerGroup->subgroupReferences as $subgroupReference) { $failures = array_merge( $failures, - $this->validateRegisterGroupReference($subGroupReference, $moduleKey, $tdf) + $this->validateRegisterGroupReference($subgroupReference, $moduleKey, $tdf) ); - if ($subGroupReference->key !== null && in_array($subGroupReference->key, $processedChildKeys)) { - $failures[] = 'Duplicate register group reference key ("' . $subGroupReference->key . '") detected'; + if ($subgroupReference->key !== null && in_array($subgroupReference->key, $processedChildKeys)) { + $failures[] = 'Duplicate register group reference key ("' . $subgroupReference->key . '") detected'; } - $processedChildKeys[] = $subGroupReference->key; + $processedChildKeys[] = $subgroupReference->key; } return array_map( diff --git a/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/FromXmlService.php b/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/FromXmlService.php index b2280e2d..c8c628a0 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/FromXmlService.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/FromXmlService.php @@ -241,12 +241,12 @@ class FromXmlService } if ($childNode->nodeName === 'register-group') { - $output->subGroups[] = $this->registerGroupFromElement($childNode); + $output->subgroups[] = $this->registerGroupFromElement($childNode); continue; } if ($childNode->nodeName === 'register-group-reference') { - $output->subGroupReferences[] = $this->registerGroupReferenceFromElement($childNode); + $output->subgroupReferences[] = $this->registerGroupReferenceFromElement($childNode); } } diff --git a/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/ToXmlService.php b/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/ToXmlService.php index ed0297b2..bc4d98c6 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/ToXmlService.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Services/Xml/ToXmlService.php @@ -208,8 +208,8 @@ class ToXmlService $children = array_merge( $registerGroup->registers, - $registerGroup->subGroups, - $registerGroup->subGroupReferences + $registerGroup->subgroups, + $registerGroup->subgroupReferences ); usort( diff --git a/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php b/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php index afe57d06..e5fc38c0 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php +++ b/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php @@ -89,7 +89,7 @@ class TargetDescriptionFile $firstLevelGroupKey = array_shift($keys); foreach ($this->propertyGroups as $propertyGroup) { if ($propertyGroup->key === $firstLevelGroupKey) { - return !empty($keys) ? $propertyGroup->getSubGroup($keys) : $propertyGroup; + return !empty($keys) ? $propertyGroup->getSubgroup($keys) : $propertyGroup; } } @@ -280,16 +280,16 @@ class TargetDescriptionFile $addressOffset += $registerGroup->offset ?? 0; $output = new TargetRegisterGroup($registerGroup->key, $registerGroup->name, $addressOffset, [], []); - foreach ($registerGroup->subGroups as $subGroup) { - $output->subGroups[] = $this->targetRegisterGroupFromRegisterGroup($subGroup, $addressOffset, $moduleKey); + foreach ($registerGroup->subgroups as $subgroup) { + $output->subgroups[] = $this->targetRegisterGroupFromRegisterGroup($subgroup, $addressOffset, $moduleKey); } - foreach ($registerGroup->subGroupReferences as $subGroupReference) { - $subGroup = $this->resolveRegisterGroupReference($subGroupReference, $moduleKey); + foreach ($registerGroup->subgroupReferences as $subgroupReference) { + $subgroup = $this->resolveRegisterGroupReference($subgroupReference, $moduleKey); - if ($subGroup instanceof RegisterGroup) { - $output->subGroups[] = $this->targetRegisterGroupFromRegisterGroup( - $subGroup, + if ($subgroup instanceof RegisterGroup) { + $output->subgroups[] = $this->targetRegisterGroupFromRegisterGroup( + $subgroup, $addressOffset, $moduleKey ); diff --git a/build/scripts/Targets/TargetPeripheral.php b/build/scripts/Targets/TargetPeripheral.php index 547a17ae..07a8cb2d 100644 --- a/build/scripts/Targets/TargetPeripheral.php +++ b/build/scripts/Targets/TargetPeripheral.php @@ -36,11 +36,11 @@ class TargetPeripheral $keys = explode('.', $keys); } - $firstLevelSubGroupId = array_shift($keys); + $firstLevelSubgroupId = array_shift($keys); foreach ($this->registerGroups as $registerGroup) { - if ($registerGroup->key === $firstLevelSubGroupId) { - return !empty($keys) ? $registerGroup->getSubGroup($keys) : $registerGroup; + if ($registerGroup->key === $firstLevelSubgroupId) { + return !empty($keys) ? $registerGroup->getSubgroup($keys) : $registerGroup; } } diff --git a/build/scripts/Targets/TargetRegisterGroup.php b/build/scripts/Targets/TargetRegisterGroup.php index 10bbb7cd..0c7fbbd3 100644 --- a/build/scripts/Targets/TargetRegisterGroup.php +++ b/build/scripts/Targets/TargetRegisterGroup.php @@ -23,17 +23,17 @@ class TargetRegisterGroup public ?int $baseAddress = null; /** @var TargetRegisterGroup[] */ - public array $subGroups = []; + public array $subgroups = []; /** @var TargetRegister[] */ public array $registers = []; - public function __construct(?string $key, ?string $name, ?int $baseAddress, array $subGroups, array $registers) + public function __construct(?string $key, ?string $name, ?int $baseAddress, array $subgroups, array $registers) { $this->key = $key; $this->name = $name; $this->baseAddress = $baseAddress; - $this->subGroups = $subGroups; + $this->subgroups = $subgroups; $this->registers = $registers; } @@ -44,7 +44,7 @@ class TargetRegisterGroup } $registerKey = array_pop($keys); - $group = !empty($keys) > 1 ? $this->getSubGroup($keys) : $this; + $group = !empty($keys) > 1 ? $this->getSubgroup($keys) : $this; if ($group instanceof TargetRegisterGroup) { foreach ($group->registers as $register) { @@ -57,16 +57,16 @@ class TargetRegisterGroup return null; } - public function getSubGroup(array|string $subGroupKeys): ?TargetRegisterGroup + public function getSubgroup(array|string $subgroupKeys): ?TargetRegisterGroup { - if (is_string($subGroupKeys)) { - $subGroupKeys = explode('.', $subGroupKeys); + if (is_string($subgroupKeys)) { + $subgroupKeys = explode('.', $subgroupKeys); } - $firstLevelSubGroupKey = array_shift($subGroupKeys); - foreach ($this->subGroups as $subGroup) { - if ($subGroup->key === $firstLevelSubGroupKey) { - return !empty($subGroupKeys) ? $subGroup->getSubGroup($subGroupKeys) : $subGroup; + $firstLevelSubgroupKey = array_shift($subgroupKeys); + foreach ($this->subgroups as $subgroup) { + if ($subgroup->key === $firstLevelSubgroupKey) { + return !empty($subgroupKeys) ? $subgroup->getSubgroup($subgroupKeys) : $subgroup; } } diff --git a/src/Targets/TargetDescription/PropertyGroup.hpp b/src/Targets/TargetDescription/PropertyGroup.hpp index dee3a1cf..8062c762 100644 --- a/src/Targets/TargetDescription/PropertyGroup.hpp +++ b/src/Targets/TargetDescription/PropertyGroup.hpp @@ -28,45 +28,45 @@ namespace Targets::TargetDescription { std::string key; std::map> propertiesMappedByKey; - std::map> subGroupsMappedByKey; + std::map> subgroupsMappedByKey; PropertyGroup( const std::string& key, const std::map>& propertiesMappedByKey, - const std::map>& subGroupsMappedByKey + const std::map>& subgroupsMappedByKey ) : key(key) , propertiesMappedByKey(propertiesMappedByKey) - , subGroupsMappedByKey(subGroupsMappedByKey) + , subgroupsMappedByKey(subgroupsMappedByKey) {} template requires std::ranges::sized_range - std::optional> tryGetSubGroup(KeysType keys) const { - auto firstSubGroupIt = this->subGroupsMappedByKey.find(*(keys.begin())); - if (firstSubGroupIt == this->subGroupsMappedByKey.end()) { + std::optional> tryGetSubgroup(KeysType keys) const { + auto firstSubgroupIt = this->subgroupsMappedByKey.find(*(keys.begin())); + if (firstSubgroupIt == this->subgroupsMappedByKey.end()) { return std::nullopt; } - auto subGroup = std::optional(std::cref(firstSubGroupIt->second)); + auto subgroup = std::optional(std::cref(firstSubgroupIt->second)); for (const auto key : keys | std::ranges::views::drop(1)) { - subGroup = subGroup->get().tryGetSubGroup(key); + subgroup = subgroup->get().tryGetSubgroup(key); - if (!subGroup.has_value()) { + if (!subgroup.has_value()) { break; } } - return subGroup; + return subgroup; } - std::optional> tryGetSubGroup(std::string_view keyStr) const { - return this->tryGetSubGroup(Services::StringService::split(keyStr, '.')); + std::optional> tryGetSubgroup(std::string_view keyStr) const { + return this->tryGetSubgroup(Services::StringService::split(keyStr, '.')); } - std::optional> getSubGroup(std::string_view keyStr) const { - const auto propertyGroup = this->tryGetSubGroup(keyStr); + std::optional> getSubgroup(std::string_view keyStr) const { + const auto propertyGroup = this->tryGetSubgroup(keyStr); if (!propertyGroup.has_value()) { throw Exceptions::Exception( "Failed to get subgroup \"" + std::string(keyStr) diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/TargetDescription/TargetDescriptionFile.cpp index 26db2ec9..16e063c0 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.cpp @@ -50,11 +50,11 @@ namespace Targets::TargetDescription ) const { auto keys = StringService::split(keyStr, '.'); - const auto firstSubGroupIt = this->propertyGroupsMappedByKey.find(*keys.begin()); - return firstSubGroupIt != this->propertyGroupsMappedByKey.end() + const auto firstSubgroupIt = this->propertyGroupsMappedByKey.find(*keys.begin()); + return firstSubgroupIt != this->propertyGroupsMappedByKey.end() ? keys.size() > 1 - ? firstSubGroupIt->second.tryGetSubGroup(keys | std::ranges::views::drop(1)) - : std::optional(std::cref(firstSubGroupIt->second)) + ? firstSubgroupIt->second.tryGetSubgroup(keys | std::ranges::views::drop(1)) + : std::optional(std::cref(firstSubgroupIt->second)) : std::nullopt; } @@ -162,8 +162,8 @@ namespace Targets::TargetDescription !element.isNull(); element = element.nextSiblingElement("property-group") ) { - auto subGroup = TargetDescriptionFile::propertyGroupFromXml(element); - output.subGroupsMappedByKey.insert(std::pair(subGroup.key, std::move(subGroup))); + auto subgroup = TargetDescriptionFile::propertyGroupFromXml(element); + output.subgroupsMappedByKey.insert(std::pair(subgroup.key, std::move(subgroup))); } return output;