]> Git trees. - libqmvoc.git/commitdiff
* As we now support ObenBabel2 we don't need custom-made parsers
authorCarsten Niehaus <cniehaus@gmx.de>
Mon, 12 Jun 2006 13:34:38 +0000 (13:34 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Mon, 12 Jun 2006 13:34:38 +0000 (13:34 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=550632

libscience/CMakeLists.txt
libscience/cmlclasses.cpp [deleted file]
libscience/cmlclasses.h [deleted file]
libscience/tests/2-propan-2-yloxypropane.cml [deleted file]
libscience/tests/CMakeLists.txt
libscience/tests/cml2test.cpp [deleted file]
libscience/tests/tests_molecule.cml [deleted file]
libscience/xml_cml.cpp [deleted file]
libscience/xml_cml.h [deleted file]

index 8b7f2115de86ddd51d9bcdfdcdb4d8be46a9d8d4..6977d8d184f84292bf2f7cd6bdd54251c795665d 100644 (file)
@@ -15,8 +15,6 @@ set(science_LIB_SRCS
    chemicaldataobject.cpp
    moleculeparser.cpp
    parser.cpp
-   xml_cml.cpp
-   cmlclasses.cpp
 )
 
 kde4_automoc(${science_LIB_SRCS})
diff --git a/libscience/cmlclasses.cpp b/libscience/cmlclasses.cpp
deleted file mode 100644 (file)
index 9ca71b6..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2006 by Carsten Niehaus                                 *
- *   cniehaus@kde.org                                                      *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         * 
- ***************************************************************************/
-#include "cmlclasses.h"
-
-using namespace CML;
-
-#include <QDebug>
-
-Molecule::Molecule(){}
-
-QString Molecule::debug()
-{
-       qDebug() << "Molecule " << m_id;
-       foreach( CML::Atom* a, m_atoms )
-               qDebug() << a->debug();
-       foreach( CML::Bond* b, m_bonds )
-               qDebug() << b->debug();
-}
-
-Atom::Atom()
-{
-       m_elementType = QString( "" );
-       m_id = QString( "" );
-       coord_x2 = 0.0;
-       coord_x3 = 0.0;
-       coord_y2 = 0.0;
-       coord_y3 = 0.0;
-       coord_z3 = 0.0;
-}
-
-Bond::Bond()
-{
-}
diff --git a/libscience/cmlclasses.h b/libscience/cmlclasses.h
deleted file mode 100644 (file)
index ac76407..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef CMLCLASSES_H
-#define CMLCLASSES_H
-/***************************************************************************
- *   Copyright (C) 2006 by Carsten Niehaus                                 *
- *   cniehaus@kde.org                                                      *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         * 
- ***************************************************************************/
-
-#include <libkdeedu_science_export.h>
-
-#include <QString>
-#include <QList>
-
-namespace CML
-{
-
-class Atom;
-class Bond;
-       
-class EDUSCIENCE_EXPORT Molecule
-{
-       public:
-               Molecule();
-
-               void setAtoms( QList<CML::Atom*> list ){
-                       m_atoms = list;
-               }
-
-               void setBonds( QList<CML::Bond*> list ){
-                       m_bonds = list;
-               }
-
-               void setID( const QString& id ){
-                       m_id = id;
-               }
-
-               QString debug();
-
-       private:
-               QList<CML::Atom*> m_atoms;
-               QList<CML::Bond*> m_bonds;
-
-               QString m_id;
-};
-
-class EDUSCIENCE_EXPORT Atom
-{
-       public:
-               Atom( );
-
-               QString debug(){
-                       QString db = "ID: " + m_id + " Type: " + m_elementType + " Coordinates: " + "x3: " + QString::number( coord_x3 ) + " y3: " + QString::number( coord_y3 )+ " z3:" + QString::number( coord_z3 ) + "\n";
-                       return db;
-               }
-
-               void setID( const QString& id ){
-                       m_id = id;
-               }
-               
-               void setElementType( const QString& et ){
-                       m_elementType = et;
-               }
-
-               void setX2( double i ){
-                       coord_x2 = i;
-               }
-
-               void setX3( double i ){
-                       coord_x3 = i;
-               }
-
-               void setY2( double i ){
-                       coord_y2 = i;
-               }
-
-               void setY3( double i ){
-                       coord_y3 = i;
-               }
-
-               void setZ3( double i ){
-                       coord_z3 = i;
-               }
-
-               QString id() const{
-                       return m_id;
-               }
-
-       private:
-               QString m_elementType;
-               QString m_id;
-
-               //we need to store five possible coordinates, 2 for 2d, 3 for 3d
-               double coord_x2, coord_x3,
-                          coord_y2, coord_y3,
-                          coord_z3;
-};
-
-class EDUSCIENCE_EXPORT Bond
-{
-       public:
-               Bond();
-               
-               QString debug(){
-                       QString db = "Atom 1: " + m_startatom_id + " ... Atom 2: " + m_endatom_id;
-                       return db;
-               }
-
-
-               /**
-                * defines the two Atoms which start and stop the bond
-                */
-               void setAtoms( const QString& id1, const QString& id2 ){
-                       m_startatom_id = id1;
-                       m_endatom_id = id2;
-               }
-
-               void setOrder( int o ){
-                       m_order = o;
-               }
-       
-       private:
-               QString m_startatom_id;
-               QString m_endatom_id;
-
-               int m_order;
-};
-
-}
-#endif // CMLCLASSES_H
diff --git a/libscience/tests/2-propan-2-yloxypropane.cml b/libscience/tests/2-propan-2-yloxypropane.cml
deleted file mode 100644 (file)
index 0358517..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<molecule xmlns="http://www.xml-cml.org/schema/cml2/core" id="2-Propan-2-yloxypropane">
- <atomArray>
-  <atom id="a1" elementType="H" x3="-2.015900" y3="-0.043200" z3="-0.891400"/>
-  <atom id="a2" elementType="C" x3="-2.487000" y3="-0.089500" z3="-1.877800"/>
-  <atom id="a3" elementType="H" x3="-2.086500" y3="0.722700" z3="-2.492800"/>
-  <atom id="a4" elementType="H" x3="-2.178100" y3="-1.022200" z3="-2.357200"/>
-  <atom id="a5" elementType="C" x3="-4.007200" y3="0.002000" z3="-1.772300"/>
-  <atom id="a6" elementType="H" x3="-4.393900" y3="-0.852900" z3="-1.207900"/>
-  <atom id="a7" elementType="C" x3="-4.414600" y3="1.281600" z3="-1.055800"/>
-  <atom id="a8" elementType="H" x3="-4.007200" y3="1.320200" z3="-0.040900"/>
-  <atom id="a9" elementType="H" x3="-4.075100" y3="2.167200" z3="-1.602900"/>
-  <atom id="a10" elementType="H" x3="-5.504700" y3="1.353300" z3="-0.993200"/>
-  <atom id="a11" elementType="O" x3="-4.588300" y3="0.043500" z3="-3.090000"/>
-  <atom id="a12" elementType="C" x3="-4.971100" y3="-1.241800" z3="-3.616500"/>
-  <atom id="a13" elementType="H" x3="-4.344600" y3="-2.034000" z3="-3.193300"/>
-  <atom id="a14" elementType="C" x3="-6.439200" y3="-1.515700" z3="-3.299800"/>
-  <atom id="a15" elementType="H" x3="-6.608700" y3="-1.568400" z3="-2.221000"/>
-  <atom id="a16" elementType="H" x3="-7.078600" y3="-0.710400" z3="-3.675000"/>
-  <atom id="a17" elementType="H" x3="-6.772500" y3="-2.459700" z3="-3.741100"/>
-  <atom id="a18" elementType="C" x3="-4.750200" y3="-1.199300" z3="-5.121800"/>
-  <atom id="a19" elementType="H" x3="-5.334900" y3="-0.398200" z3="-5.585500"/>
-  <atom id="a20" elementType="H" x3="-3.700200" y3="-0.989300" z3="-5.347800"/>
-  <atom id="a21" elementType="H" x3="-5.022000" y3="-2.148100" z3="-5.594500"/>
- </atomArray>
- <bondArray>
-  <bond atomRefs2="a1 a2" order="1"/>
-  <bond atomRefs2="a2 a3" order="1"/>
-  <bond atomRefs2="a2 a4" order="1"/>
-  <bond atomRefs2="a2 a5" order="1"/>
-  <bond atomRefs2="a5 a6" order="1"/>
-  <bond atomRefs2="a5 a7" order="1"/>
-  <bond atomRefs2="a5 a11" order="1"/>
-  <bond atomRefs2="a7 a8" order="1"/>
-  <bond atomRefs2="a7 a9" order="1"/>
-  <bond atomRefs2="a7 a10" order="1"/>
-  <bond atomRefs2="a11 a12" order="1"/>
-  <bond atomRefs2="a12 a13" order="1"/>
-  <bond atomRefs2="a12 a14" order="1"/>
-  <bond atomRefs2="a12 a18" order="1"/>
-  <bond atomRefs2="a14 a15" order="1"/>
-  <bond atomRefs2="a14 a16" order="1"/>
-  <bond atomRefs2="a14 a17" order="1"/>
-  <bond atomRefs2="a18 a19" order="1"/>
-  <bond atomRefs2="a18 a20" order="1"/>
-  <bond atomRefs2="a18 a21" order="1"/>
- </bondArray>
-</molecule>
index 53c528248c923b7cb696a4c1c99c774f49507bdd..7e8f484c8e897a37084826996d2f565c9f49699b 100644 (file)
@@ -25,17 +25,6 @@ target_link_libraries(xmlreadingtest  ${KDE4_KDECORE_LIBS} science )
 
 #target_link_libraries(isotopereadingtest  ${KDE4_KDECORE_LIBS} science )
 
-########### next target ###############
-
-set(cml2test_SRCS cml2test.cpp )
-
-kde4_automoc(${cml2test_SRCS})
-
-kde4_add_executable(cml2test ${cml2test_SRCS})
-
-target_link_libraries(cml2test  ${KDE4_KDECORE_LIBS} science )
-
-
 endif(KDE4_BUILD_TESTS)
 
 
diff --git a/libscience/tests/cml2test.cpp b/libscience/tests/cml2test.cpp
deleted file mode 100644 (file)
index 1358c7e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <kdebug.h>
-#include <iostream>
-
-#include <QTextStream>
-#include <QFile>
-#include <QDateTime>
-#include <qxml.h>
-
-#include "../xml_cml.h"
-#include "../cmlclasses.h"
-
-int main(int argc, char *argv[])
-{
-       if (argc < 2 || argc > 2) {
-               std::cout << "Usage: elements <XML_FILE>\n";
-               return 1;
-       }
-
-       CMLParser *handler = new CMLParser();
-       
-       QFile xmlFile(argv[1]);
-       
-       if ( !xmlFile.open( IO_ReadOnly ) ) 
-               return false;
-       
-       QXmlInputSource source( &xmlFile );
-       QXmlSimpleReader xmlReader;
-       xmlReader.setContentHandler( handler );
-       xmlReader.parse( source );
-       
-       CML::Molecule * mol = handler->getMolecule();
-               kDebug() << mol->debug() << endl;
-       
-       return 0;
-}
diff --git a/libscience/tests/tests_molecule.cml b/libscience/tests/tests_molecule.cml
deleted file mode 100644 (file)
index de138bb..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<molecule xmlns="http://www.xml-cml.org/schema/cml2/core" id="Ethanol">
- <atomArray>
-  <atom id="a1" elementType="H" x3="-1.916300" y3="-0.043300" z3="-1.055200"/>
-  <atom id="a2" elementType="C" x3="-2.529600" y3="-0.050300" z3="-1.960600"/>
-  <atom id="a3" elementType="H" x3="-2.235900" y3="0.793700" z3="-2.591800"/>
-  <atom id="a4" elementType="H" x3="-2.311100" y3="-0.960600" z3="-2.527100"/>
-  <atom id="a5" elementType="C" x3="-4.003000" y3="0.025300" z3="-1.617800"/>
-  <atom id="a6" elementType="H" x3="-4.299600" y3="-0.832200" z3="-1.006300"/>
-  <atom id="a7" elementType="H" x3="-4.224400" y3="0.947100" z3="-1.071600"/>
-  <atom id="a8" elementType="O" x3="-4.760100" y3="0.012900" z3="-2.821500"/>
-  <atom id="a9" elementType="H" x3="-5.698200" y3="0.061600" z3="-2.569500"/>
- </atomArray>
- <bondArray>
-  <bond atomRefs2="a1 a2" order="1"/>
-  <bond atomRefs2="a2 a3" order="1"/>
-  <bond atomRefs2="a2 a4" order="1"/>
-  <bond atomRefs2="a2 a5" order="1"/>
-  <bond atomRefs2="a5 a6" order="1"/>
-  <bond atomRefs2="a5 a7" order="1"/>
-  <bond atomRefs2="a5 a8" order="1"/>
-  <bond atomRefs2="a8 a9" order="1"/>
- </bondArray>
-</molecule>
diff --git a/libscience/xml_cml.cpp b/libscience/xml_cml.cpp
deleted file mode 100644 (file)
index ea6c3c3..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
- * ** Copyright ( C ) 1992-2000 Trolltech AS.  All rights reserved.
- * ** Copyright ( C ) 2006 Carsten Niehaus <cniehaus@kde.org>
- * **
- * ** This file is part of an example program for Qt.  This example
- * ** program may be used, distributed and modified without limitation.
- * **
- * *****************************************************************************/
-
-#include "xml_cml.h"
-
-#include <QFile>
-#include <QString>
-
-#include <QtDebug>
-
-CMLParser::CMLParser()
-  : QXmlDefaultHandler()
-{
-}
-
-CMLParser::~CMLParser()
-{
-}
-
-bool CMLParser::startDocument()
-{
-       return TRUE;
-}
-
-bool CMLParser::startElement(  const QString&, const QString&, 
-               const QString& qName, 
-               const QXmlAttributes& attr )
-{
-       if ( qName.toUpper() == "MOLECULE" ) {
-               tmp_molecule = new CML::Molecule();
-               
-               tmp_molecule->setID( attr.value( "id" ) );
-       }
-       else if ( qName.toUpper() == "ATOM" ) {
-               tmp_atom = new CML::Atom();
-       
-               QString x2 = attr.value( "x2");
-               if ( x2 != QString( "" ) )
-                       tmp_atom->setX2( x2.toDouble() );
-               
-               QString x3 = attr.value( "x3");
-               if ( x3 != QString( "" ) )
-                       tmp_atom->setX3( x3.toDouble() );
-               
-               QString y2 = attr.value( "y2");
-               if ( y2 != QString( "" ) )
-                       tmp_atom->setY2( y2.toDouble() );
-               
-               QString y3 = attr.value( "y3");
-               if ( y3 != QString( "" ) )
-                       tmp_atom->setY3( y3.toDouble() );
-               
-               QString z3 = attr.value( "z3");
-               if ( z3 != QString( "" ) )
-                       tmp_atom->setZ3( z3.toDouble() );
-
-               tmp_atom->setID( attr.value( "id" ) );
-       }
-       else if ( qName.toUpper() == "BOND" ) {
-               tmp_bond = new CML::Bond();
-               
-               QString order = attr.value( "order");
-               if ( order != QString( "" ) )
-                       tmp_bond->setOrder( order.toInt() );
-               
-               QString atomRef = attr.value( "atomRefs2");
-               if ( atomRef != QString( "" ) )
-               {
-                       QStringList Split = atomRef.split( " " );
-                       tmp_bond->setAtoms( Split.at( 0 ), Split.at( 1 ) );
-               }
-       }
-       return TRUE;
-}
-
-bool CMLParser::endElement(  const QString&, const QString&, 
-               const QString& qName )
-{
-       if ( qName.toUpper() == "MOLECULE" ) {
-               tmp_molecule->setAtoms( getAtoms() );
-               tmp_molecule->setBonds( getBonds() );
-       }
-       else if ( qName.toUpper() == "ATOM" ) {
-               localAtoms.append( tmp_atom );
-               tmp_atom = 0;
-       }
-       else if ( qName.toUpper() == "BOND" ) {
-               localBonds.append( tmp_bond );
-               tmp_bond = 0;
-       }
-       return TRUE;
-}
-
-bool CMLParser::characters(  const QString &ch ) 
-{
-       return TRUE;
-}
-
-bool CMLParser::ignorableWhitespace(  const QString &ch )
-{
-       return TRUE;
-}
-
-QList<CML::Atom*> CMLParser::getAtoms()
-{ 
-       return localAtoms; 
-}
-
-QList<CML::Bond*> CMLParser::getBonds()
-{ 
-       return localBonds; 
-}
diff --git a/libscience/xml_cml.h b/libscience/xml_cml.h
deleted file mode 100644 (file)
index 45e473f..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * ** $Id: xml_cml.h,v 1.2 2002/07/21 23:27:05 atenderholt Exp $
- * **
- * ** Copyright ( C ) 1992-2000 Trolltech AS.  All rights reserved.
- * **
- * ** This file is part of an example program for Qt.  This example
- * ** program may be used, distributed and modified without limitation.
- * **
- * *****************************************************************************/
-
-#ifndef XML_CML_H
-#define XML_CML_H
-
-#include <libkdeedu_science_export.h>
-
-#include <qxml.h>
-#include <QList>
-
-#include "cmlclasses.h"
-
-class QString;
-
-// possible states (CMLParser::states)
-// set in defs.h
-//X #define CML_NONE 0
-//X #define CML_ATOM 1
-//X #define CML_BOND 2
-//X #define CML_MOLECULE 10
-//X #define CML_NONE   1
-//X #define CML_ATOM   2
-//X #define CML_BOND   3
-//X #define CML_ATOMARRAY 4
-//X #define CML_BONDARRAY 5
-
-
-class EDUSCIENCE_EXPORT CMLParser : public QXmlDefaultHandler
-{
-       public:
-               CMLParser();
-               virtual ~CMLParser();
-
-               bool startDocument();
-               
-               bool startElement( const QString&, 
-                               const QString&, 
-                               const QString& ,
-                               const QXmlAttributes& );
-               
-               bool endElement( const QString&, const QString&, const QString& );
-               
-               bool characters( const QString& );
-               
-               bool ignorableWhitespace( const QString& );
-               
-               QList<CML::Atom*> getAtoms();
-               QList<CML::Bond*> getBonds();
-               
-               CML::Molecule* getMolecule(){
-                       return tmp_molecule;
-               }
-
-       private:
-               QList<CML::Atom*> localAtoms;
-               QList<CML::Bond*> localBonds;
-               
-               CML::Bond *tmp_bond;
-               
-               CML::Molecule *tmp_molecule;
-
-               CML::Atom * tmp_atom;           
-};
-
-#endif