mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Remove the comments from qss
This commit is contained in:
committed by
Mat Sutcliffe
parent
dd37c7b876
commit
d875df6fc7
@@ -151,7 +151,7 @@ namespace BlackGui
|
||||
{
|
||||
if (needsWatcher) { m_fileWatcher.addPath(absolutePath); }
|
||||
QTextStream in(&file);
|
||||
const QString c = in.readAll();
|
||||
const QString c = removeComments(in.readAll(), true, true);
|
||||
const QString f = fileInfo.fileName().toLower();
|
||||
|
||||
// keep even empty files as placeholders
|
||||
|
||||
@@ -433,6 +433,19 @@ namespace BlackMisc
|
||||
return in;
|
||||
}
|
||||
|
||||
QString removeComments(const QString &in, bool removeSlashStar, bool removeDoubleSlash)
|
||||
{
|
||||
QString copy(in);
|
||||
|
||||
thread_local const QRegularExpression re1("\\/\\*(.|\\n)*?\\*\\/");
|
||||
if (removeSlashStar) { copy.remove(re1); }
|
||||
|
||||
thread_local const QRegularExpression re2("\\/\\/.*");
|
||||
if (removeDoubleSlash) { copy.remove(re2); }
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -289,6 +289,9 @@ namespace BlackMisc
|
||||
//! Convert string to bool
|
||||
BLACKMISC_EXPORT QString joinStringSet(const QSet<QString> &set, const QString &separator);
|
||||
|
||||
//! Remove comments such as /** **/ or //
|
||||
BLACKMISC_EXPORT QString removeComments(const QString &in, bool removeSlash, bool removeDoubleSlash);
|
||||
|
||||
namespace Mixin
|
||||
{
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user