Tidying
This commit is contained in:
@@ -255,6 +255,16 @@ namespace Targets::TargetDescription
|
||||
this->loadPinouts(document);
|
||||
}
|
||||
|
||||
const std::string& TargetDescriptionFile::deviceAttribute(const std::string& attributeName) const {
|
||||
const auto attributeIt = this->deviceAttributesByName.find(attributeName);
|
||||
|
||||
if (attributeIt == this->deviceAttributesByName.end()) {
|
||||
throw Exception("Missing target device attribute (\"" + attributeName + "\")");
|
||||
}
|
||||
|
||||
return attributeIt->second;
|
||||
}
|
||||
|
||||
std::optional<std::string> TargetDescriptionFile::tryGetAttribute(
|
||||
const QDomElement& element,
|
||||
const QString& attributeName
|
||||
@@ -594,16 +604,6 @@ namespace Targets::TargetDescription
|
||||
);
|
||||
}
|
||||
|
||||
const std::string& TargetDescriptionFile::deviceAttribute(const std::string& attributeName) const {
|
||||
const auto attributeIt = this->deviceAttributesByName.find(attributeName);
|
||||
|
||||
if (attributeIt == this->deviceAttributesByName.end()) {
|
||||
throw Exception("Missing target device attribute (\"" + attributeName + "\")");
|
||||
}
|
||||
|
||||
return attributeIt->second;
|
||||
}
|
||||
|
||||
void TargetDescriptionFile::loadVariants(const QDomDocument& document) {
|
||||
const auto deviceElement = document.elementsByTagName("device").item(0).toElement();
|
||||
|
||||
|
||||
@@ -140,6 +140,8 @@ namespace Targets::TargetDescription
|
||||
void init(const std::string& xmlFilePath);
|
||||
void init(const QDomDocument& document);
|
||||
|
||||
const std::string& deviceAttribute(const std::string& attributeName) const;
|
||||
|
||||
static std::optional<std::string> tryGetAttribute(const QDomElement& element, const QString& attributeName);
|
||||
static std::string getAttribute(const QDomElement& element, const QString& attributeName);
|
||||
|
||||
@@ -158,14 +160,6 @@ namespace Targets::TargetDescription
|
||||
static RegisterGroupInstance registerGroupInstanceFromXml(const QDomElement& xmlElement);
|
||||
static Signal signalFromXml(const QDomElement& xmlElement);
|
||||
|
||||
/**
|
||||
* Fetches a device attribute value by name. Throws an exception if the attribute is not found.
|
||||
*
|
||||
* @param attributeName
|
||||
* @return
|
||||
*/
|
||||
const std::string& deviceAttribute(const std::string& attributeName) const;
|
||||
|
||||
/**
|
||||
* Extracts all variants and loads them into this->variants.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user