From 8b342f7c148383099fe25df857815477c961c9d6 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Tue, 3 Jan 2006 14:36:08 +0000 Subject: [PATCH] * load the new data svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=493866 --- libscience/chemicaldataobject.cpp | 21 +++++++++++++- libscience/chemicaldataobject.h | 4 +++ libscience/elementparser.cpp | 47 ++++++++++++++++++++++++++++++- libscience/tests/Makefile.am | 12 ++++---- 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/libscience/chemicaldataobject.cpp b/libscience/chemicaldataobject.cpp index 5719ca4..860faf1 100644 --- a/libscience/chemicaldataobject.cpp +++ b/libscience/chemicaldataobject.cpp @@ -197,8 +197,23 @@ QString ChemicalDataObject::dictRef() const case relativeAbundance: botype = "relativeAbundance"; break; + case family: + botype ="family"; + break; + case group: + botype ="group"; + break; + case acidicbehaviour: + botype ="acidicbehaviour"; + break; + case electronicConfiguration: + botype ="electronicConfiguration"; + break; + case crystalstructure: + botype ="crystalstructure"; + break; } - + botype = botype.prepend( "bo:" ); return botype; @@ -222,6 +237,10 @@ QString ChemicalDataObject::unitAsString() const break; case noUnit: return "noUnit"; + case y: + return "y"; + case s: + return "s"; } bounit = bounit.prepend( "bo:" ); diff --git a/libscience/chemicaldataobject.h b/libscience/chemicaldataobject.h index 008779b..7a988e9 100644 --- a/libscience/chemicaldataobject.h +++ b/libscience/chemicaldataobject.h @@ -58,6 +58,10 @@ class ChemicalDataObject boilingpoint/**< the boilingpoint */, periodTableBlock/**< the block of the element */, family/** "Noblegas" "Non-Metal" "Rare_Earth" "Alkaline_Earth" "Alkali_Earth" "Transition" "Other_Metal" "Metalloids" "Halogene" */, + group, + crystalstructure, + electronicConfiguration, + acidicbehaviour, nameOrigin/**< the origin of the name */, orbit/**< the quantumorbit of the element */, period/**< the period of the element */, diff --git a/libscience/elementparser.cpp b/libscience/elementparser.cpp index 39ecc25..9058cc3 100644 --- a/libscience/elementparser.cpp +++ b/libscience/elementparser.cpp @@ -41,7 +41,12 @@ public: inNameOrigin(false), inDiscoveryDate(false), inDiscoverers(false), - inPeriod(false) + inPeriod(false), + inCrystalstructure( false ), + inAcidicbehaviour( false ), + inFamily( false ), + inGroup( false ), + inElectronicconfiguration( false ) { } @@ -69,6 +74,11 @@ public: bool inDiscoveryDate; bool inDiscoverers; bool inPeriod; + bool inCrystalstructure; + bool inAcidicbehaviour; + bool inFamily; + bool inGroup; + bool inElectronicconfiguration; }; ElementSaxParser::ElementSaxParser() @@ -131,6 +141,16 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co d->inDiscoverers = true; else if (attrs.value(i) == "bo:period") d->inPeriod = true; + else if (attrs.value(i) == "bo:crystalstructure") + d->inCrystalstructure = true; + else if (attrs.value(i) == "bo:acidicbehaviour") + d->inAcidicbehaviour = true; + else if (attrs.value(i) == "bo:family") + d->inFamily = true; + else if (attrs.value(i) == "bo:group") + d->inGroup = true; + else if (attrs.value(i) == "bo:electronicConfiguration") + d->inElectronicconfiguration = true; } } return true; @@ -248,6 +268,31 @@ bool ElementSaxParser::characters(const QString &ch) type = ChemicalDataObject::period; d->inPeriod = false; } + else if (d->inCrystalstructure) { + value = ch; + type = ChemicalDataObject::crystalstructure; + d->inCrystalstructure = false; + } + else if (d->inAcidicbehaviour) { + value = ch.toInt(); + type = ChemicalDataObject::acidicbehaviour; + d->inAcidicbehaviour = false; + } + else if (d->inFamily) { + value = ch; + type = ChemicalDataObject::family; + d->inFamily = false; + } + else if (d->inGroup) { + value = ch.toInt(); + type = ChemicalDataObject::group; + d->inGroup = false; + } + else if (d->inElectronicconfiguration) { + value = ch; + type = ChemicalDataObject::electronicConfiguration; + d->inElectronicconfiguration = false; + } else//it is a non known value. Do not create a wrong object but return return true; diff --git a/libscience/tests/Makefile.am b/libscience/tests/Makefile.am index 41849be..e78896f 100644 --- a/libscience/tests/Makefile.am +++ b/libscience/tests/Makefile.am @@ -8,11 +8,11 @@ xmlreadingtest_SOURCES = xmlreadingtest.cpp xmlreadingtest_LDFLAGS = $(all_libraries) xmlreadingtest_LDADD = ../libscience.la -isotopereadingtest_SOURCES = isotopereadingtest.cpp -isotopereadingtest_LDFLAGS = $(all_libraries) -isotopereadingtest_LDADD = ../libscience.la +#isotopereadingtest_SOURCES = isotopereadingtest.cpp +#isotopereadingtest_LDFLAGS = $(all_libraries) +#isotopereadingtest_LDADD = ../libscience.la -cmlspectest_SOURCES = cmlspectest.cpp -cmlspectest_LDFLAGS = $(all_libraries) -cmlspectest_LDADD = ../libscience.la +#cmlspectest_SOURCES = cmlspectest.cpp +#cmlspectest_LDFLAGS = $(all_libraries) +#cmlspectest_LDADD = ../libscience.la METASOURCES = AUTO -- 2.47.3