[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdevelop/lib/util
From: Jens Dagerbo <jens.dagerbo () swipnet ! se>
Date: 2005-01-07 18:43:58
Message-ID: 20050107184358.B6ECC1BB6E () office ! kde ! org
[Download RAW message or body]
CVS commit by dagerbo:
Split some functionality to be able to utilize it from the appwizard
M +6 -1 filetemplate.cpp 1.14
M +11 -0 filetemplate.h 1.11
--- kdevelop/lib/util/filetemplate.cpp #1.13:1.14
@@ -62,4 +61,9 @@ QString FileTemplate::readFile(KDevPlugi
QString str = stream.read();
+ return makeSubstitutions( dom, str );
+}
+
+QString FileTemplate::makeSubstitutions( QDomDocument & dom, const QString & text )
+{
QString author = DomUtil::readEntry(dom, "/general/author");
QString email = DomUtil::readEntry(dom, "/general/email");
@@ -68,4 +72,5 @@ QString FileTemplate::readFile(KDevPlugi
QString year = QString::number(QDate::currentDate().year());
+ QString str = text;
str.replace(QRegExp("\\$EMAIL\\$"),email);
str.replace(QRegExp("\\$AUTHOR\\$"),author);
--- kdevelop/lib/util/filetemplate.h #1.10:1.11
@@ -24,4 +24,5 @@
class KDevPlugin;
+class QDomDocument;
/**
@@ -49,4 +51,5 @@ public:
*/
static bool exists(KDevPlugin *part, const QString &name, Policy p = Default);
+
/**
* Reads a template with the given name (e.g. "cpp")
@@ -61,4 +65,11 @@ public:
*/
static QString readFile(KDevPlugin *part, const QString &fileName);
+
+ /**
+ * Makes variable substitutions on a text, based on a specified QDomDocument
+ * describing a KDevelop project file. The resulting string is returned.
+ */
+ static QString makeSubstitutions(QDomDocument &dom, const QString &text);
+
/**
* Copies a file template with the given name to the
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic