From: Pino Toscano Date: Mon, 30 May 2005 21:51:49 +0000 (+0000) Subject: Improve the orbits parsing routine. X-Git-Tag: v3.80.2~300^2~132 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=6b3919caafaa71574e33f56adc37d474a42e4c4c;p=libqmvoc.git Improve the orbits parsing routine. svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=419944 --- diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index 8c74979..64da02c 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -41,10 +41,13 @@ Element::Element() { } -QString Element::parsedOrbits() +QString Element::parsedOrbits( bool canBeEmpty ) { - if ( m_orbits == "0" ) - return i18n( "structure means orbital configuration in this case", "Unknown structure" ); + if ( m_orbits.isEmpty() ) + if ( !canBeEmpty ) + return i18n( "structure means orbital configuration in this case", "Unknown structure" ); + else + return ""; QString orbits = m_orbits; QRegExp rxs("([a-z])([0-9]+)"); diff --git a/kalzium/src/element.h b/kalzium/src/element.h index 4e2247c..168418e 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -237,8 +237,10 @@ class Element{ * @return the orbits of the element. The QString is already * parsed so that the numbers are superscripts and the first * block is bold. + * @param canBeEmpty specifies if the string returned can be + * empty instead of a "Unknown structure" one. */ - QString parsedOrbits(); + QString parsedOrbits( bool canBeEmpty = false ); /** * @return the boiling point of the element in Kelvin