This commit is contained in:
Nav
2024-02-26 19:29:53 +00:00
parent 041c61e3fd
commit 11c0106fd6
3 changed files with 10 additions and 74 deletions

View File

@@ -91,7 +91,7 @@ namespace Services
std::vector<std::string_view> StringService::split(std::string_view str, char delimiter) { std::vector<std::string_view> StringService::split(std::string_view str, char delimiter) {
auto range = str | auto range = str |
std::ranges::views::split(delimiter) | std::ranges::views::split(delimiter) |
std::ranges::views::transform([](auto&& subRange) -> std::string_view { std::ranges::views::transform([] (auto&& subRange) -> std::string_view {
return std::string_view( return std::string_view(
subRange.begin(), subRange.begin(),
static_cast<std::size_t>(std::ranges::distance(subRange)) static_cast<std::size_t>(std::ranges::distance(subRange))

View File

@@ -37,18 +37,17 @@ namespace Targets::TargetDescription
} }
TargetFamily TargetDescriptionFile::getFamily() const { TargetFamily TargetDescriptionFile::getFamily() const {
static const auto familiesByName = std::map<std::string, TargetFamily> { const auto& family = this->deviceAttribute("family");
{"AVR8", TargetFamily::AVR_8},
{"RISCV", TargetFamily::RISC_V},
};
const auto familyIt = familiesByName.find(this->deviceAttribute("family")); if (family == "AVR8") {
return TargetFamily::AVR_8;
if (familyIt == familiesByName.end()) {
throw InvalidTargetDescriptionDataException("Failed to resolve target family - invalid family name");
} }
return familyIt->second; if (family == "RISCV") {
return TargetFamily::RISC_V;
}
throw InvalidTargetDescriptionDataException("Failed to resolve target family - invalid family name");
} }
std::optional<std::reference_wrapper<const PropertyGroup>> TargetDescriptionFile::tryGetPropertyGroup( std::optional<std::reference_wrapper<const PropertyGroup>> TargetDescriptionFile::tryGetPropertyGroup(
@@ -278,7 +277,7 @@ namespace Targets::TargetDescription
); );
} }
AddressSpace TargetDescriptionFile::addressSpaceFromXml(const QDomElement &xmlElement) { AddressSpace TargetDescriptionFile::addressSpaceFromXml(const QDomElement& xmlElement) {
static const auto endiannessByName = BiMap<std::string, TargetMemoryEndianness>({ static const auto endiannessByName = BiMap<std::string, TargetMemoryEndianness>({
{"big", TargetMemoryEndianness::BIG}, {"big", TargetMemoryEndianness::BIG},
{"little", TargetMemoryEndianness::LITTLE}, {"little", TargetMemoryEndianness::LITTLE},

View File

@@ -135,77 +135,14 @@ namespace Targets::TargetDescription
static PropertyGroup propertyGroupFromXml(const QDomElement& xmlElement); static PropertyGroup propertyGroupFromXml(const QDomElement& xmlElement);
static Property propertyFromXml(const QDomElement& xmlElement); static Property propertyFromXml(const QDomElement& xmlElement);
/**
* Constructs an AddressSpace object from an XML element.
*
* @param xmlElement
* @return
*/
static AddressSpace addressSpaceFromXml(const QDomElement& xmlElement); static AddressSpace addressSpaceFromXml(const QDomElement& xmlElement);
/**
* Constructs a MemorySegment object from an XML element.
*
* @param xmlElement
* @return
*/
static MemorySegment memorySegmentFromXml(const QDomElement& xmlElement); static MemorySegment memorySegmentFromXml(const QDomElement& xmlElement);
/**
* Constructs a MemorySegmentSection from an XML element.
*
* @param xmlElement
* @return
*/
static MemorySegmentSection memorySegmentSectionFromXml(const QDomElement& xmlElement); static MemorySegmentSection memorySegmentSectionFromXml(const QDomElement& xmlElement);
/**
* Constructs a PhysicalInterface from al XML element.
*
* @param xmlElement
* @return
*/
static PhysicalInterface physicalInterfaceFromXml(const QDomElement& xmlElement); static PhysicalInterface physicalInterfaceFromXml(const QDomElement& xmlElement);
/**
* Constructs a Module object from an XML element.
*
* @param xmlElement
* @return
*/
static Module moduleFromXml(const QDomElement& xmlElement); static Module moduleFromXml(const QDomElement& xmlElement);
/**
* Constructs a RegisterGroup object from an XML element.
*
* @param xmlElement
* @return
*/
static RegisterGroup registerGroupFromXml(const QDomElement& xmlElement); static RegisterGroup registerGroupFromXml(const QDomElement& xmlElement);
/**
* Constructs a RegisterGroupReference object from an XML element.
*
* @param xmlElement
* @return
*/
static RegisterGroupReference registerGroupReferenceFromXml(const QDomElement& xmlElement); static RegisterGroupReference registerGroupReferenceFromXml(const QDomElement& xmlElement);
/**
* Constructs a Register object from an XML element.
*
* @param xmlElement
* @return
*/
static Register registerFromXml(const QDomElement& xmlElement); static Register registerFromXml(const QDomElement& xmlElement);
/**
* Constructs a BitField object from an XML element.
*
* @param xmlElement
* @return
*/
static BitField bitFieldFromXml(const QDomElement& xmlElement); static BitField bitFieldFromXml(const QDomElement& xmlElement);
/** /**