16 #include <kunitconversion/converter.h> 
   22 class ElementSaxParser::Private
 
   26             : currentUnit(KUnitConversion::NoUnit),
 
   32             inAtomicNumber(false),
 
   35             inElectronAffinity(false),
 
   36             inElectronegativityPauling(false),
 
   37             inRadiusCovalent(false),
 
   39             inBoilingPoint(false),
 
   40             inMeltingPoint(false),
 
   41             inPeriodTableBlock(false),
 
   43             inDiscoveryDate(false),
 
   46             inCrystalstructure( false ),
 
   47             inAcidicbehaviour( false ),
 
   50             inElectronicconfiguration( false ),
 
   51             inDangerSymbol( false ),
 
   60         delete currentElement;
 
   77     bool inElectronAffinity;
 
   78     bool inElectronegativityPauling;
 
   79     bool inRadiusCovalent;
 
   83     bool inPeriodTableBlock;
 
   88     bool inCrystalstructure;
 
   89     bool inAcidicbehaviour;
 
   92     bool inElectronicconfiguration;
 
  112     if (localName == 
"atom")
 
  114         d->currentElement = 
new Element();
 
  116     } 
else if ( ( d->inElement && localName == 
"scalar" ) || localName == 
"array" )
 
  118         for (
int i = 0; i < attrs.
length(); ++i)
 
  123                 d->currentUnit = unit( attrs.
value( i ) );
 
  128             if (attrs.
value(i) == 
"bo:atomicNumber")
 
  129                 d->inAtomicNumber = 
true;
 
  130             else if (attrs.
value(i) == 
"bo:mass")
 
  132             else if (attrs.
value(i) == 
"bo:exactMass")
 
  133                 d->inExactMass = 
true;
 
  134             else if (attrs.
value(i) == 
"bo:ionization")
 
  135                 d->inIonization = 
true;
 
  136             else if (attrs.
value(i) == 
"bo:electronAffinity")
 
  137                 d->inElectronAffinity = 
true;
 
  138             else if (attrs.
value(i) == 
"bo:electronegativityPauling")
 
  139                 d->inElectronegativityPauling = 
true;
 
  140             else if (attrs.
value(i) == 
"bo:radiusCovalent")
 
  141                 d->inRadiusCovalent = 
true;
 
  142             else if (attrs.
value(i) == 
"bo:radiusVDW")
 
  143                 d->inRadiusVDW = 
true;
 
  144             else if (attrs.
value(i) == 
"bo:meltingpoint")
 
  145                 d->inMeltingPoint = 
true;
 
  146             else if (attrs.
value(i) == 
"bo:boilingpoint")
 
  147                 d->inBoilingPoint = 
true;
 
  148             else if (attrs.
value(i) == 
"bo:periodTableBlock")
 
  149                 d->inPeriodTableBlock = 
true;
 
  150             else if (attrs.
value(i) == 
"bo:nameOrigin")
 
  151                 d->inNameOrigin = 
true;
 
  152             else if (attrs.
value(i) == 
"bo:discoveryDate")
 
  153                 d->inDiscoveryDate = 
true;
 
  154             else if (attrs.
value(i) == 
"bo:discoverers")
 
  155                 d->inDiscoverers = 
true;
 
  156             else if (attrs.
value(i) == 
"bo:discoveryCountry")
 
  158             else if (attrs.
value(i) == 
"bo:period")
 
  160             else if (attrs.
value(i) == 
"bo:crystalstructure")
 
  161                 d->inCrystalstructure = 
true;
 
  162             else if (attrs.
value(i) == 
"bo:acidicbehaviour")
 
  163                 d->inAcidicbehaviour = 
true;
 
  164             else if (attrs.
value(i) == 
"bo:family")
 
  166             else if (attrs.
value(i) == 
"bo:group")
 
  168             else if (attrs.
value(i) == 
"bo:electronicConfiguration")
 
  169                 d->inElectronicconfiguration = 
true;
 
  170             else if (attrs.
value(i) == 
"bo:dangerSymbol")
 
  171                 d->inDangerSymbol = 
true;
 
  172             else if (attrs.
value(i) == 
"bo:RPhrase")
 
  174             else if (attrs.
value(i) == 
"bo:SPhrase")
 
  176             else if (attrs.
value(i) == 
"bo:oxidation")
 
  177                 d->inOxidation = 
true;
 
  179     } 
else if (d->inElement && localName == 
"label")
 
  181         for (
int i = 0; i < attrs.
length(); ++i)
 
  186             if (attrs.
value(i) == 
"bo:symbol") {
 
  187                 for (
int i = 0; i < attrs.
length(); ++i)
 
  190                         d->currentDataObject.setData( attrs.
value(i) );
 
  193                         if ( d->currentElement )
 
  194                             d->currentElement->addData( d->currentDataObject );
 
  198             else if ( attrs.
value(i) == 
"bo:name" ) {
 
  199                 for (
int i = 0; i < attrs.
length(); ++i)
 
  202                         d->currentDataObject.setData( i18n( attrs.
value(i).
toUtf8() ) );
 
  205                         if ( d->currentElement )
 
  206                             d->currentElement->addData( d->currentDataObject );
 
  217     if ( localName == 
"atom" )
 
  220             d->elements.append(d->currentElement);
 
  222             delete d->currentElement;
 
  224         d->currentElement = 0;
 
  225         d->inElement = 
false;
 
  227     else if ( localName == 
"scalar" || localName == 
"label" || localName == 
"array" )
 
  229         d->currentDataObject.setUnit( d->currentUnit );
 
  245     else if (d->inExactMass) {
 
  248         d->inExactMass = 
false;
 
  250     else if (d->inAtomicNumber) {
 
  253         d->inAtomicNumber = 
false;
 
  255     else if (d->inIonization) {
 
  258         d->inIonization = 
false;
 
  260     else if (d->inElectronAffinity) {
 
  263         d->inElectronAffinity = 
false;
 
  265     else if (d->inElectronegativityPauling) {
 
  268         d->inElectronegativityPauling = 
false;
 
  270     else if (d->inRadiusCovalent) {
 
  273         d->inRadiusCovalent = 
false;
 
  275     else if (d->inRadiusVDW) {
 
  278         d->inRadiusVDW = 
false;
 
  280     else if (d->inMeltingPoint) {
 
  283         d->inMeltingPoint = 
false;
 
  285     else if (d->inBoilingPoint) {
 
  288         d->inBoilingPoint = 
false;
 
  290     else if (d->inPeriodTableBlock) {
 
  293         d->inPeriodTableBlock = 
false;
 
  295     else if (d->inNameOrigin) {
 
  296         value = i18n( ch.
toUtf8() );
 
  298         d->inNameOrigin = 
false;
 
  300     else if (d->inDiscoveryDate) {
 
  303         d->inDiscoveryDate = 
false;
 
  305     else if (d->inDiscoverers) {
 
  308         d->inDiscoverers = 
false;
 
  310     else if (d->inPeriod) {
 
  315     else if (d->inCrystalstructure) {
 
  318         d->inCrystalstructure = 
false;
 
  320     else if (d->inAcidicbehaviour) {
 
  323         d->inAcidicbehaviour = 
false;
 
  325     else if (d->inFamily) {
 
  330     else if (d->inGroup) {
 
  335     else if (d->inElectronicconfiguration) {
 
  338         d->inElectronicconfiguration = 
false;
 
  340     else if (d->inDangerSymbol) {
 
  343         d->inDangerSymbol = 
false;
 
  345     else if (d->inRPhrase) {
 
  348         d->inRPhrase = 
false;
 
  350     else if (d->inSPhrase) {
 
  353         d->inSPhrase = 
false;
 
  355     else if (d->inCountry) {
 
  356         if ( ch == 
"ancient" ) {
 
  363         d->inCountry = 
false;
 
  365     else if (d->inOxidation) {
 
  368         d->inOxidation = 
false;
 
  373     d->currentDataObject.setData( value );
 
  374     d->currentDataObject.setType( type );
 
  375     d->currentDataObject.setUnit( d->currentUnit );
 
  377     if ( d->currentElement )
 
  378         d->currentElement->addData( d->currentDataObject );
 
  383 int ElementSaxParser::unit( 
const QString& unit )
 const 
  385     if ( unit == 
"siUnits:kelvin" )
 
  386         return KUnitConversion::Kelvin;
 
  387     else if ( unit == 
"units:ev" )
 
  388         return KUnitConversion::Electronvolt;
 
  389     else if ( unit == 
"units:ang" )
 
  390         return KUnitConversion::Angstrom;
 
  391     else if ( unit == 
"bo:noUnit" )
 
  392         return KUnitConversion::NoUnit;
 
  394         return KUnitConversion::NoUnit;
 
bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
 
the electronegativity in the definition of Pauling 
 
This is a value between 1 and 8. 
 
QList< Element * > getElements()
 
the period of the element 
 
double toDouble(bool *ok) const
 
The name of the discoverers, separated by semicolomns. 
 
QString localName(int index) const
 
the symbol of the element 
 
0 means acidic, 1 means basic, 2 means neutral, 3 means amphoteric 
 
ElementSaxParser()
Constructor. 
 
int toInt(bool *ok, int base) const
 
the danger symbols are the dangers associated with an element, for example Xn,T+ 
 
the electron affinity of the element 
 
A ChemicalDataObject is an object which contains information about a chemical element. 
 
bool startElement(const QString &, const QString &localName, const QString &, const QXmlAttributes &attrs)
 
date of discovery of the element. 
 
In this class all information about an element are stored. 
 
the electronic configuration, for example 1s2 for He 
 
BlueObelisk
The BlueObelisk-project defines in their XML file the dataset with the names of the enum plus "bo:"...
 
bool characters(const QString &ch)
 
The atomic number of the element. 
 
exact masses of the most common isotopes for each element 
 
The IUPAC name of the element. 
 
"Noblegas" "Non-Metal" "Rare_Earth" "Alkaline_Earth" "Alkali_Earth" "Transition" "Other_Metal" "Metal...
 
own, bcc, hdp, ccp, hcp, fcc, d, sc, tet, rh, or, mono 
 
QString value(int index) const
 
QByteArray toUtf8() const