From 98f10bc1f4ae86a65a97c4f8ada7a2c15583e1dd Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 26 Feb 2024 00:57:52 +0000 Subject: [PATCH] Corrected return type of getters in TDF structs --- src/Targets/TargetDescription/MemorySegment.hpp | 4 +--- src/Targets/TargetDescription/MemorySegmentSection.hpp | 4 +--- src/Targets/TargetDescription/PropertyGroup.hpp | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Targets/TargetDescription/MemorySegment.hpp b/src/Targets/TargetDescription/MemorySegment.hpp index 9a7fe838..d6081f4a 100644 --- a/src/Targets/TargetDescription/MemorySegment.hpp +++ b/src/Targets/TargetDescription/MemorySegment.hpp @@ -67,9 +67,7 @@ namespace Targets::TargetDescription : std::nullopt; } - std::optional> getSection( - std::string_view keyStr - ) const { + const MemorySegmentSection& getSection(std::string_view keyStr) const { const auto propertyGroup = this->tryGetSection(keyStr); if (!propertyGroup.has_value()) { throw Exceptions::InvalidTargetDescriptionDataException( diff --git a/src/Targets/TargetDescription/MemorySegmentSection.hpp b/src/Targets/TargetDescription/MemorySegmentSection.hpp index 150f61f6..cc5226c2 100644 --- a/src/Targets/TargetDescription/MemorySegmentSection.hpp +++ b/src/Targets/TargetDescription/MemorySegmentSection.hpp @@ -62,9 +62,7 @@ namespace Targets::TargetDescription return this->tryGetSubSection(Services::StringService::split(keyStr, '.')); } - std::optional> getSubSection( - std::string_view keyStr - ) const { + const MemorySegmentSection& getSubSection(std::string_view keyStr) const { const auto propertyGroup = this->tryGetSubSection(keyStr); if (!propertyGroup.has_value()) { throw Exceptions::InvalidTargetDescriptionDataException( diff --git a/src/Targets/TargetDescription/PropertyGroup.hpp b/src/Targets/TargetDescription/PropertyGroup.hpp index 38426879..cec2a27e 100644 --- a/src/Targets/TargetDescription/PropertyGroup.hpp +++ b/src/Targets/TargetDescription/PropertyGroup.hpp @@ -65,7 +65,7 @@ namespace Targets::TargetDescription return this->tryGetSubgroup(Services::StringService::split(keyStr, '.')); } - std::optional> getSubgroup(std::string_view keyStr) const { + const PropertyGroup& getSubgroup(std::string_view keyStr) const { const auto propertyGroup = this->tryGetSubgroup(keyStr); if (!propertyGroup.has_value()) { throw Exceptions::InvalidTargetDescriptionDataException(