File indexing completed on 2024-05-05 03:42:12

0001 /*
0002     SPDX-FileCopyrightText: 2005, 2006, 2008 Carsten Niehaus <cniehaus@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "isotope.h"
0008 #include "isotopeparser.h"
0009 #include <QDebug>
0010 #include <iostream>
0011 
0012 int main(int argc, char *argv[])
0013 {
0014     if (argc < 2 || argc > 2) {
0015         std::cout << "Usage: isotopes <XML_FILE>\n";
0016         return 1;
0017     }
0018 
0019     auto parser = new IsotopeParser();
0020     QFile xmlFile(argv[1]);
0021 
0022     QXmlInputSource source(&xmlFile);
0023     QXmlSimpleReader reader;
0024 
0025     reader.setContentHandler(parser);
0026     reader.parse(source);
0027 
0028     const QList<Isotope *> v = parser->getIsotopes();
0029 
0030     qDebug() << "Found " << v.count() << " isotopes.";
0031     ;
0032 
0033     qDebug() << "As a test I am now issuing all isotopes with 50 nuclueons: ";
0034 
0035     for (Isotope *i : v) {
0036         if (i) {
0037             // X             if (i->nucleons() == 50 ) {
0038             // X                 qDebug() << "   Isotope of " << i->parentElementSymbol() << " with a mass of " << i->mass();
0039             // X                 qDebug() << "       Halflife: " << i->halflife() << i->halflifeUnit( );
0040             // X             }
0041             if (i->parentElementSymbol() == QLatin1String("Ti")) {
0042                 qDebug() << "   Isotope of " << i->parentElementSymbol() << " with a mass of " << i->mass();
0043                 qDebug() << "       Halflife: " << i->halflife() << i->halflifeUnit();
0044             }
0045         }
0046     }
0047 
0048     delete parser;
0049     qDeleteAll(v);
0050 
0051     return 0;
0052 }