]> Git trees. - libqmvoc.git/commitdiff
make getting of data easier
authorMartin Pfeiffer <hubipete@gmx.net>
Wed, 19 Oct 2005 13:07:34 +0000 (13:07 +0000)
committerMartin Pfeiffer <hubipete@gmx.net>
Wed, 19 Oct 2005 13:07:34 +0000 (13:07 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=471988

libscience/element.cpp
libscience/element.h

index eb116c6a6be0a21c38311e92aba49f8a87874d69..d3d7ba156e7e5c3dd52630759b18b7753da98582 100644 (file)
@@ -46,6 +46,14 @@ ChemicalDataObject& Element::data(ChemicalDataObject::BlueObelisk type)
        }
 }
 
+QVariant Element::dataAsVariant( ChemicalDataObject::BlueObelisk type )
+{
+       foreach( ChemicalDataObject* o, dataList ) {
+               if ( o->type() == type )
+                       return o->value();
+       }
+}
+
 QString Element::dataAsString(ChemicalDataObject::BlueObelisk type)
 {
        foreach( ChemicalDataObject*o, dataList ) {
index e21c75a4395369245fe303af869568cdb94fbeab..37caae2c27d8d251e9c5c7a43c91ca70852462d0 100644 (file)
@@ -78,9 +78,9 @@ class Element{
                /**
                 * @return the number of the element
                 */
-               int number() const {
+/*             int number() const {
                        return m_number;
-               }
+               }*/
 
                /**
                 * @return if the Element is radioactive
@@ -111,7 +111,7 @@ class Element{
                        return m_orbits;
                }
                
-               void setMass( double value ) { m_mass = value; }
+//             void setMass( double value ) { m_mass = value; }
                void setEN( double value ) { m_EN = value; }
                void setEA( double value ) { m_EA = value; }
                void setMeltingpoint( double value ) { m_MP = value; }
@@ -133,7 +133,7 @@ class Element{
                void setDate( int date ) { m_date = date; }
                void setPeriod( int period ){ m_period = period; }
                void setBiologicalMeaning( int value ) { m_biological = value; }
-               void setNumber( int num ){ m_number = num; }
+//             void setNumber( int num ){ m_number = num; }
 
                /**
                 * set the abundance in crustal rocks [pm]
@@ -355,9 +355,9 @@ class Element{
                /**
                 * @return the atomic mass of the element in units
                 */
-               double mass() const {
+/*             double mass() const {
                        return m_mass;
-               }
+               }*/
                
                /**
                 * @return the density of the element in gramms per mol
@@ -437,12 +437,24 @@ class Element{
                        dataList.append( o );
                }
 
+               /**
+                * add a ChemicalDataObject with @p value of @p type  to this Element
+                * @param value the QVariant to be added
+                * @param type the BlueObelisk type to be added
+                */
+               void addData( const QVariant& value, ChemicalDataObject::BlueObelisk type ) {
+                       ChemicalDataObject* tmp = new ChemicalDataObject( value, type );
+                       dataList.append( tmp );
+               }
+
                /**
                 * @return the ChemicalDataObject which stores the information
                 * of the type @p type
                 * @param type the type of the requested data
                 */
                ChemicalDataObject& data( ChemicalDataObject::BlueObelisk type );
+
+               QVariant dataAsVariant( ChemicalDataObject::BlueObelisk type );
                
                /**
                 * @return the requested data of the type @p type as a QString