]> Git trees. - libqmvoc.git/commitdiff
Read the number of nucleons from every isotope.
authorPino Toscano <pino@kde.org>
Sun, 19 Feb 2006 21:59:38 +0000 (21:59 +0000)
committerPino Toscano <pino@kde.org>
Sun, 19 Feb 2006 21:59:38 +0000 (21:59 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=511442

libscience/isotope.cpp
libscience/isotope.h
libscience/isotopeparser.cpp

index 05faf04a02c038d2dd9f47064c8e1c0483b29546..2e28e4ebc2be408d4251aacb4aa4f533d6a68618 100644 (file)
@@ -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;
+}
index bb40df31630f7b968933c9eaa99cc1c52fba8215..6c16be0dd49e326c3ea24dcd488ac64ac387a87a 100644 (file)
@@ -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
index e0c043f760b940a0c15d0e6b0a68a9c82466048c..c8b156eeec819cac62b6ca7b459cc9e6baa852f1 100644 (file)
@@ -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;