Changeset View
Changeset View
Standalone View
Standalone View
libscience/spectrumparser.cpp
Show All 17 Lines | |||||
18 | #include <QList> | 18 | #include <QList> | ||
19 | #include <QFile> | 19 | #include <QFile> | ||
20 | #include <QDebug> | 20 | #include <QDebug> | ||
21 | 21 | | |||
22 | class SpectrumParser::Private | 22 | class SpectrumParser::Private | ||
23 | { | 23 | { | ||
24 | public: | 24 | public: | ||
25 | Private() | 25 | Private() | ||
26 | : currentSpectrum(0), | 26 | : currentSpectrum(nullptr), | ||
27 | inMetadata_(false), | 27 | inMetadata_(false), | ||
28 | inSpectrum_(false), | 28 | inSpectrum_(false), | ||
29 | inSpectrumList_(false), | 29 | inSpectrumList_(false), | ||
30 | inPeakList_(false), | 30 | inPeakList_(false), | ||
31 | inPeak_(false) | 31 | inPeak_(false) | ||
32 | {} | 32 | {} | ||
33 | 33 | | |||
34 | ~Private() | 34 | ~Private() | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
95 | bool SpectrumParser::endElement(const QString&, const QString& localName, const QString &) | 95 | bool SpectrumParser::endElement(const QString&, const QString& localName, const QString &) | ||
96 | { | 96 | { | ||
97 | if (localName == "spectrum") { | 97 | if (localName == "spectrum") { | ||
98 | int num = currentElementID.mid(1).toInt(); | 98 | int num = currentElementID.mid(1).toInt(); | ||
99 | d->currentSpectrum->setParentElementNumber(num); | 99 | d->currentSpectrum->setParentElementNumber(num); | ||
100 | 100 | | |||
101 | d->spectra.append(d->currentSpectrum); | 101 | d->spectra.append(d->currentSpectrum); | ||
102 | 102 | | |||
103 | d->currentSpectrum = 0; | 103 | d->currentSpectrum = nullptr; | ||
104 | d->inSpectrum_ = false; | 104 | d->inSpectrum_ = false; | ||
105 | } else if (localName == "peakList") { | 105 | } else if (localName == "peakList") { | ||
106 | d->inSpectrumList_ = false; | 106 | d->inSpectrumList_ = false; | ||
107 | } else if (localName == "peak") { | 107 | } else if (localName == "peak") { | ||
108 | //X qDebug() << "in 'peak'" << " with this data: " << d->currentPeak->intensity << " (intesity)" ; | 108 | //X qDebug() << "in 'peak'" << " with this data: " << d->currentPeak->intensity << " (intesity)" ; | ||
109 | d->currentSpectrum->addPeak(d->currentPeak); | 109 | d->currentSpectrum->addPeak(d->currentPeak); | ||
110 | d->currentPeak = 0; | 110 | d->currentPeak = nullptr; | ||
111 | d->inPeak_ = false; | 111 | d->inPeak_ = false; | ||
112 | } | 112 | } | ||
113 | return true; | 113 | return true; | ||
114 | } | 114 | } | ||
115 | 115 | | |||
116 | bool SpectrumParser::characters(const QString &ch) | 116 | bool SpectrumParser::characters(const QString &ch) | ||
117 | { | 117 | { | ||
118 | Q_UNUSED(ch) | 118 | Q_UNUSED(ch) | ||
119 | return true; | 119 | return true; | ||
120 | } | 120 | } | ||
121 | 121 | | |||
122 | QList<Spectrum*> SpectrumParser::getSpectrums() | 122 | QList<Spectrum*> SpectrumParser::getSpectrums() | ||
123 | { | 123 | { | ||
124 | return d->spectra; | 124 | return d->spectra; | ||
125 | } | 125 | } |