Skip to content

Commit

Permalink
Merge branch 'std-update' of https://github.com/kactus2/kactus2dev in…
Browse files Browse the repository at this point in the history
…to std-update
  • Loading branch information
hagantsa committed Nov 23, 2023
2 parents e008374 + 7ed95c8 commit 76e03e4
Show file tree
Hide file tree
Showing 40 changed files with 1,324 additions and 435 deletions.
31 changes: 4 additions & 27 deletions IPXACTmodels/Component/ComponentReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ ComponentReader::ComponentReader(): DocumentReader()

}

//-----------------------------------------------------------------------------
// Function: ComponentReader::~DocumentReader()
//-----------------------------------------------------------------------------
ComponentReader::~ComponentReader()
{

}

//-----------------------------------------------------------------------------
// Function: ComponentReader::createComponentFrom()
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -460,8 +452,7 @@ void ComponentReader::parseComponentGenerators(QDomNode const& componentNode,
//-----------------------------------------------------------------------------
void ComponentReader::parseChoices(QDomNode const& componentNode, QSharedPointer<Component> newComponent) const
{
auto parsedChoices = CommonItemsReader::parseChoices(componentNode);
newComponent->setChoices(parsedChoices);
newComponent->setChoices(CommonItemsReader::parseChoices(componentNode));
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -836,24 +827,10 @@ void ComponentReader::parseFileDependencies(QDomNode const& fileNode, QSharedPoi
QString file2 = dependencyElement.firstChildElement(QStringLiteral("kactus2:fileRef2")).firstChild().nodeValue();
QString description = dependencyElement.firstChildElement(QStringLiteral("ipxact:description")).firstChild().nodeValue();

bool locked = false;
if (dependencyElement.attribute(QStringLiteral("locked")) == QLatin1String("true"))
{
locked = true;
}

bool biDirectional = false;
if (dependencyElement.attribute(QStringLiteral("bidirectional")) == QLatin1String("true"))
{
biDirectional = true;
}
bool locked = dependencyElement.attribute(QStringLiteral("locked")) == QLatin1String("true");
bool biDirectional = dependencyElement.attribute(QStringLiteral("bidirectional")) == QLatin1String("true");
bool manual = dependencyElement.attribute(QStringLiteral("manual")) == QLatin1String("true");

bool manual = false;
if (dependencyElement.attribute(QStringLiteral("manual")) == QLatin1String("true"))
{
manual = true;
}

QSharedPointer<FileDependency> newDependency (new FileDependency());
newDependency->setFile1(file1);
newDependency->setFile2(file2);
Expand Down
2 changes: 1 addition & 1 deletion IPXACTmodels/Component/ComponentReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IPXACTMODELS_EXPORT ComponentReader : public DocumentReader
/*!
* The destructor.
*/
~ComponentReader();
~ComponentReader() = default;

/*!
* Creates a new component from a given component document.
Expand Down
16 changes: 4 additions & 12 deletions IPXACTmodels/Component/ComponentWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ ComponentWriter::ComponentWriter() : DocumentWriter()

}

//-----------------------------------------------------------------------------
// Function: ComponentWriter::~ComponentWriter()
//-----------------------------------------------------------------------------
ComponentWriter::~ComponentWriter()
{

}

//-----------------------------------------------------------------------------
// Function: ComponentWriter::writeComponent()
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -210,7 +202,7 @@ void ComponentWriter::writeModes(QXmlStreamWriter& writer, QSharedPointer<Compon
{
writer.writeStartElement(QStringLiteral("ipxact:modes"));

for (auto mode : *component->getModes())
for (auto const& mode : *component->getModes())
{
ModeWriter::writeMode(writer, mode);
}
Expand All @@ -228,7 +220,7 @@ void ComponentWriter::writeAddressSpaces(QXmlStreamWriter& writer, QSharedPointe
{
writer.writeStartElement(QStringLiteral("ipxact:addressSpaces"));

foreach (QSharedPointer<AddressSpace> addressSpace, *component->getAddressSpaces())
for (QSharedPointer<AddressSpace> addressSpace : *component->getAddressSpaces())
{
AddressSpaceWriter::writeAddressSpace(writer, addressSpace, component->getRevision());
}
Expand Down Expand Up @@ -369,7 +361,7 @@ void ComponentWriter::writeChoices(QXmlStreamWriter& writer, QSharedPointer<Comp
{
writer.writeStartElement(QStringLiteral("ipxact:choices"));

foreach (QSharedPointer<Choice> choice, *component->getChoices())
for (QSharedPointer<Choice> choice : *component->getChoices())
{
ChoiceWriter::writeChoice(writer, choice);
}
Expand Down Expand Up @@ -425,7 +417,7 @@ void ComponentWriter::writeOtherClockDrivers(QXmlStreamWriter& writer, QSharedPo

writer.writeStartElement(QStringLiteral("ipxact:otherClockDrivers"));

foreach (QSharedPointer<OtherClockDriver> driver, *component->getOtherClockDrivers())
for (QSharedPointer<OtherClockDriver> driver : *component->getOtherClockDrivers())
{
clockWriter.writeOtherClockDriver(writer, driver);
}
Expand Down
2 changes: 1 addition & 1 deletion IPXACTmodels/Component/ComponentWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IPXACTMODELS_EXPORT ComponentWriter : public DocumentWriter
/*!
* The destructor.
*/
~ComponentWriter();
~ComponentWriter() = default;

/*!
* Write a component to an XML file.
Expand Down
80 changes: 10 additions & 70 deletions IPXACTmodels/Component/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,16 @@
#include <IPXACTmodels/utilities/Search.h>
#include <IPXACTmodels/utilities/Copy.h>

//-----------------------------------------------------------------------------
// Function: Model::Model()
//-----------------------------------------------------------------------------
Model::Model()
{

}

//-----------------------------------------------------------------------------
// Function: Model::Model()
//-----------------------------------------------------------------------------
Model::Model(Model const& other)
{
copyViews(other);
copyComponentInstantiations(other);
copyDesignInstantiations(other);
copyDesignConfigurationInstantiations(other);
copyPorts(other);
Copy::copyList(other.views_, views_);
Copy::copyList(other.componentInstantiations_, componentInstantiations_);
Copy::copyList(other.designInstantiations_, designInstantiations_);
Copy::copyList(other.designConfigurationInstantiations_, designConfigurationInstantiations_);
Copy::copyList(other.ports_, ports_);
}

//-----------------------------------------------------------------------------
Expand All @@ -47,31 +39,19 @@ Model& Model::operator=(Model const& other )
if (this != &other)
{
views_->clear();
copyViews(other);
Copy::copyList(other.views_, views_);
componentInstantiations_->clear();
copyComponentInstantiations(other);
Copy::copyList(other.componentInstantiations_, componentInstantiations_);
designInstantiations_->clear();
copyDesignInstantiations(other);
Copy::copyList(other.designInstantiations_, designInstantiations_);
designConfigurationInstantiations_->clear();
copyDesignInstantiations(other);
Copy::copyList(other.designConfigurationInstantiations_, designConfigurationInstantiations_);
ports_->clear();
copyPorts(other);
Copy::copyList(other.ports_, ports_);
}
return *this;
}

//-----------------------------------------------------------------------------
// Function: Model::~Model()
//-----------------------------------------------------------------------------
Model::~Model()
{
views_.clear();
componentInstantiations_.clear();
designInstantiations_.clear();
designConfigurationInstantiations_.clear();
ports_.clear();
}

//-----------------------------------------------------------------------------
// Function: Model::getViews()
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -378,43 +358,3 @@ bool Model::hasContents() const
return (!views_->isEmpty() || !componentInstantiations_->isEmpty() || !designInstantiations_->isEmpty() ||
!designConfigurationInstantiations_->isEmpty() || !ports_->isEmpty());
}

//-----------------------------------------------------------------------------
// Function: Model::copyViews()
//-----------------------------------------------------------------------------
void Model::copyViews(Model const& other) const
{
Copy::copyList(other.views_, views_);
}

//-----------------------------------------------------------------------------
// Function: Model::copyComponentInstantiations()
//-----------------------------------------------------------------------------
void Model::copyComponentInstantiations(Model const& other) const
{
Copy::copyList(other.componentInstantiations_, componentInstantiations_);
}

//-----------------------------------------------------------------------------
// Function: Model::copyDesignInstantiations()
//-----------------------------------------------------------------------------
void Model::copyDesignInstantiations(Model const& other) const
{
Copy::copyList(other.designInstantiations_, designInstantiations_);
}

//-----------------------------------------------------------------------------
// Function: Model::copyDesignConfigurationInstantiations()
//-----------------------------------------------------------------------------
void Model::copyDesignConfigurationInstantiations(const Model& other) const
{
Copy::copyList(other.designConfigurationInstantiations_, designConfigurationInstantiations_);
}

//-----------------------------------------------------------------------------
// Function: Model::copyPorts()
//-----------------------------------------------------------------------------
void Model::copyPorts(Model const& other) const
{
Copy::copyList(other.ports_, ports_);
}
39 changes: 2 additions & 37 deletions IPXACTmodels/Component/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IPXACTMODELS_EXPORT Model
/*!
* The default constructor.
*/
Model();
Model() = default;

//! Copy constructor.
Model(const Model &other);
Expand All @@ -48,7 +48,7 @@ class IPXACTMODELS_EXPORT Model
/*!
* The destructor.
*/
~Model();
~Model() = default;

/*!
* Get the views of this model.
Expand Down Expand Up @@ -247,41 +247,6 @@ class IPXACTMODELS_EXPORT Model

private:

/*!
* Copy the views.
*
* @param [in] other The model being copied.
*/
void copyViews(const Model& other) const;

/*!
* Copy the component instantiations.
*
* @param [in] other The model being copied.
*/
void copyComponentInstantiations(const Model& other) const;

/*!
* Copy the design instantiations.
*
* @param [in] other The model being copied.
*/
void copyDesignInstantiations(const Model& other) const;

/*!
* Copy the design configurations.
*
* @param [in] other The model being copied.
*/
void copyDesignConfigurationInstantiations(const Model& other) const;

/*!
* Copy the ports.
*
* @param [in] other The model being copied.
*/
void copyPorts(const Model& other) const;

//! Contains the views for this model.
View::List views_ = View::List(new QList<QSharedPointer<View> >());

Expand Down
Loading

0 comments on commit 76e03e4

Please sign in to comment.