beautify regexes

This commit is contained in:
Oswald Buddenhagen
2009-04-17 20:56:48 +02:00
parent c38cb83d05
commit 5b01ea1120

View File

@@ -36,12 +36,14 @@
namespace Core { namespace Core {
namespace Utils { namespace Utils {
#define WINDOWS_DEVICES "CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL"
// Naming a file like a device name will break on Windows, even if it is // Naming a file like a device name will break on Windows, even if it is
// "com1.txt". Since we are cross-platform, we generally disallow such file // "com1.txt". Since we are cross-platform, we generally disallow such file
// names. // names.
static const QRegExp &windowsDeviceNoSubDirPattern() static const QRegExp &windowsDeviceNoSubDirPattern()
{ {
static const QRegExp rc(QLatin1String("CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL"), static const QRegExp rc(QLatin1String(WINDOWS_DEVICES),
Qt::CaseInsensitive); Qt::CaseInsensitive);
QTC_ASSERT(rc.isValid(), return rc); QTC_ASSERT(rc.isValid(), return rc);
return rc; return rc;
@@ -49,8 +51,7 @@ static const QRegExp &windowsDeviceNoSubDirPattern()
static const QRegExp &windowsDeviceSubDirPattern() static const QRegExp &windowsDeviceSubDirPattern()
{ {
static const QRegExp rc(QLatin1String(".*[/\\\\]CON|.*[/\\\\]AUX|.*[/\\\\]PRN|.*[/\\\\]COM1|.*[/\\\\]COM2|.*[/\\\\]LPT1|.*[/\\\\]LPT2|.*[/\\\\]NUL"), static const QRegExp rc(QLatin1String(".*[/\\\\](" WINDOWS_DEVICES ")"), Qt::CaseInsensitive);
Qt::CaseInsensitive);
QTC_ASSERT(rc.isValid(), return rc); QTC_ASSERT(rc.isValid(), return rc);
return rc; return rc;
} }