From ea2975ed10ee33b7750ebf534e58a05ae3162aa2 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 27 Oct 2005 15:01:05 +0000 Subject: [PATCH] read the info about the discoverers of an element svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=474890 --- libscience/chemicaldataobject.cpp | 4 ++-- libscience/chemicaldataobject.h | 2 +- libscience/elementparser.cpp | 8 ++++++++ libscience/elementparser.h | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libscience/chemicaldataobject.cpp b/libscience/chemicaldataobject.cpp index 347d1c9..5719ca4 100644 --- a/libscience/chemicaldataobject.cpp +++ b/libscience/chemicaldataobject.cpp @@ -188,8 +188,8 @@ QString ChemicalDataObject::dictRef() const case date: botype = "date"; break; - case discoverer: - botype = "discoverer"; + case discoverers: + botype = "discoverers"; break; case period: botype = "period"; diff --git a/libscience/chemicaldataobject.h b/libscience/chemicaldataobject.h index baeb344..7bebebd 100644 --- a/libscience/chemicaldataobject.h +++ b/libscience/chemicaldataobject.h @@ -61,7 +61,7 @@ class ChemicalDataObject orbit/**< the quantumorbit of the element */, period/**< the period of the element */, date/**< date of discovery of the element. When 0, the element has been known in ancient times. */, - discoverer/** The name of the discoverer(s) */, + discoverers/** The name of the discoverers, separated by semicolomns */, relativeAbundance/** The abundance, relative to 100 */ }; diff --git a/libscience/elementparser.cpp b/libscience/elementparser.cpp index 8f34809..bc888f3 100644 --- a/libscience/elementparser.cpp +++ b/libscience/elementparser.cpp @@ -37,6 +37,7 @@ ElementSaxParser::ElementSaxParser() inPeriodTableBlock_(false), inNameOrigin_(false), inDiscoveryDate_(false), + inDiscoverers_(false), inPeriod_(false) { } @@ -87,6 +88,8 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co inNameOrigin_ = true; else if (attrs.value(i) == "bo:discoveryDate") inDiscoveryDate_ = true; + else if (attrs.value(i) == "bo:discoverers") + inDiscoverers_ = true; else if (attrs.value(i) == "bo:period") inPeriod_ = true; } @@ -196,6 +199,11 @@ bool ElementSaxParser::characters(const QString &ch) type = ChemicalDataObject::date; inDiscoveryDate_ = false; } + else if (inDiscoverers_) { + value = ch; + type = ChemicalDataObject::discoverers; + inDiscoverers_ = false; + } else if (inPeriod_) { value = ch.toInt(); type = ChemicalDataObject::period; diff --git a/libscience/elementparser.h b/libscience/elementparser.h index 02e3051..655b880 100644 --- a/libscience/elementparser.h +++ b/libscience/elementparser.h @@ -62,6 +62,7 @@ class ElementSaxParser : public QXmlDefaultHandler inPeriodTableBlock_, inNameOrigin_, inDiscoveryDate_, + inDiscoverers_, inPeriod_; }; #endif // ELEMENTPARSER_H -- 2.47.3