]> Git trees. - libqmvoc.git/commitdiff
* Two consts are not protected
authorCarsten Niehaus <cniehaus@gmx.de>
Sat, 31 Dec 2005 18:17:04 +0000 (18:17 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sat, 31 Dec 2005 18:17:04 +0000 (18:17 +0000)
* Some API-docs
* Some empty API-Docs
* Add the two debug-lines in Makefile.am so that errors show up on ebn.

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=492957

libscience/Makefile.am
libscience/moleculeparser.cpp
libscience/moleculeparser.h
libscience/parser.h

index f40f1358b6a953313d5f880c7adb0f65f3ec3a53..c0d7f55d468f3be9aa6c7407990a97bd9325f221 100644 (file)
@@ -22,4 +22,6 @@ libscience_la_LIBADD = $(LIB_KDEUI)
 
 METASOURCES = AUTO
 
+DOXYGEN_SET_WARN_IF_UNDOCUMENTED = YES
+DOXYGEN_SET_INTERNAL_DOCS = YES
 
index d8ccebe34c60ae1c6d75c45178e9ac594e9f99ce..58a6531d9f320f3f59bedf65b2c7b72c9a8b5128 100644 (file)
@@ -42,12 +42,19 @@ ElementCountMap::~ElementCountMap()
 ElementCount *
 ElementCountMap::search(Element *_element)
 {
-       QList<ElementCount *>::ConstIterator       it    = m_map.constBegin();
-       const QList<ElementCount *>::ConstIterator itEnd = m_map.constEnd();
-
-       for (; it != itEnd; ++it) {
-               if ((*it)->element() == _element)
-                       return *it;
+       //not yet tested but the commented code should be the same as
+       //the foreach... so lets use Qt4 power
+//X    QList<ElementCount *>::ConstIterator       it    = m_map.constBegin();
+//X    const QList<ElementCount *>::ConstIterator itEnd = m_map.constEnd();
+//X 
+//X    for (; it != itEnd; ++it) {
+//X            if ((*it)->element() == _element)
+//X                    return *it;
+//X    }
+
+       foreach( ElementCount* c, m_map ){
+               if ( c->element() == _element )
+                       return c;
        }
 
        return 0;
@@ -57,12 +64,18 @@ ElementCountMap::search(Element *_element)
 void
 ElementCountMap::add(ElementCountMap &_map)
 {
-       QList<ElementCount *>::ConstIterator       it    = _map.m_map.constBegin();
-       const QList<ElementCount *>::ConstIterator itEnd = _map.m_map.constEnd();
-
-       // Step throught _map and for each element, add it to the current one.
-       for (; it != itEnd; ++it) {
-               add((*it)->m_element, (*it)->m_count);
+       //not yet tested but the commented code should be the same as
+       //the foreach... so lets use Qt4 power
+//X    QList<ElementCount *>::ConstIterator       it    = _map.m_map.constBegin();
+//X    const QList<ElementCount *>::ConstIterator itEnd = _map.m_map.constEnd();
+//X 
+//X    // Step throught _map and for each element, add it to the current one.
+//X    for (; it != itEnd; ++it) {
+//X            add((*it)->m_element, (*it)->m_count);
+//X    }
+
+       foreach( ElementCount* c, _map.m_map ){
+               add( c->m_element, c->m_count );
        }
        
 }
index b9ff8e44868c428ed098eaf79168d709b203e69f..57342ed604fe170bc5706a1cfd13ffe98caaf95e 100644 (file)
 #include "element.h"
 #include "parser.h"
 
-#include <qmap.h>
-#include <qlist.h>
+#include <QMap>
+#include <QList>
 
 
 /**
  * @class ElementCountMap
+ * @author Inge Wallin
  */
-class ElementCount {
- public:
-    ElementCount(Element *_element, int _count)
-    {
-           m_element = _element;
-           m_count   = _count;
-       }
-    ElementCount(Element *_element)
-        {
-           m_element = _element;
-           m_count   = 0;
-       }
-       
-    ~ElementCount();
-
-    Element *element() const    { return m_element;   }
-    int   count()  const        { return m_count;     }
-    void  add(int _count)       { m_count += _count;  }
-       void  multiply(int _factor) { m_count *= _factor; }
-
-    Element  *m_element;
-    int       m_count;
+class ElementCount 
+{
+       public:
+               /**
+                * Constructor
+                */
+               ElementCount(Element *_element, int _count)
+               {
+                       m_element = _element;
+                       m_count   = _count;
+               }
+               
+               /**
+                * Constructor
+                */
+               ElementCount(Element *_element)
+               {
+                       m_element = _element;
+                       m_count   = 0;
+               }
+               /**
+                * Destructor
+                */
+               ~ElementCount();
+
+               /**
+                * @return the Element
+                */
+               Element *element() const    { return m_element;   }
+
+               /**
+                * @return the number of occurences of the Element
+                */
+               int   count()  const        { return m_count;     }
+               
+               /**
+                * Add @p _count occurences of the Element
+                * @param _count The number of times the Element occurs
+                */
+               void  add(int _count)       { m_count += _count;  }
+               void  multiply(int _factor) { m_count *= _factor; }
+
+               /**
+                * The Element of the object
+                */
+               Element  *m_element;
+
+               /**
+                * The number of occurences
+                */
+               int       m_count;
 };
 
 
 /**
+ * This class is used to count the elements in the molecule
+ * which is being calculated
+ * 
  * @class ElementCount
+ * @author Inge Wallin
  */
-class ElementCountMap {
- public:
-    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:
-    QList<ElementCount*>  m_map;
+class ElementCountMap 
+{
+       public:
+               /**
+                * Constructor
+                */
+               ElementCountMap();
+
+               /**
+                * Destructor
+                */
+               ~ElementCountMap();
+
+               /**
+                * Clear the map of ElementCount pointers
+                */
+               void  clear()          { m_map.clear(); }
+
+               /**
+                * @param _element the searched Element
+                * @return the Element which is searched
+                */
+               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:
+               QList<ElementCount*>  m_map;
 };
 
 
index ee2437b4e5de10fa69de04a70a12c34840405db5..5fa840a2299dd0d2d80879753006d33accfc7d44 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef PARSER_H
 #define PARSER_H
 
-#include <qstring.h>
+#include <QString>
 
 /**
  * @class Parser
  */
 class Parser {
 public:
-    // All characters are their own token value per default.
-    static const  int  INT_TOKEN   = 257;
-    static const  int  FLOAT_TOKEN = 258;
-    // Extend this list in your subclass to make a more advanced parser.
-
        /**
         * Constructor
         */
@@ -76,6 +71,17 @@ private:
     bool  parseSimpleFloat(double *_result);
 
 protected:
+    /**
+        * All characters are their own token value per default.
+        * Extend this list in your subclass to make a more advanced parser.
+        */
+    static const  int  INT_TOKEN   = 257;
+
+       /**
+        * All characters are their own token value per default.
+        * Extend this list in your subclass to make a more advanced parser.
+        */
+    static const  int  FLOAT_TOKEN = 258;
 
     /**
      * Make the next character the current one.
@@ -112,7 +118,15 @@ private:
     // union, but I don't think it is necessary to bother, since they
     // are so few and we don't instantiate a lot of copies of the
     // parser.
+       
+       /**
+        * Valid if m_nextToken == INT_TOKEN
+        */
     int      m_intVal;         // Valid if m_nextToken == INT_TOKEN
+
+       /**
+        * Valid if m_nextToken == FLOAT_TOKEN
+        */
     double   m_floatVal;       // Valid if m_nextToken == FLOAT_TOKEN
 };