From: Pino Toscano Date: Sun, 19 Feb 2006 21:59:38 +0000 (+0000) Subject: Read the number of nucleons from every isotope. X-Git-Tag: v3.80.2~165 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=3e06ed04fe8bba70da452cb618cb75742ad50af8;p=libqmvoc.git Read the number of nucleons from every isotope. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=511442 --- diff --git a/libscience/isotope.cpp b/libscience/isotope.cpp index 05faf04..2e28e4e 100644 --- a/libscience/isotope.cpp +++ b/libscience/isotope.cpp @@ -94,3 +94,13 @@ QString Isotope::parentElementSymbol() const { return m_parentElementSymbol ? m_parentElementSymbol->value().toString() : QString(); } + +void Isotope::setNucleons( int number ) +{ + m_nucleons = number; +} + +int Isotope::nucleons() const +{ + return m_nucleons; +} diff --git a/libscience/isotope.h b/libscience/isotope.h index bb40df3..6c16be0 100644 --- a/libscience/isotope.h +++ b/libscience/isotope.h @@ -54,6 +54,9 @@ class Isotope void addData( ChemicalDataObject* o ); + void setNucleons( int number ); + int nucleons() const; + private: /** * the symbol of the element the isotope belongs to @@ -85,6 +88,7 @@ class Isotope */ ChemicalDataObject* m_halflife; + int m_nucleons; }; #endif // ISOTOPE_H diff --git a/libscience/isotopeparser.cpp b/libscience/isotopeparser.cpp index e0c043f..c8b156e 100644 --- a/libscience/isotopeparser.cpp +++ b/libscience/isotopeparser.cpp @@ -102,6 +102,11 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const //X kDebug() << "setting inIsotope true!" << endl; d->currentIsotope = new Isotope(); d->inIsotope = true; + for (int i = 0; i < attrs.length(); ++i) + { + if ( attrs.localName( i ) == "number" ) + d->currentIsotope->setNucleons( attrs.value( i ).toInt() ); + } } else if (d->inIsotope && localName == "bo:spin") { //X kDebug() << "bo:spin" << endl; d->inSpin = true;