Commit ff5883b8 authored by Emmanuel Promayon's avatar Emmanuel Promayon

UPDATED modernize use nullptr instead of NULL

parent f2ce04d0
......@@ -67,7 +67,7 @@ QStringList ItkImageComponentExtension::getFileExtensions() const {
// --------------- open -------------------
Component* ItkImageComponentExtension::open(const QString& fileName) throw (AbortException) {
ItkImageComponent* res = NULL;
ItkImageComponent* res = nullptr;
try {
res = new ItkImageComponent(fileName);
}
......
......@@ -76,7 +76,7 @@ Action::ApplyStatus GenerateModel::apply() {
QString originalFilename = targetMesh->getFileName();
if ( originalFilename.isEmpty() ) {
// ask the user
originalFilename = QFileDialog::getSaveFileName( NULL, "Generate Model", "", "ModelingML (*.mml)" );
originalFilename = QFileDialog::getSaveFileName( nullptr, "Generate Model", "", "ModelingML (*.mml)" );
if ( originalFilename.isNull() ) {
QApplication::restoreOverrideCursor();
CAMITK_WARNING(tr("Filename required. Action Aborted."))
......
......@@ -65,17 +65,17 @@ PMLExplorerWidget::PMLExplorerWidget ( PMLComponent* comp ) : QWidget() {
QObject::connect ( ui->addButton, SIGNAL ( clicked() ), this, SLOT ( createNewProperty() ) );
QObject::connect ( ui->showAtomGlyphCB, SIGNAL ( toggled ( bool ) ), this, SLOT ( showAtomGlyphToggled ( bool ) ) );
physicalModelItem = NULL;
atomsItem = NULL;
exclusiveComponentItem = NULL;
informativeComponentItem = NULL;
physicalModelItem = nullptr;
atomsItem = nullptr;
exclusiveComponentItem = nullptr;
informativeComponentItem = nullptr;
init ( comp );
}
// --------------- Destructor -------------------
PMLExplorerWidget::~PMLExplorerWidget() {
delete objectController;
objectController = NULL;
objectController = nullptr;
foreach ( QObject * o, widgetPropertiesMap ) {
delete o;
......@@ -91,7 +91,7 @@ void PMLExplorerWidget::buildPhysicalModelTreeWidgetItem() {
// This can't take time on big PML file
QApplication::setOverrideCursor ( Qt::WaitCursor );
editedItem = NULL;
editedItem = nullptr;
// create the main PhysicalModel node
physicalModelItem = new QTreeWidgetItem ( ui->treeWidget );
......@@ -255,7 +255,7 @@ void PMLExplorerWidget::selectItems() {
// --------------- updateTarget -------------------
void PMLExplorerWidget::updateTarget ( PMLComponent* comp ) {
editedItem = NULL;
editedItem = nullptr;
objectController->setObject ( NULL );
// Disconnect the selection changed signal, avoiding
// vicious bugs (Qt slots thread may call signal method while
......@@ -277,10 +277,10 @@ void PMLExplorerWidget::updateTarget ( PMLComponent* comp ) {
// Clear the tree content (remove items and delete them)
ui->treeWidget->clear();
physicalModelItem = NULL;
atomsItem = NULL;
exclusiveComponentItem = NULL;
informativeComponentItem = NULL;
physicalModelItem = nullptr;
atomsItem = nullptr;
exclusiveComponentItem = nullptr;
informativeComponentItem = nullptr;
init ( comp );
}
......@@ -360,7 +360,7 @@ void PMLExplorerWidget::updateProperty ( QTreeWidgetItem* item ) {
itemProperties = pmlComponent;
}
else {
editedItem = NULL;
editedItem = nullptr;
}
}
// update the ObjectController
......@@ -371,7 +371,7 @@ void PMLExplorerWidget::updateProperty ( QTreeWidgetItem* item ) {
// --------------- createNewProperty -------------------
void PMLExplorerWidget::createNewProperty() {
if ( editedItem != NULL ) {
if ( editedItem != nullptr ) {
QDialog* newPropertyDialog = new QDialog ( this );
Ui::ui_AddNewPropertyWidget addNewPropertyUI;
addNewPropertyUI.setupUi ( newPropertyDialog );
......
......@@ -101,12 +101,12 @@ MMLComponent::MMLComponent(const QString& fileName) throw(AbortException) : Comp
else {
if (display) {
delete display;
display = NULL;
display = nullptr;
}
if (mmlGUI) {
delete mmlGUI;
mmlGUI = NULL;
mmlGUI = nullptr;
}
throw AbortException("Cannot open " + myFileName.toStdString() + "\nThe given simulator is probably not supported");
}
......@@ -120,17 +120,17 @@ MMLComponent::MMLComponent(const QString& fileName) throw(AbortException) : Comp
MMLComponent::~MMLComponent() {
if (pmlComponent) {
delete pmlComponent;
pmlComponent = NULL;
pmlComponent = nullptr;
}
if (display) {
delete display;
display = NULL;
display = nullptr;
}
if (mmlGUI) {
delete mmlGUI;
mmlGUI = NULL;
mmlGUI = nullptr;
}
}
......@@ -168,7 +168,7 @@ MMLDisplay* MMLComponent::getDisplay() {
void MMLComponent::connectPml() {
removeChild(pmlComponent);
delete pmlComponent;
pmlComponent = NULL;
pmlComponent = nullptr;
deleteChildren();
refreshInterfaceNode();
// this gives the ownership of pml pointer to the PML Component, use takePml() not getPml()
......
......@@ -53,7 +53,7 @@ MMLDisplay::MMLDisplay( MMLComponent* mmlManager ): QObject() {
connect( qobj, SIGNAL( changed() ), this, SLOT( updateDisplay() ) );
connect( qobj2, SIGNAL( monitorsChanged() ), this, SLOT( updateMonitorsTable() ) );
connect( qobj, SIGNAL( reconnectPml() ), this, SLOT( connectPml() ) );
monitorDisplay = NULL;
monitorDisplay = nullptr;
// add two column in monitors table for displaying monitors
QTableWidget* table = mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
......@@ -156,7 +156,7 @@ Monitor* MMLDisplay::getDisplayedMonitor() {
return mmlManager->getMonitoringGuiManager()->getMonitoringManager()->getMonitor( i );
}
}
return NULL;
return nullptr;
}
// -------------------- getDisplayedMonitorLine ---------------------
......
......@@ -25,7 +25,7 @@
#include "MMLMonitorDisplayFactory.h"
MMLMonitorDisplayFactory* MMLMonitorDisplayFactory::instance = NULL;
MMLMonitorDisplayFactory* MMLMonitorDisplayFactory::instance = nullptr;
MMLMonitorDisplayFactory::MMLMonitorDisplayFactory() {}
......@@ -38,7 +38,7 @@ bool MMLMonitorDisplayFactory::isRegistered(std::string id) {
MMLMonitorDisplay* MMLMonitorDisplayFactory::createMonitorDisplay(std::string id, Monitor* monitor, MMLComponent* manager) {
std::map<std::string, CreateMonitorDisplayFunctionPointer>::iterator iter = mapObjectCreator.find(id);
if (iter == mapObjectCreator.end()) {
return NULL;
return nullptr;
}
return ((*iter).second)(monitor, manager);
}
......
......@@ -46,7 +46,7 @@ Statistics::Statistics(Monitor* monitor, MMLComponent* manager): MMLMonitorDispl
item->setText(("Statistics"));
t->setHorizontalHeaderItem(j, item);
table = new QTableWidget;
table->setEditTriggers(0);
table->setEditTriggers(nullptr);
t->setCellWidget(line, j, table);
}
......
......@@ -47,7 +47,7 @@ Tabular::Tabular(Monitor* monitor, MMLComponent* manager): MMLMonitorDisplay(mon
item->setText(("Tabular"));
t->setHorizontalHeaderItem(j, item);
table = new QTableWidget;
table->setEditTriggers(0);
table->setEditTriggers(nullptr);
t->setCellWidget(line, j, table);
table->installEventFilter(this);
}
......@@ -55,7 +55,7 @@ Tabular::Tabular(Monitor* monitor, MMLComponent* manager): MMLMonitorDisplay(mon
Tabular::~Tabular() {
if (table) {
delete table;
table = NULL;
table = nullptr;
}
}
......
......@@ -95,7 +95,7 @@ PMLComponent::~PMLComponent() {
atomPointIdMap.clear();
delete physicalModel;
physicalModel = NULL;
physicalModel = nullptr;
}
//-------------------- init -------------------
......@@ -575,7 +575,7 @@ int PMLComponent::addSelection(const QString& name, int fieldType, int contentTy
//------------------------ getPixmap ---------------------
#include "physicalmodel_20x20.xpm"
QPixmap* PMLComponent::myPixmap = NULL;
QPixmap* PMLComponent::myPixmap = nullptr;
QPixmap PMLComponent::getIcon() {
if (!myPixmap) {
myPixmap = new QPixmap(physicalmodel_20x20);
......
......@@ -37,7 +37,7 @@
//--------- static factory -------------
Load* Load::LoadFactory(std::string type) {
Load* newOne = NULL;
Load* newOne = nullptr;
// instanciate depending on the load type
if (type == "Translation") {
......@@ -259,7 +259,7 @@ ValueEvent* Load::getValueEvent(const unsigned int i) const {
return eventList[i];
}
else {
return NULL;
return nullptr;
}
}
......
......@@ -251,7 +251,7 @@ Load* Loads::getLoad (const unsigned int i) const {
return loads[i];
}
else {
return NULL;
return nullptr;
}
}
......
......@@ -47,7 +47,7 @@ public:
* constructor
* @param m the xsdcxx generated MultipleCriterion
*/
AndMultipleCriterion(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
AndMultipleCriterion(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~AndMultipleCriterion() override;
......
......@@ -67,7 +67,7 @@ void Criterion::write() {
// -------------------- getChild --------------------
StoppingCriterion* Criterion::getChild(const unsigned int i) {
return NULL;
return nullptr;
}
// -------------------- getNumberOfChildren --------------------
......
......@@ -50,7 +50,7 @@ public:
* constructor
*@param c the xsdcxx generated criterion
*/
Criterion(mml::Criteria* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
Criterion(mml::Criteria* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~Criterion() override;
......
......@@ -48,7 +48,7 @@ public:
~CriterionFactory();
/// create a criterion according to the xsdcxx object criterion
static Criterion* createCriterion(mml::Criteria* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
static Criterion* createCriterion(mml::Criteria* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
private:
/// constructor
......
......@@ -45,7 +45,7 @@ public:
* constructor
*@param c the xsdcxx generated Force criterion
*/
ForceCriterion(mml::Force* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
ForceCriterion(mml::Force* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~ForceCriterion() override;
......
......@@ -43,7 +43,7 @@ InteractiveMonitoringManager::InteractiveMonitoringManager(const char* mml): Mon
stop = StoppingCriterionFactory::createStoppingCriterion(s, this);
}
else {
stop = NULL;
stop = nullptr;
}
}
......
......@@ -44,7 +44,7 @@ public:
* constructor
*@param c the xsdcxx generated KineticEnergy criterion
*/
kineticEnergy(mml::KineticEnergy* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
kineticEnergy(mml::KineticEnergy* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~kineticEnergy() override;
......
......@@ -57,5 +57,5 @@ MonitoringManager* MonitoringManagerFactory::createManager(const char* mml) {
else {
std::cerr << "MonitoringManagerFactory: Simulator " << sim << " not registered" << std::endl;
}
return NULL;
return nullptr;
}
......@@ -65,7 +65,7 @@ StoppingCriterion* MultipleCriterion::getChild(const unsigned int i) {
return criterias[i];
}
else {
return NULL;
return nullptr;
}
}
......
......@@ -48,7 +48,7 @@ public:
* constructor
* @param m the xsdcxx generated MultipleCriterion
*/
MultipleCriterion(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
MultipleCriterion(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~MultipleCriterion() override;
......
......@@ -45,7 +45,7 @@ public:
~MultipleCriterionFactory();
/// create a criterion according to the xsdcxx object MultipleCriterion
static MultipleCriterion* createMultipleCriteria(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
static MultipleCriterion* createMultipleCriteria(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
private:
/// constructor
......
......@@ -45,7 +45,7 @@ public:
* constructor
* @param m the xsdcxx generated MultipleCriterion
*/
OrMultipleCriterion(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
OrMultipleCriterion(mml::MultipleCriteria* m, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~OrMultipleCriterion() override;
......
......@@ -43,7 +43,7 @@ public:
* constructor
*@param c the xsdcxx generated Position criterion
*/
Position(mml::Position* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
Position(mml::Position* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~Position() override;
......
......@@ -29,14 +29,14 @@
Simulator::Simulator(MonitoringManager* monitoringManager) {
this->monitoringManager = monitoringManager;
#ifdef MML_GENERATE_GUI
this->widget = NULL;
this->widget = nullptr;
#endif
}
Simulator::Simulator(MonitoringManager* monitoringManager, const char* file) {
this->monitoringManager = monitoringManager;
#ifdef MML_GENERATE_GUI
this->widget = NULL;
this->widget = nullptr;
#endif
}
......
......@@ -26,7 +26,7 @@
#include "SimulatorFactory.h"
#include "InitSimulators.h"
SimulatorFactory* SimulatorFactory::instance = NULL;
SimulatorFactory* SimulatorFactory::instance = nullptr;
SimulatorFactory::SimulatorFactory() {}
......@@ -39,7 +39,7 @@ bool SimulatorFactory::isRegistered(std::string id) {
Simulator* SimulatorFactory::createSimulator(std::string id, MonitoringManager* monitoringManager) {
std::map<std::string, CreateSimulatorFunctionPointer>::iterator iter = mapObjectCreator.find(id);
if (iter == mapObjectCreator.end()) {
return NULL;
return nullptr;
}
return ((*iter).second)(monitoringManager);
}
......@@ -48,7 +48,7 @@ Simulator* SimulatorFactory::createSimulator(std::string id, MonitoringManager*
Simulator* SimulatorFactory::createSimulator(std::string id, MonitoringManager* monitoringManager, const char* file) {
std::map<std::string, CreateSimulatorFunctionPointer2>::iterator iter = mapObjectCreator2.find(id);
if (iter == mapObjectCreator2.end()) {
return NULL;
return nullptr;
}
return ((*iter).second)(monitoringManager, file);
}
......
......@@ -42,7 +42,7 @@ class MML_API SimulatorWidget: public QWidget {
public:
/// constructor
SimulatorWidget(QWidget* parent = 0);
SimulatorWidget(QWidget* parent = nullptr);
/// destructor
~SimulatorWidget() override;
......
......@@ -49,7 +49,7 @@ class MML_API StoppingCriterion {
public:
/// constructor
StoppingCriterion(MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
StoppingCriterion(MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
virtual ~StoppingCriterion();
......
......@@ -45,7 +45,7 @@ public:
~StoppingCriterionFactory();
/// create a stopping criterion according to xsdcxx generated stopping criterion
static StoppingCriterion* createStoppingCriterion(mml::StoppingCriteria* s, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
static StoppingCriterion* createStoppingCriterion(mml::StoppingCriteria* s, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
private:
/// constructor
......
......@@ -43,7 +43,7 @@ public:
* constructor
*@param c the xsdcxx generated time criterion
*/
Time(mml::Time* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
Time(mml::Time* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~Time() override;
......
......@@ -43,7 +43,7 @@ public:
* constructor
*@param c the xsdcxx generated Velocity criterion
*/
Velocity(mml::Speed* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = NULL);
Velocity(mml::Speed* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
/// destructor
~Velocity() override;
......
......@@ -52,7 +52,7 @@ class XmlHighlighter : public QSyntaxHighlighter {
Q_OBJECT
public:
XmlHighlighter(QTextDocument* parent = 0);
XmlHighlighter(QTextDocument* parent = nullptr);
protected:
void highlightBlock(const QString& text) override;
......
......@@ -88,12 +88,12 @@ MonitoringDialog::~MonitoringDialog() {
// see bug 116 : https://forge.imag.fr/tracker/index.php?func=detail&aid=116&group_id=184&atid=792
this->ui->monitorsTable->clearContents();
QWidget* simulatorWidget = ui->monitoringTabs->widget(3);
if (simulatorWidget != NULL) {
if (simulatorWidget != nullptr) {
ui->monitoringTabs->removeTab(ui->monitoringTabs->indexOf(simulatorWidget));
delete simulatorWidget;
}
delete ui;
ui = NULL;
ui = nullptr;
}
//--------------- init ---------------------------------
......@@ -247,7 +247,7 @@ void MonitoringDialog::updateAll() {
ui->sCriteriaTab->setEnabled(false);
// deleting simulator widget if exists
QWidget* simulatorWidget = ui->monitoringTabs->widget(3);
if (simulatorWidget != NULL) {
if (simulatorWidget != nullptr) {
ui->monitoringTabs->removeTab(ui->monitoringTabs->indexOf(simulatorWidget));
delete simulatorWidget;
}
......@@ -315,14 +315,14 @@ void MonitoringDialog::updateStoppingCriteria() {
void MonitoringDialog::updateSimulatorWidget() {
// deleting simulator widget if exists
QWidget* simulatorWidget = ui->monitoringTabs->widget(3);
if (simulatorWidget != NULL) {
if (simulatorWidget != nullptr) {
ui->monitoringTabs->removeTab(ui->monitoringTabs->indexOf(simulatorWidget));
delete simulatorWidget;
}
#ifdef MML_GENERATE_GUI
simulatorWidget = guiManager->getMonitoringManager()->getSimulator()->getWidget();
if (simulatorWidget != NULL) {
if (simulatorWidget != nullptr) {
connect(simulatorWidget, SIGNAL(reload()), guiManager, SLOT(reload()));
ui->monitoringTabs->addTab(simulatorWidget, tr("Simulator"));
}
......
......@@ -52,7 +52,7 @@ class /* needed if you monitoringgui is compiled as shared: MML_MONITORING_GUI_A
public:
/**Default Constructor*/
MonitoringDialog(MonitoringGuiManager* guiManager, QWidget* parent = 0);
MonitoringDialog(MonitoringGuiManager* guiManager, QWidget* parent = nullptr);
/**Destructor*/
~MonitoringDialog() override;
......
......@@ -32,14 +32,14 @@
//--------------- Constructor ---------------------------------
MonitoringDriver::MonitoringDriver(MonitoringGuiManager* guiManager): QObject() {
this->guiManager = guiManager;
timer = NULL; // not started yet
timer = nullptr; // not started yet
}
//--------------- Constructor ---------------------------------
MonitoringDriver::~MonitoringDriver() {
stopTimer();
delete timer;
timer = NULL;
timer = nullptr;
}
//--------------- Constructor ---------------------------------
......
......@@ -47,11 +47,11 @@ MonitoringGuiManager::MonitoringGuiManager() {
MonitoringGuiManager::~MonitoringGuiManager() {
if (driver) {
delete driver;
driver = NULL;
driver = nullptr;
}
if (dialog) {
delete dialog;
dialog = NULL;
dialog = nullptr;
}
if (monitoringManager) {
delete monitoringManager;
......
......@@ -56,7 +56,7 @@ Atom::Atom ( PhysicalModel* p, const unsigned int ind, const double pos[3] ) {
//----------------------- Destructor -----------------------
Atom::~Atom() {
delete ( AtomProperties*) properties;
properties = NULL;
properties = nullptr;
}
//----------------------- setIndex -----------------------
......@@ -78,7 +78,7 @@ void Atom::xmlPrint ( std::ostream& o, const StructuralComponent* sc ) {
// because of the Structure::xmlPrint method has to be overriden
// depending on the structure who do the calls, two cases:
if ( properties->getPhysicalModel() != NULL && sc == properties->getPhysicalModel()->getAtoms() ) {
if ( properties->getPhysicalModel() != nullptr && sc == properties->getPhysicalModel()->getAtoms() ) {
// - if it is the physical model atom list: the atom print its properties
// print the atom and its properties
o << "<atom>" << std::endl;
......
......@@ -36,7 +36,7 @@
Cell::Cell (PhysicalModel* p, const StructureProperties::GeometricType t)
: StructuralComponent (p) {
this->Structure::properties = new CellProperties (p, t);
parentSC = NULL;
parentSC = nullptr;
}
Cell::Cell (PhysicalModel* p, physicalModel::Cell xmlCell, StructuralComponent* sc) : StructuralComponent (p) {
......@@ -126,7 +126,7 @@ Cell::~Cell() {
delete StructuralComponent::atomList;
}
StructuralComponent::atomList = NULL;
StructuralComponent::atomList = nullptr;
// delete all children
deleteAllStructures();
......@@ -376,7 +376,7 @@ StructuralComponent* Cell::getTriangleFaces() {
facets->addStructure (this);
return facets;
default :
return NULL;
return nullptr;
}
}
......@@ -449,7 +449,7 @@ StructuralComponent* Cell::getQuadFaces() {
facets->addStructure (this);
return facets;
default :
return NULL;
return nullptr;
}
}
......@@ -482,7 +482,7 @@ double* Cell::normal() {
return N;
}