Diffstat (limited to 'noncore/apps/oxygen/kmolcalc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/kmolcalc.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp index 0ba52da..33666b1 100644 --- a/noncore/apps/oxygen/kmolcalc.cpp +++ b/noncore/apps/oxygen/kmolcalc.cpp @@ -1,2 +1,2 @@ -/* +/* * kmolcalc.cpp @@ -10,3 +10,3 @@ * weights and group definitions ELSTABLE, and the currently processed formula, stored - * as a list of elements and their coefficients, ELEMENTS. + * as a list of elements and their coefficients, ELEMENTS. */ @@ -17,2 +17,3 @@ #include <qfile.h> +#include <qpe/qpeapplication.h> #include <iostream.h> @@ -38,3 +39,3 @@ void KMolCalc::readElstable() { elstable->setAutoDelete(TRUE); - mwfile = "/home/opie/opie/noncore/apps/oxygen/kmolweights"; + mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights"; QFile f(mwfile); @@ -44,5 +45,5 @@ void KMolCalc::readElstable() { -/** - * Parse a string S and construct the ElementList this->ELEMENTS, representing the - * composition of S. Returns 0 if successful, or an error code (currently -1) if +/** + * Parse a string S and construct the ElementList this->ELEMENTS, representing the + * composition of S. Returns 0 if successful, or an error code (currently -1) if * parsing failed. @@ -66,3 +67,3 @@ QString KMolCalc::readGroup(const QString& s, ElementList* els) { while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++; - double prefix = (i == 0 ? 1 : s.left(i).toDouble(&ok)); + double prefix = (i == 0 ? 1 : s.left(i).toDouble(&ok)); if (! ok || i == sl || prefix == 0) return QString ("Bad formula."); // ERROR @@ -87,3 +88,3 @@ QString KMolCalc::readGroup(const QString& s, ElementList* els) { while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++; - double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok)); + double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok)); if (! ok || suffix == 0) { @@ -92,3 +93,3 @@ QString KMolCalc::readGroup(const QString& s, ElementList* els) { return QString ("Bad formula."); // ERROR - } + } inner->addTo(*elstemp, suffix); @@ -97,3 +98,3 @@ QString KMolCalc::readGroup(const QString& s, ElementList* els) { } else if ((s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= 'a' && s[i] <= 'z')) { - while (++i < sl && ((s[i] >= 'a' && s[i] <= 'z') || s[i] == '*' || + while (++i < sl && ((s[i] >= 'a' && s[i] <= 'z') || s[i] == '*' || s[i] == '\'')); @@ -102,3 +103,3 @@ QString KMolCalc::readGroup(const QString& s, ElementList* els) { while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++; - double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok)); + double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok)); if (! ok || suffix == 0) { @@ -178,3 +179,3 @@ void KMolCalc::undefineGroup (const QString& name) { /** - * Add a new element name - atomic weight record to the ELSTABLE hashtable. Assumes + * Add a new element name - atomic weight record to the ELSTABLE hashtable. Assumes * NAME has valid syntax. |