[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdevelop/parts/customproject
From: Harald Fernengel <harry () kdevelop ! org>
Date: 2003-03-12 14:55:51
[Download RAW message or body]
CVS commit by harald:
why not let the regexp do the dirty work?
M +4 -6 customprojectpart.cpp 1.31
--- kdevelop/parts/customproject/customprojectpart.cpp #1.30:1.31
@@ -471,5 +471,5 @@ void CustomProjectPart::updateTargetMenu
QTextStream stream(&f);
//QRegExp re(".PHONY\\s*:(.*)");
- static QRegExp re("^[^($%.#].*[^)\\s][:].*$");
+ QRegExp re("^([^($%.#].*[^)\\s])[:].*$");
QString str = "";
while (!stream.atEnd()) {
@@ -481,10 +481,8 @@ void CustomProjectPart::updateTargetMenu
// str += stream.readLine();
//}
- if (str.contains(re) == 1)
+ if (re.search(str) != -1)
{
- kdDebug(9025) << "Adding target: " << str.simplifyWhiteSpace() << endl;
- str = str.simplifyWhiteSpace().section(' ', 0, 0);
- str.truncate( str.length() - 1 ); // strip the colon
- m_targets += str;
+ kdDebug(9025) << "Adding target: " << re.cap(1) << endl;
+ m_targets += re.cap(1).simplifyWhiteSpace();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic