[Kalzium] KDE/kdeedu/libkdeedu/libscience

Carsten Niehaus cniehaus at gmx.de
Sat Dec 31 11:42:35 CET 2005


SVN commit 492832 by cniehaus:

* make one public member private
* add many apidox-comments, but the content is missing. 
  Inge: Perhaps you could add some here? I find it difficult to add them, to be honest
CCMAIL:kalzium at kde.org


 M  +3 -1      Makefile.am  
 M  +9 -5      moleculeparser.cpp  
 M  +49 -2     moleculeparser.h  
 M  +14 -1     parser.h  


--- trunk/KDE/kdeedu/libkdeedu/libscience/Makefile.am #492831:492832
@@ -13,7 +13,9 @@
 	elementparser.cpp \
 	isotopeparser.cpp \
 	tempunit.cpp \
-	chemicaldataobject.cpp
+	chemicaldataobject.cpp \
+	moleculeparser.cpp \
+	parser.cpp
 
 libscience_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 4:0:0
 libscience_la_LIBADD = $(LIB_KDEUI) 
--- trunk/KDE/kdeedu/libkdeedu/libscience/moleculeparser.cpp #492831:492832
@@ -16,7 +16,10 @@
 
 #include <kdebug.h>
 
-#include "kalziumdataobject.h"
+/* PORTING
+ * #include "kalziumdataobject.h"
+ */
+
 #include "moleculeparser.h"
 
 
@@ -188,10 +191,6 @@
     *_resultMass = 0.0;
 	_resultMap->clear();
  
-#if 0
-    kdDebug() << "parseTerm(): Next token =  "
-			  << nextToken() << endl;
-#endif
     if (nextToken() == ELEMENT_TOKEN) {
 		//kdDebug() << "Parsed an element: " << m_elementVal->symbol() << endl;
 		*_resultMass = m_elementVal->dataAsVariant( ChemicalDataObject::mass ).toDouble();
@@ -282,6 +281,9 @@
 Element *
 MoleculeParser::lookupElement( const QString& _name )
 {
+	/** PORTING this cannot work because of course there is no KDO known in
+	 *  this library. We need to find a workaround here...
+	
     QList<Element*> elementList = KalziumDataObject::instance()->ElementList;
 
     //kdDebug() << "looking up " << _name << endl;
@@ -300,5 +302,7 @@
 	m_error = true;
 
 	kdDebug() << k_funcinfo << "no such element, parsing error!: " << _name << endl;
+
+	*/
 	return NULL;
 }
--- trunk/KDE/kdeedu/libkdeedu/libscience/moleculeparser.h #492831:492832
@@ -57,15 +57,45 @@
     ElementCountMap();
     ~ElementCountMap();
 
+	/**
+	 *
+	 */
     void  clear()          { m_map.clear(); }
 
+	/**
+	 * @param _element
+	 */
     ElementCount  *search(Element *_element);
+	
+	/**
+	 * @param _map
+	 */
     void           add(ElementCountMap &_map);
+	
+	/**
+	 * @param _element
+	 * @param _count
+	 */
     void           add(Element *_element, int _count);
+	
+	/**
+	 * @param _factor
+	 */
 	void           multiply(int _factor);
 
+	/**
+	 * typedef
+	 */
 	typedef QList<ElementCount*>::Iterator  Iterator;
+	
+	/**
+	 *
+	 */
 	Iterator   begin() { return  m_map.begin(); }
+	
+	/**
+	 *
+	 */
 	Iterator   end()   { return  m_map.end();   }
 
  private:
@@ -96,15 +126,30 @@
 class MoleculeParser : public Parser {
 
 public:
-    static const int  ELEMENT_TOKEN = 300;
-
+	/**
+	 * Constructor
+	 */
     MoleculeParser();
+	
+	/**
+	 * Constructor
+	 * 
+	 * @param _str @ref Parser::start the parsing with @p _str
+	 */
     MoleculeParser( const QString& _str);
+	
+	/**
+	 * Destructor
+	 */
     virtual ~MoleculeParser();
 
     /**
      * Try to parse the molecule @p molecule and get the weight of it.
      * The calculated weight is stored in @p _result.
+	 *
+	 * @param _moleculeString
+	 * @param _resultMass
+	 * @param _resultMap
      *
      * @return whether the parsing was successful or not
      */
@@ -118,6 +163,8 @@
     bool      parseTerm(double          *_resultMass, 
 						ElementCountMap *_resultMap);
 
+    static const int  ELEMENT_TOKEN = 300;
+
     Element  *lookupElement( const QString& _name );
 
     QMap<Element*, int> m_elementMap;
--- trunk/KDE/kdeedu/libkdeedu/libscience/parser.h #492831:492832
@@ -31,9 +31,22 @@
     static const  int  FLOAT_TOKEN = 258;
     // Extend this list in your subclass to make a more advanced parser.
 
+	/**
+	 * Constructor
+	 */
     Parser();
+
+	/**
+	 * Constructor
+	 *
+	 * @param _str @ref start the parsing with @p _str
+	 */
     Parser(const QString& _str);
-    virtual ~Parser();
+    
+	/**
+	 * Destructor
+	 */
+	virtual ~Parser();
 
     /**
      * Start a new parse.


More information about the Kalzium mailing list