Tidied structure of all classes within the entire code base

Also some other small bits of tidying
This commit is contained in:
Nav
2021-10-06 21:12:31 +01:00
parent 1aef5bba79
commit 6edfb7376a
179 changed files with 3446 additions and 3493 deletions

View File

@@ -9,6 +9,10 @@
using namespace Bloom::Targets::TargetDescription;
using namespace Bloom::Exceptions;
std::string TargetDescriptionFile::getTargetName() const {
return this->deviceElement.attributes().namedItem("name").nodeValue().toStdString();
}
void TargetDescriptionFile::init(const QString& xmlFilePath) {
auto file = QFile(xmlFilePath);
if (!file.exists()) {
@@ -45,10 +49,6 @@ void TargetDescriptionFile::init(const QDomDocument& xml) {
this->loadInterfaces();
}
std::string TargetDescriptionFile::getTargetName() const {
return this->deviceElement.attributes().namedItem("name").nodeValue().toStdString();
}
AddressSpace TargetDescriptionFile::generateAddressSpaceFromXml(const QDomElement& xmlElement) {
if (
!xmlElement.hasAttribute("id")

View File

@@ -35,6 +35,80 @@ namespace Bloom::Targets::TargetDescription
*/
class TargetDescriptionFile
{
public:
TargetDescriptionFile() = default;
/**
* Will construct a TargetDescriptionFile instance from the XML of a target description file, the path to which
* is given via xmlFilePath.
*
* @param xmlFilePath
*/
explicit TargetDescriptionFile(const QString& xmlFilePath) {
this->init(xmlFilePath);
}
/**
* Will construct a TargetDescriptionFile instance from pre-loaded XML.
*
* @param xml
*/
explicit TargetDescriptionFile(const QDomDocument& xml) {
this->init(xml);
}
/**
* Extracts target name.
*
* @return
*/
[[nodiscard]] std::string getTargetName() const;
/**
* Returns a mapping of all property groups, with the property group name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, PropertyGroup>& getPropertyGroupsMappedByName() const {
return this->propertyGroupsMappedByName;
}
/**
* Returns a mapping of all modules, with the module name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, Module>& getModulesMappedByName() const {
return this->modulesMappedByName;
}
/**
* Returns a mapping of all peripheral modules, with the peripheral module name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, Module>& getPeripheralModulesMappedByName() const {
return this->peripheralModulesMappedByName;
}
/**
* Returns all variants found in the TDF.
*
* @return
*/
[[nodiscard]] const std::vector<Variant>& getVariants() const {
return this->variants;
}
/**
* Returns a mapping of pinouts, with the pinout name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, Pinout>& getPinoutsMappedByName() const {
return this->pinoutsMappedByName;
}
protected:
QDomDocument xml;
QDomElement deviceElement;
@@ -119,79 +193,5 @@ namespace Bloom::Targets::TargetDescription
* Extracts all interfaces and loads them into this->interfacesByName
*/
void loadInterfaces();
public:
TargetDescriptionFile() = default;
/**
* Will construct a TargetDescriptionFile instance from the XML of a target description file, the path to which
* is given via xmlFilePath.
*
* @param xmlFilePath
*/
explicit TargetDescriptionFile(const QString& xmlFilePath) {
this->init(xmlFilePath);
}
/**
* Will construct a TargetDescriptionFile instance from pre-loaded XML.
*
* @param xml
*/
explicit TargetDescriptionFile(const QDomDocument& xml) {
this->init(xml);
}
/**
* Extracts target name.
*
* @return
*/
[[nodiscard]] std::string getTargetName() const;
/**
* Returns a mapping of all property groups, with the property group name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, PropertyGroup>& getPropertyGroupsMappedByName() const {
return this->propertyGroupsMappedByName;
}
/**
* Returns a mapping of all modules, with the module name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, Module>& getModulesMappedByName() const {
return this->modulesMappedByName;
}
/**
* Returns a mapping of all peripheral modules, with the peripheral module name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, Module>& getPeripheralModulesMappedByName() const {
return this->peripheralModulesMappedByName;
}
/**
* Returns all variants found in the TDF.
*
* @return
*/
[[nodiscard]] const std::vector<Variant>& getVariants() const {
return this->variants;
}
/**
* Returns a mapping of pinouts, with the pinout name being the key.
*
* @return
*/
[[nodiscard]] const std::map<std::string, Pinout>& getPinoutsMappedByName() const {
return this->pinoutsMappedByName;
}
};
}