]> Git trees. - libqmvoc.git/commitdiff
support the new dataset discoverCountry
authorCarsten Niehaus <cniehaus@gmx.de>
Sun, 3 Sep 2006 11:49:10 +0000 (11:49 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sun, 3 Sep 2006 11:49:10 +0000 (11:49 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=580381

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

index edd303f33375bb0bae10e1f5aac48fdd335b12bf..76f7f3ac24ced21a579d4cfe0be088ad576d23a1 100644 (file)
@@ -233,6 +233,9 @@ QString ChemicalDataObject::dictRef() const
                case SPhrase:
                        botype ="SPhrase";
                        break;
+               case discoveryCountry:
+                       botype ="discoveryCountry";
+                       break;
        }
 
        botype = botype.prepend( "bo:" );
index fdb9bddc00f7c4b5add48b1dbb2933648927527c..1e66200246b66854afc621d775cf0fbc90215f64 100644 (file)
@@ -84,7 +84,8 @@ class EDUSCIENCE_EXPORT ChemicalDataObject
                        ecDecay/**< The decayenergy of ecminusdecay in MeV */,
                        dangerSymbol/**< the danger symbols are the dangers associated with an element, for example Xn,T+ */,
                        RPhrase/**< */,
-                       SPhrase/**< */
+                       SPhrase/**< */,
+      discoveryCountry
                };
 
                /**
index eb07bf51cfdf2865904adae4e3c7ddd217a1949e..80e06fbdf97b7d197328611e37f99367d345e079 100644 (file)
@@ -50,7 +50,8 @@ class ElementSaxParser::Private
             inDensity( false ),
             inDangerSymbol( false ),
             inRPhrase( false ),
-            inSPhrase( false )
+            inSPhrase( false ),
+            inCountry( false )
     {
     }
 
@@ -87,6 +88,7 @@ class ElementSaxParser::Private
         bool inDangerSymbol;
         bool inRPhrase;
         bool inSPhrase;
+        bool inCountry;
 };
 
     ElementSaxParser::ElementSaxParser()
@@ -105,7 +107,7 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co
     {
         d->currentElement = new Element();
         d->inElement = true;
-    } else if (d->inElement && localName == "scalar")
+    } else if (d->inElement && localName == "scalar" || localName == "array" )
     {
         for (int i = 0; i < attrs.length(); ++i) 
         {
@@ -143,6 +145,8 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co
                 d->inDiscoveryDate = true;
             else if (attrs.value(i) == "bo:discoverers")
                 d->inDiscoverers = true;
+            else if (attrs.value(i) == "bo:discoveryCountry")
+                d->inCountry = true;
             else if (attrs.value(i) == "bo:period")
                 d->inPeriod = true;
             else if (attrs.value(i) == "bo:crystalstructure")
@@ -347,6 +351,11 @@ bool ElementSaxParser::characters(const QString &ch)
         type = ChemicalDataObject::SPhrase; 
         d->inSPhrase = false;
     }
+    else if (d->inCountry){
+        value = ch;
+        type = ChemicalDataObject::discoveryCountry; 
+        d->inCountry = false;
+    }
     else//it is a non known value. Do not create a wrong object but return
         return true;