]> Git trees. - libqmvoc.git/commitdiff
Improve the orbits parsing routine.
authorPino Toscano <pino@kde.org>
Mon, 30 May 2005 21:51:49 +0000 (21:51 +0000)
committerPino Toscano <pino@kde.org>
Mon, 30 May 2005 21:51:49 +0000 (21:51 +0000)
svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=419944

kalzium/src/element.cpp
kalzium/src/element.h

index 8c74979fd018cf8c0f63c01de36b42197df8e006..64da02c14880a357169c596f0219a715bdab06b5 100644 (file)
@@ -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]+)");
index 4e2247c096ba358a9a6d4e1e49671f0c23710363..168418e190465b11bf9b9dda17f7fd233269e98b 100644 (file)
@@ -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