From: Carsten Niehaus Date: Sat, 29 Oct 2005 23:02:16 +0000 (+0000) Subject: abundance X-Git-Tag: v3.80.2~246 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=387837cb74ac5105caa494c80d994404268a307e;p=libqmvoc.git abundance svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=475636 --- diff --git a/libscience/isotopeparser.cpp b/libscience/isotopeparser.cpp index 3aecc9c..c540990 100644 --- a/libscience/isotopeparser.cpp +++ b/libscience/isotopeparser.cpp @@ -24,7 +24,8 @@ IsotopeParser::IsotopeParser() : QXmlDefaultHandler(), currentIsotope_(0), inAtomicNumber_(false), - inExactMass_(false) + inExactMass_(false), + inAbundance_(false) { currentElementSymbol_ = ""; } @@ -46,7 +47,6 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const { for (int i = 0; i < attrs.length(); ++i) { - if ( attrs.localName( i ) == "errorValue" ) { currentErrorValue_ = QVariant( attrs.value( i ) ); @@ -58,6 +58,9 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const else if (attrs.value(i) == "bo:exactMass") inExactMass_ = true; } + } else if (inIsotope_ && localName == "bo:relativeAbundance") { + kdDebug() << "bo:relativeAbundance" << endl; + inAbundance_ = true; } return true; } @@ -99,6 +102,11 @@ bool IsotopeParser::characters(const QString &ch) type = ChemicalDataObject::atomicNumber; inAtomicNumber_ = false; } + else if ( inAbundance_ ){ + value = ch; + type = ChemicalDataObject::relativeAbundance; + inAbundance_ = false; + } else//it is a non known value. Do not create a wrong object but return return true; diff --git a/libscience/isotopeparser.h b/libscience/isotopeparser.h index ea6e800..d8301d1 100644 --- a/libscience/isotopeparser.h +++ b/libscience/isotopeparser.h @@ -52,6 +52,8 @@ class IsotopeParser : public QXmlDefaultHandler bool inIsotope_; bool inAtomicNumber_, inExactMass_; + + bool inAbundance_; }; #endif // ISOTOPEPARSER_H diff --git a/libscience/tests/isotopereadingtest.cpp b/libscience/tests/isotopereadingtest.cpp index 8549860..92bc7d5 100644 --- a/libscience/tests/isotopereadingtest.cpp +++ b/libscience/tests/isotopereadingtest.cpp @@ -27,7 +27,6 @@ int main(int argc, char *argv[]) { ChemicalDataObject* o = e->data(); kdDebug() << "Name: " << o->dictRef() << " " << o->valueAsString() << " errorMargin: " << e->errorMargin() << " parent Element: " << e->parentElementSymbol() << endl; - } }