From 8058d32288f5c6c93fda6f34d637805dbc6712dd Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Tue, 18 Oct 2005 10:01:57 +0000 Subject: [PATCH] * Introducing ChemicalDataObject. Lets see if this new concept works out or not svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=471636 --- libscience/element.cpp | 17 ++++++ libscience/element.h | 105 +++++++++++++++++++++++++++++++++++ libscience/elementparser.cpp | 1 - libscience/elementparser.h | 43 +------------- 4 files changed, 124 insertions(+), 42 deletions(-) diff --git a/libscience/element.cpp b/libscience/element.cpp index f6a919c..f7cc6a8 100644 --- a/libscience/element.cpp +++ b/libscience/element.cpp @@ -28,6 +28,8 @@ #include #include +#include + Element::Element() { m_radioactive = false; @@ -266,3 +268,18 @@ double Element::radius( RADIUSTYPE type ) return 0.0; } + +ChemicalDataObject::ChemicalDataObject( QVariant v, BlueObelisk type ) +{ + m_value = v; + m_type = type; +}; + +ChemicalDataObject::ChemicalDataObject() +{ +} + +QString ChemicalDataObject::valueAsString() +{ + return m_value.toString(); +} diff --git a/libscience/element.h b/libscience/element.h index d0bb65f..0c88c40 100644 --- a/libscience/element.h +++ b/libscience/element.h @@ -22,6 +22,7 @@ #include #include +#include #include @@ -100,6 +101,10 @@ class Element{ return m_origin; } + /** + * The orbit of for example Lithium (Li) is "He 2s1" + * @return the orbital structure of the element + */ QString orbits() const{ return m_orbits; } @@ -478,5 +483,105 @@ class Element{ doubleList m_ionenergies; }; +/** + * @author Carsten Niehaus #include -#include ElementSaxParser::ElementSaxParser() : QXmlDefaultHandler(), currentElement_(0), diff --git a/libscience/elementparser.h b/libscience/elementparser.h index d3123ad..af1aa5b 100644 --- a/libscience/elementparser.h +++ b/libscience/elementparser.h @@ -13,51 +13,12 @@ * * ***************************************************************************/ -#include #include -#include -#include #include class Element; -//X /** -//X * This class gives access to the elements which are listed in a CML-file -//X * @author Carsten Niehaus -//X */ -//X class ElementParser -//X { -//X public: -//X /** -//X * @return the Element with the symbol symbol -//X * @param dataDocument the document to parse -//X * @param symbol the symbol of the Element which is looked for -//X */ -//X static Element* loadElement( const QString& symbol, const QDomDocument& dataDocument ); -//X -//X /** -//X * @return the element represented in the QDomeElement @p element -//X * @param element the XML-representation of the Element -//X */ -//X static Element* loadElement( const QDomElement& element ); -//X -//X /** -//X * @return all chemical elements in the xml-file -//X * @param dataDocument the document to parse -//X */ -//X static QList loadAllElements(const QDomDocument& dataDocument); -//X -//X private: -//X /** -//X * @return a QStringList with the symbols of all known elements -//X * @param dataDocument the document to parse -//X */ -//X static QStringList loadElementSymbols(const QDomDocument& dataDocument); -//X -//X }; - - class ElementSaxParser : public QXmlDefaultHandler { public: @@ -76,7 +37,7 @@ class ElementSaxParser : public QXmlDefaultHandler bool inElement_; bool inName_, inMass_, - inSymbol_, - inAtomicNumber_; + inAtomicNumber_, + inSymbol_; }; #endif // ELEMENTPARSER_H -- 2.47.3