]> Git trees. - libqmvoc.git/commitdiff
Preparing for density
authorCarsten Niehaus <cniehaus@gmx.de>
Wed, 4 Jan 2006 12:28:08 +0000 (12:28 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Wed, 4 Jan 2006 12:28:08 +0000 (12:28 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=494249

libscience/chemicaldataobject.cpp
libscience/chemicaldataobject.h
libscience/elementparser.cpp

index 860faf1fb4bdc98092547cbf8dbb1ac101e2367b..ce02cafd6971d8b0bf870ef9528915c4f0979373 100644 (file)
@@ -212,6 +212,9 @@ QString ChemicalDataObject::dictRef() const
                case crystalstructure:
                        botype ="crystalstructure";
                        break;
+               case density:
+                       botype ="density";
+                       break;
        }
 
        botype = botype.prepend( "bo:" );
index ea9ccd5fe814874f14792fc563e67d7ed8097938..09ecb7b2ab260b33143481e0874fc994e93ecd74 100644 (file)
@@ -62,6 +62,7 @@ class ChemicalDataObject
                        crystalstructure/**< own, bcc, hdp, ccp, hcp, fcc, d, sc, tet, rh, or, mono*/,
                        electronicConfiguration/**< the electronic configuration, for example 1s2 for He*/,
                        group/**< This is a value between 1 and 8*/,
+                       density/**< The density */,
                        nameOrigin/**< the origin of the name */,
                        orbit/**< the quantumorbit of the element */,
                        period/**< the period of the element */,
index 9058cc366e65f9049e2e1416f28c39f12d82a64e..f23033b0259a5ac914122fa76984313e565863aa 100644 (file)
@@ -46,7 +46,8 @@ public:
        inAcidicbehaviour( false ),
        inFamily( false ),
        inGroup( false ),
-       inElectronicconfiguration( false )
+       inElectronicconfiguration( false ),
+       inDensity( false )
        {
        }
 
@@ -79,6 +80,7 @@ public:
        bool inFamily;
        bool inGroup;
        bool inElectronicconfiguration;
+       bool inDensity;
 };
 
 ElementSaxParser::ElementSaxParser()
@@ -151,6 +153,8 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co
                                d->inGroup = true;
                        else if (attrs.value(i) == "bo:electronicConfiguration")
                                d->inElectronicconfiguration = true;
+                       else if (attrs.value(i) == "bo:density")
+                               d->inDensity = true;
                }
        }
        return true;
@@ -293,6 +297,11 @@ bool ElementSaxParser::characters(const QString &ch)
                type = ChemicalDataObject::electronicConfiguration; 
                d->inElectronicconfiguration = false;
        }
+       else if (d->inDensity){
+               value = ch.toDouble();
+               type = ChemicalDataObject::density; 
+               d->inDensity = false;
+       }
        else//it is a non known value. Do not create a wrong object but return
                return true;