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

List:       kde-commits
Subject:    KDE/kdevelop/lib/util
From:       Sascha Cunz <sascha.cunz () tiscali ! de>
Date:       2005-09-22 19:26:33
Message-ID: 1127417193.505404.11205.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 463035 by cunz:

Added method to create a substitution map for xml from a "normal" substitution map



 M  +16 -0     filetemplate.cpp  
 M  +7 -1      filetemplate.h  


--- trunk/KDE/kdevelop/lib/util/filetemplate.cpp #463034:463035
@@ -113,3 +113,19 @@
     QString globalName = ::locate("data", "kdevfilecreate/file-templates/" + name);
     return globalName.isNull() ? fileName : globalName;
 }
+
+
+QHash<QString,QString> FileTemplate::normalSubstMapToXML( const QHash<QString,QString>& src )
+{
+    QHash<QString,QString> result;
+    QHash<QString,QString>::Iterator it( src.begin() );
+    for( ; it != src.end(); ++it )
+    {
+        QString escaped( it.value() );
+        escaped.replace( "&", "&amp;" );
+        escaped.replace( "<", "&lt;" );
+        escaped.replace( ">", "&gt;" );
+        result.insert( it.key(), escaped );
+    }
+    return result;
+}
--- trunk/KDE/kdevelop/lib/util/filetemplate.h #463034:463035
@@ -20,7 +20,8 @@
 #ifndef _FILETEMPLATE_H_
 #define _FILETEMPLATE_H_
 
-#include <qstring.h>
+#include <QString>
+#include <QHash>
 
 class KDevPlugin;
 class QDomDocument;
@@ -83,6 +84,11 @@
      * for the template in the project directory if it doesn't exist.
      */
     static QString fullPathForName(KDevPlugin *part, const QString &name, Policy p = Default);
+
+    /**
+     * Escape a substitution map for usage on a XML file.
+     */
+    static QHash<QString,QString> normalSubstMapToXML( const QHash<QString,QString>& src );
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

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