From 7e6f7f969e54ee86d3d35117e6c40eddbe0224e6 Mon Sep 17 00:00:00 2001 From: epekkar Date: Fri, 17 Nov 2023 14:50:21 +0200 Subject: [PATCH] [CLEANUP] Remove obsolete constructors in abstraction and bus definitions --- .../AbstractionDefinition.cpp | 12 +--- .../AbstractionDefinition.h | 3 - IPXACTmodels/BusDefinition/BusDefinition.cpp | 9 --- IPXACTmodels/BusDefinition/BusDefinition.h | 5 +- IPXACTmodels/IPXACTmodels.pri | 4 -- IPXACTmodels/common/DirectionTypes.cpp | 2 +- IPXACTmodels/common/DirectionTypes.h | 2 +- IPXACTmodels/common/Document.cpp | 58 ++++--------------- IPXACTmodels/common/Document.h | 24 -------- editors/ComponentEditor/ports/portseditor.cpp | 8 +-- mainwindow/DockWidgetHandler.cpp | 4 +- mainwindow/mainwindow.cpp | 5 +- version.h | 14 ++--- 13 files changed, 31 insertions(+), 119 deletions(-) diff --git a/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.cpp b/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.cpp index e859224df..56754d886 100644 --- a/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.cpp +++ b/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.cpp @@ -29,22 +29,14 @@ #include #include -//----------------------------------------------------------------------------- -// Function: AbstractionDefinition::AbstractionDefinition() -//----------------------------------------------------------------------------- -AbstractionDefinition::AbstractionDefinition(): -Document() -{ - -} //----------------------------------------------------------------------------- // Function: AbstractionDefinition::AbstractionDefinition() //----------------------------------------------------------------------------- AbstractionDefinition::AbstractionDefinition(VLNV const& vlnv, Document::Revision revision): -Document(revision) +Document(vlnv, revision) { - setVlnv(vlnv); + } //----------------------------------------------------------------------------- diff --git a/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.h b/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.h index 55329feb9..fd5167427 100644 --- a/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.h +++ b/IPXACTmodels/AbstractionDefinition/AbstractionDefinition.h @@ -32,9 +32,6 @@ class IPXACTMODELS_EXPORT AbstractionDefinition: public Document { public: - //! The default constructor. - AbstractionDefinition(); - AbstractionDefinition(VLNV const& vlnv, Document::Revision revision); //! Copy constructor. diff --git a/IPXACTmodels/BusDefinition/BusDefinition.cpp b/IPXACTmodels/BusDefinition/BusDefinition.cpp index ebac7f10a..66fefe3c9 100644 --- a/IPXACTmodels/BusDefinition/BusDefinition.cpp +++ b/IPXACTmodels/BusDefinition/BusDefinition.cpp @@ -23,15 +23,6 @@ #include #include -//----------------------------------------------------------------------------- -// Function: BusDefinition::BusDefinition() -//----------------------------------------------------------------------------- -BusDefinition::BusDefinition(): -Document() -{ - -} - //----------------------------------------------------------------------------- // Function: BusDefinition::BusDefinition() //----------------------------------------------------------------------------- diff --git a/IPXACTmodels/BusDefinition/BusDefinition.h b/IPXACTmodels/BusDefinition/BusDefinition.h index 933635a4a..cf8f0e636 100644 --- a/IPXACTmodels/BusDefinition/BusDefinition.h +++ b/IPXACTmodels/BusDefinition/BusDefinition.h @@ -38,9 +38,6 @@ class IPXACTMODELS_EXPORT BusDefinition: public Document { public: - //! The default constructor. - BusDefinition(); - BusDefinition(VLNV const& vlnv, Document::Revision revision); //! Copy constructor. @@ -50,7 +47,7 @@ class IPXACTMODELS_EXPORT BusDefinition: public Document BusDefinition &operator=(BusDefinition const& other); //! The destructor. - virtual ~BusDefinition(); + ~BusDefinition() final; /*! * Creates a perfect copy of the Bus Definition. diff --git a/IPXACTmodels/IPXACTmodels.pri b/IPXACTmodels/IPXACTmodels.pri index 0464de5d4..75413e81d 100644 --- a/IPXACTmodels/IPXACTmodels.pri +++ b/IPXACTmodels/IPXACTmodels.pri @@ -2,10 +2,6 @@ # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ -# This is a reminder that you are using a generated .pro file. -# Remove it when you are finished editing this file. -message("You are running qmake on a generated .pro file. This may not work!") - HEADERS += ./generaldeclarations.h \ ./ipxactmodels_global.h \ diff --git a/IPXACTmodels/common/DirectionTypes.cpp b/IPXACTmodels/common/DirectionTypes.cpp index 373c613ac..628e1062e 100644 --- a/IPXACTmodels/common/DirectionTypes.cpp +++ b/IPXACTmodels/common/DirectionTypes.cpp @@ -16,7 +16,7 @@ //----------------------------------------------------------------------------- // Function: DirectionTypes::convert2Mirrored() //----------------------------------------------------------------------------- -constexpr DirectionTypes::Direction DirectionTypes::convert2Mirrored(Direction originalDirection ) +DirectionTypes::Direction DirectionTypes::convert2Mirrored(Direction originalDirection ) { if (originalDirection == DirectionTypes::IN) { diff --git a/IPXACTmodels/common/DirectionTypes.h b/IPXACTmodels/common/DirectionTypes.h index aff8ce852..540b7cd84 100644 --- a/IPXACTmodels/common/DirectionTypes.h +++ b/IPXACTmodels/common/DirectionTypes.h @@ -39,7 +39,7 @@ namespace DirectionTypes * * @return The mirrored direction. */ - IPXACTMODELS_EXPORT constexpr DirectionTypes::Direction convert2Mirrored( + IPXACTMODELS_EXPORT DirectionTypes::Direction convert2Mirrored( DirectionTypes::Direction originalDirection); /*! diff --git a/IPXACTmodels/common/Document.cpp b/IPXACTmodels/common/Document.cpp index d214cc232..7c7894e19 100644 --- a/IPXACTmodels/common/Document.cpp +++ b/IPXACTmodels/common/Document.cpp @@ -14,6 +14,8 @@ #include #include +#include + #include #include @@ -24,18 +26,6 @@ #include #include -//----------------------------------------------------------------------------- -// Function: Document::Document() -//----------------------------------------------------------------------------- -Document::Document(Revision revision): -Extendable(), - - revision_(revision) -{ - addDefaultNameSpaces(revision); - setSchemaLocation(revision); -} - //----------------------------------------------------------------------------- // Function: Document::Document() //----------------------------------------------------------------------------- @@ -60,8 +50,8 @@ Extendable(other), xmlNameSpaces_(other.xmlNameSpaces_), xmlSchemaLocation_(other.xmlSchemaLocation_) { - copyParameters(other); - copyAssertions(other); + Copy::copyList(other.parameters_, parameters_); + Copy::copyList(other.assertions_, assertions_); } //----------------------------------------------------------------------------- @@ -89,8 +79,11 @@ Document & Document::operator=( const Document &other ) xmlNameSpaces_ = other.xmlNameSpaces_; xmlSchemaLocation_ = other.xmlSchemaLocation_; - copyParameters(other); - copyAssertions(other); + parameters_->clear(); + Copy::copyList(other.parameters_, parameters_); + + assertions_->clear(); + Copy::copyList(other.assertions_, assertions_); } return *this; @@ -190,7 +183,7 @@ QSharedPointer > > Document::getAssertions() con //----------------------------------------------------------------------------- void Document::setTopComments(QString const& comment) { - topComments_ = comment.split(QStringLiteral("\n")); + topComments_ = comment.split(QLatin1Char('\n')); } //----------------------------------------------------------------------------- @@ -265,7 +258,7 @@ void Document::setSchemaLocation(Document::Revision revision) } else { - xmlSchemaLocation_ = QStringLiteral(""); + xmlSchemaLocation_ = QString(); } } @@ -584,35 +577,6 @@ void Document::addDefaultNameSpaces(Revision revision) xmlNameSpaces_.append(qMakePair(QStringLiteral("kactus2"), QStringLiteral("http://kactus2.cs.tut.fi"))); } -//----------------------------------------------------------------------------- -// Function: Document::copyParameters() -//----------------------------------------------------------------------------- -void Document::copyParameters(Document const& other) -{ - parameters_->reserve(other.parameters_->count()); - for (QSharedPointer parameter : *other.parameters_) - { - QSharedPointer copy = QSharedPointer(new Parameter(*parameter.data())); - parameters_->append(copy); - } -} - -//----------------------------------------------------------------------------- -// Function: Document::copyAssertions() -//----------------------------------------------------------------------------- -void Document::copyAssertions(Document const& other) -{ - assertions_->reserve(other.assertions_->count()); - for (QSharedPointer assertion : *other.assertions_) - { - if (assertion) - { - QSharedPointer copy = QSharedPointer(new Assertion(*assertion.data())); - assertions_->append(copy); - } - } -} - //----------------------------------------------------------------------------- // Function: Document::getTags() //----------------------------------------------------------------------------- diff --git a/IPXACTmodels/common/Document.h b/IPXACTmodels/common/Document.h index 359d353a7..e4191823f 100644 --- a/IPXACTmodels/common/Document.h +++ b/IPXACTmodels/common/Document.h @@ -48,9 +48,6 @@ class IPXACTMODELS_EXPORT Document : public Extendable Std14, Std22, Unknown }; - //! The default constructor. - explicit Document(Revision revision = Revision::Unknown); - /*! * The constructor. * @@ -369,27 +366,6 @@ class IPXACTMODELS_EXPORT Document : public Extendable * Add the default namespaces to the list of namespaces. */ void addDefaultNameSpaces(Revision revision); - - /*! - * Copies parameters from another document. - * - * @param [in] other The document to copy parameters from. - */ - void copyParameters(Document const& other); - - /*! - * Copies assertions from another document. - * - * @param [in] other The document to copy assertions from. - */ - void copyAssertions(Document const& other); - - /*! - * Copies vendor extensions from another document. - * - * @param [in] other The document to copy extensions from. - */ - void copyVendorExtensions(const Document & other); /*! * Get the group container for document tags. diff --git a/editors/ComponentEditor/ports/portseditor.cpp b/editors/ComponentEditor/ports/portseditor.cpp index a01942840..fdaedb0b0 100644 --- a/editors/ComponentEditor/ports/portseditor.cpp +++ b/editors/ComponentEditor/ports/portseditor.cpp @@ -276,8 +276,7 @@ void PortsEditor::onCreateNewInteface(QStringList const& selectedPorts) } // Create a bus definition. - QSharedPointer busDef(new BusDefinition()); - busDef->setVlnv(busVLNV); + QSharedPointer busDef(new BusDefinition(busVLNV, component_->getRevision())); // Create the file for the bus definition. if (!handler_->writeModelToFile(absDirectory, busDef)) @@ -287,9 +286,8 @@ void PortsEditor::onCreateNewInteface(QStringList const& selectedPorts) } // create an abstraction definition - QSharedPointer absDef(new AbstractionDefinition()); - absDef->setVlnv(absVLNV); - + QSharedPointer absDef(new AbstractionDefinition(absVLNV, component_->getRevision())); + // set reference from abstraction definition to bus definition absDef->setBusType(busVLNV); diff --git a/mainwindow/DockWidgetHandler.cpp b/mainwindow/DockWidgetHandler.cpp index 8d3094c0e..605c92df6 100644 --- a/mainwindow/DockWidgetHandler.cpp +++ b/mainwindow/DockWidgetHandler.cpp @@ -343,8 +343,8 @@ void DockWidgetHandler::setupLibraryDock() connect(this, SIGNAL(generateIntegrityReport()), libraryWidget_, SLOT(onGenerateIntegrityReport()), Qt::UniqueConnection); - connect(libraryWidget_, SIGNAL(createAbsDef(const VLNV&, const QString&)), - mainWindow_, SLOT(createAbsDef(const VLNV&, const QString&)), Qt::UniqueConnection); + connect(libraryWidget_, SIGNAL(createAbsDef(const VLNV&, Document::Revision, const QString&)), + mainWindow_, SLOT(createAbsDef(const VLNV&, Document::Revision, const QString&)), Qt::UniqueConnection); connect(libraryWidget_, SIGNAL(createDesignForExistingComponent(const VLNV&)), mainWindow_, SLOT(createDesignForExistingComponent(const VLNV&)), Qt::UniqueConnection); diff --git a/mainwindow/mainwindow.cpp b/mainwindow/mainwindow.cpp index 5e273b2d2..c80b2a9a8 100644 --- a/mainwindow/mainwindow.cpp +++ b/mainwindow/mainwindow.cpp @@ -2195,6 +2195,8 @@ void MainWindow::createAbsDef( const VLNV& busDefVLNV, const QString& directory Q_ASSERT(busDefVLNV.isValid()); Q_ASSERT(!directory.isEmpty()); + auto busDef = libraryHandler_->getModelReadOnly(busDefVLNV); + VLNV absVLNV = busDefVLNV; // remove the possible .busDef from the end of the name field @@ -2222,8 +2224,7 @@ void MainWindow::createAbsDef( const VLNV& busDefVLNV, const QString& directory } // create an abstraction definition - QSharedPointer absDef = QSharedPointer(new AbstractionDefinition()); - absDef->setVlnv(absVLNV); + auto absDef = QSharedPointer(new AbstractionDefinition(absVLNV, busDef->getRevision())); absDef->setVersion(VersionHelper::versionFileStr()); // set reference from abstraction definition to bus definition diff --git a/version.h b/version.h index c61c854b6..678a05b67 100644 --- a/version.h +++ b/version.h @@ -10,20 +10,20 @@ #ifndef VERSIONNO__H #define VERSIONNO__H -#define VERSION_FULL 3.12.992.0 +#define VERSION_FULL 3.12.993.0 #define VERSION_BASEYEAR 0 #define VERSION_DATE "2023-11-17" -#define VERSION_TIME "14:03:13" +#define VERSION_TIME "14:35:14" #define VERSION_MAJOR 3 #define VERSION_MINOR 12 -#define VERSION_BUILDNO 992 +#define VERSION_BUILDNO 993 #define VERSION_EXTEND 0 -#define VERSION_FILE 3,12,992,0 -#define VERSION_PRODUCT 3,12,992,0 -#define VERSION_FILESTR "3,12,992,0" -#define VERSION_PRODUCTSTR "3,12,992,0" +#define VERSION_FILE 3,12,993,0 +#define VERSION_PRODUCT 3,12,993,0 +#define VERSION_FILESTR "3,12,993,0" +#define VERSION_PRODUCTSTR "3,12,993,0" #endif