[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kconfig_compiler
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2006-09-29 18:33:45
Message-ID: 1159554825.787615.21336.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 590302 by tokoe:

Use Qt4 api to iterate over dom elements


 M  +10 -31    kconfig_compiler.cpp  


--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #590301:590302
@@ -450,9 +450,7 @@
   QString maxValue;
   int paramMax = 0;
 
-  QDomNode n;
-  for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
-    QDomElement e = n.toElement();
+  for ( QDomElement e = element.firstChildElement(); !e.isNull(); e = \
e.nextSiblingElement() ) {  QString tag = e.tagName();
     if ( tag == "label" ) label = e.text();
     else if ( tag == "whatsthis" ) whatsThis = e.text();
@@ -484,14 +482,10 @@
       }
       else if (paramType == "Enum")
       {
-         QDomNode n2;
-         for ( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
-           QDomElement e2 = n2.toElement();
+         for ( QDomElement e2 = e.firstChildElement(); !e2.isNull(); e2 = \
e2.nextSiblingElement() ) {  if (e2.tagName() == "values")
            {
-             QDomNode n3;
-             for ( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) {
-               QDomElement e3 = n3.toElement();
+             for ( QDomElement e3 = e2.firstChildElement(); !e3.isNull(); e3 = \
e3.nextSiblingElement() ) {  if (e3.tagName() == "value")
                {
                   paramValues.append( e3.text() );
@@ -525,18 +519,14 @@
       }
     }
     else if ( tag == "choices" ) {
-      QDomNode n2;
-      for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
-        QDomElement e2 = n2.toElement();
+      for( QDomElement e2 = e.firstChildElement(); !e2.isNull(); e2 = \
e2.nextSiblingElement() ) {  if ( e2.tagName() == "choice" ) {
-          QDomNode n3;
           CfgEntry::Choice choice;
           choice.name = e2.attribute( "name" );
           if ( choice.name.isEmpty() ) {
             std::cerr << "Tag <choice> requires attribute 'name'." << std::endl;
           }
-          for( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) {
-            QDomElement e3 = n3.toElement();
+          for( QDomElement e3 = e2.firstChildElement(); !e3.isNull(); e3 = \
e3.nextSiblingElement() ) {  if ( e3.tagName() == "label" ) choice.label = e3.text();
             if ( e3.tagName() == "whatsthis" ) choice.whatsThis = e3.text();
           }
@@ -605,9 +595,7 @@
       paramDefaultValues.append(QString::null);
     }
 
-    QDomNode n;
-    for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
-      QDomElement e = n.toElement();
+    for ( QDomElement e = element.firstChildElement(); !e.isNull(); e = \
e.nextSiblingElement() ) {  QString tag = e.tagName();
       if ( tag == "default" )
       {
@@ -1119,10 +1107,7 @@
 
   QList<CfgEntry*> entries;
 
-  QDomNode n;
-  for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
-    QDomElement e = n.toElement();
-
+  for ( QDomElement e = cfgElement.firstChildElement(); !e.isNull(); e = \
e.nextSiblingElement() ) {  QString tag = e.tagName();
 
     if ( tag == "include" ) {
@@ -1133,9 +1118,7 @@
     } else if ( tag == "kcfgfile" ) {
       cfgFileName = e.attribute( "name" );
       cfgFileNameArg = e.attribute( "arg" ).toLower() == "true";
-      QDomNode n2;
-      for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
-        QDomElement e2 = n2.toElement();
+      for( QDomElement e2 = e.firstChildElement(); !e2.isNull(); e2 = \
e2.nextSiblingElement() ) {  if ( e2.tagName() == "parameter" ) {
           Param p;
           p.name = e2.attribute( "name" );
@@ -1152,9 +1135,7 @@
         std::cerr << "Group without name" << std::endl;
         return 1;
       }
-      QDomNode n2;
-      for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
-        QDomElement e2 = n2.toElement();
+      for( QDomElement e2 = e.firstChildElement(); !e2.isNull(); e2 = \
e2.nextSiblingElement() ) {  if ( e2.tagName() != "entry" ) continue;
         CfgEntry *entry = parseEntry( group, e2 );
         if ( entry ) entries.append( entry );
@@ -1173,9 +1154,7 @@
      Signal theSignal;
      theSignal.name = signalName;
 
-     QDomNode n2;
-     for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
-       QDomElement e2 = n2.toElement();
+     for( QDomElement e2 = e.firstChildElement(); !e2.isNull(); e2 = \
e2.nextSiblingElement() ) {  if ( e2.tagName() == "argument") {
          SignalArguments argument;
          argument.type = e2.attribute("type");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic