[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Feb 5 15:22:35 UTC 2005
CVS commit by okellogg:
formatComment(): Start and end of comment are optional.
M +17 -4 classimport.cpp 1.73
--- kdesdk/umbrello/umbrello/classimport.cpp #1.72:1.73
@@ -53,8 +53,21 @@ ClassImport::~ClassImport() {}
QString ClassImport::formatComment(const QString &comment) {
QStringList lines = QStringList::split("\n", comment);
- if (!lines.first().contains("/*"))
- return "";
- lines.pop_front(); // remove comment start
- lines.pop_back(); // remove comment end
+ QString& first = lines.first();
+ QRegExp wordex("\\w");
+ if (first.startsWith("/*")) {
+ int wordpos = wordex.search(first);
+ if (wordpos != -1)
+ first = first.mid(wordpos); // remove comment start
+ else
+ lines.pop_front(); // nothing interesting on this line
+ }
+ QString& last = lines.last();
+ int endpos = last.find("*/");
+ if (endpos != -1) {
+ if (last.contains(wordex))
+ last = last.mid(0, endpos - 1); // remove comment end
+ else
+ lines.pop_back(); // nothing interesting on this line
+ }
if (! lines.count())
return "";
More information about the umbrello-devel
mailing list