Commit 6c4e9648 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to for(...:...) + use nullptr

parent 419b2e4e
Pipeline #118980 passed with stage
in 1 minute and 28 seconds
......@@ -57,7 +57,7 @@ public:
ChemicalDataObject currentDataObject;
int currentUnit; // KUnitConversion::UnitId
Element *currentElement;
Element *currentElement = nullptr;
QList<Element*> elements;
......
......@@ -17,7 +17,7 @@ double Spectrum::minPeak()
{
double value = m_peaklist.first()->wavelength;
foreach (peak *p, m_peaklist) {
for (peak *p : std::as_const(m_peaklist)) {
if (value > p->wavelength) {
value = p->wavelength;
}
......@@ -35,7 +35,7 @@ double Spectrum::maxPeak()
{
double value = m_peaklist.first()->wavelength;
foreach (peak * p, m_peaklist) {
for (peak *p : std::as_const(m_peaklist)) {
if (value < p->wavelength) {
value = p->wavelength;
}
......@@ -54,7 +54,7 @@ Spectrum* Spectrum::adjustToWavelength(double min, double max)
{
Spectrum *spec = new Spectrum();
foreach (peak * p , m_peaklist) {
for (peak *p : std::as_const(m_peaklist)) {
if (p->wavelength >= min || p->wavelength <= max) {
spec->addPeak(p);
}
......@@ -67,7 +67,7 @@ void Spectrum::adjustIntensities()
{
int maxInt = 0;
//find the highest intensity
foreach (Spectrum::peak * p, m_peaklist) {
for (peak *p : std::as_const(m_peaklist)) {
if (p->intensity > maxInt) {
maxInt = p->intensity;
}
......@@ -79,7 +79,7 @@ void Spectrum::adjustIntensities()
}
//now adjust the intensities.
foreach (Spectrum::peak *p, m_peaklist) {
for (peak *p : std::as_const(m_peaklist)) {
double newInt = p->intensity * 1000 / maxInt;
p->intensity = (int)qRound(newInt);
......@@ -90,7 +90,7 @@ QList<double> Spectrum::wavelengths(double min, double max)
{
QList<double> list;
foreach (peak * p , m_peaklist) {
for (peak *p : std::as_const(m_peaklist)) {
if (p->wavelength >= min || p->wavelength <= max) {
list.append(p->wavelength);
}
......
......@@ -29,8 +29,8 @@ public:
delete currentPeak;
}
Spectrum * currentSpectrum;
Spectrum::peak * currentPeak;
Spectrum * currentSpectrum = nullptr;
Spectrum::peak * currentPeak = nullptr;
bool inMetadata_;
bool inSpectrum_;
......
......@@ -37,7 +37,6 @@ KalziumDataObject* KalziumDataObject::instance()
}
KalziumDataObject::KalziumDataObject()
: m_search(nullptr)
{
// reading elements
ElementSaxParser * parser = new ElementSaxParser();
......
......@@ -115,7 +115,7 @@ private:
*/
int m_numOfElements;
Search *m_search;
Search *m_search = nullptr;
friend struct StaticKalziumDataObject;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment