mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-16 23:51:20 +02:00
2025-04-29 Fred Gleason <fredg@paravelsystems.com>
* Modified regex code in ' RDConfig::provisioningHostShortName()' and 'RDConfig::provisioningServiceName()' to use the QRegularExpression class rather than QRegExp. * Added a 'test_provisioning' test harness in 'tests/'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QObject>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -255,17 +255,10 @@ QHostAddress RDConfig::provisioningHostIpAddress() const
|
||||
|
||||
QString RDConfig::provisioningHostShortName(const QString &hostname) const
|
||||
{
|
||||
/*
|
||||
* FIXME: Reimplement using QRegularExpression
|
||||
*/
|
||||
QRegExp exp(conf_provisioning_host_short_name_regex);
|
||||
QRegularExpression regex(conf_provisioning_host_short_name_regex);
|
||||
QRegularExpressionMatch match=regex.match(hostname);
|
||||
|
||||
exp.indexIn(hostname);
|
||||
QStringList texts=exp.capturedTexts();
|
||||
if((unsigned)texts.size()<conf_provisioning_host_short_name_group) {
|
||||
return QString();
|
||||
}
|
||||
return texts[conf_provisioning_host_short_name_group];
|
||||
return match.captured(conf_provisioning_host_short_name_group);
|
||||
}
|
||||
|
||||
|
||||
@@ -283,19 +276,10 @@ QString RDConfig::provisioningServiceTemplate() const
|
||||
|
||||
QString RDConfig::provisioningServiceName(const QString &hostname) const
|
||||
{
|
||||
/*
|
||||
* FIXME: Reimplement using QRegularExpression
|
||||
*
|
||||
QRegExp exp(conf_provisioning_service_name_regex);
|
||||
QRegularExpression regex(conf_provisioning_service_name_regex);
|
||||
QRegularExpressionMatch match=regex.match(hostname);
|
||||
|
||||
exp.indexIn(hostname);
|
||||
QStringList texts=exp.capturedTexts();
|
||||
if((unsigned)texts.size()<conf_provisioning_service_name_group) {
|
||||
return QString();
|
||||
}
|
||||
return texts[conf_provisioning_service_name_group];
|
||||
*/
|
||||
return QString();
|
||||
return match.captured(conf_provisioning_service_name_group);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user