From: Pino Toscano Date: Sat, 29 Oct 2005 23:31:08 +0000 (+0000) Subject: puts the parent element symbol as ChemicalDataObject too X-Git-Tag: v3.80.2~244 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=44b818f1ec9ffc1d8f88e8fa097ae20018add021;p=libqmvoc.git puts the parent element symbol as ChemicalDataObject too svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=475643 --- diff --git a/libscience/isotope.cpp b/libscience/isotope.cpp index 8c3badf..9ee1de9 100644 --- a/libscience/isotope.cpp +++ b/libscience/isotope.cpp @@ -28,11 +28,11 @@ Isotope::Isotope() { } -Isotope::Isotope( ChemicalDataObject* mass, - ChemicalDataObject* ID ) +Isotope::Isotope( ChemicalDataObject* mass, ChemicalDataObject* ID ) + : m_mass( 0 ), m_identifier( 0 ) { - m_mass = mass; - m_identifier = ID; + addData( mass ); + addData( ID ); } Isotope::~Isotope(){} @@ -49,8 +49,8 @@ void Isotope::addData( ChemicalDataObject* o ) m_mass = o; else if ( o->type() == ChemicalDataObject::atomicNumber ) m_identifier = o; - - return; + else if ( o->type() == ChemicalDataObject::symbol ) + m_parentElementSymbol = o; } double Isotope::mass() const @@ -70,10 +70,5 @@ int Isotope::parentElementNumber() const QString Isotope::parentElementSymbol() const { - return m_parentElementSymbol; -} - -void Isotope::setParentSymbol( const QString& symbol ) -{ - m_parentElementSymbol = symbol; + return m_parentElementSymbol->value().toString(); } diff --git a/libscience/isotope.h b/libscience/isotope.h index 6396bc7..fe19d1e 100644 --- a/libscience/isotope.h +++ b/libscience/isotope.h @@ -48,13 +48,11 @@ class Isotope void addData( ChemicalDataObject* o ); - void setParentSymbol( const QString& symbol ); - private: /** * the symbol of the element the isotope belongs to */ - QString m_parentElementSymbol; + ChemicalDataObject* m_parentElementSymbol; /** * stores the infomation about the mass of the Isotope diff --git a/libscience/isotopeparser.cpp b/libscience/isotopeparser.cpp index c540990..5345bea 100644 --- a/libscience/isotopeparser.cpp +++ b/libscience/isotopeparser.cpp @@ -69,7 +69,7 @@ bool IsotopeParser::endElement( const QString&, const QString& localName, const { if ( localName == "isotope" ) { - currentIsotope_->setParentSymbol( currentElementSymbol_ ); + currentIsotope_->addData( new ChemicalDataObject( QVariant( currentElementSymbol_ ), ChemicalDataObject::symbol ) ); isotopes_.append(currentIsotope_); currentIsotope_ = 0;