#include <kdebug.h>
-#include "kalziumdataobject.h"
+/* PORTING
+ * #include "kalziumdataobject.h"
+ */
+
#include "moleculeparser.h"
*_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();
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;
m_error = true;
kdDebug() << k_funcinfo << "no such element, parsing error!: " << _name << endl;
+
+ */
return NULL;
}
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:
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
*/
bool parseTerm(double *_resultMass,
ElementCountMap *_resultMap);
+ static const int ELEMENT_TOKEN = 300;
+
Element *lookupElement( const QString& _name );
QMap<Element*, int> m_elementMap;
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.