Refactor system page in GUI Alpha.
This commit is contained in:
15
src/utilities/InputFormatValidator.cpp
Normal file
15
src/utilities/InputFormatValidator.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "InputFormatValidator.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
bool InputFormatValidator::ValidateIpAddressFormat(const QString& aIpAddress)
|
||||
{
|
||||
QRegularExpression regex("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
|
||||
return regex.match(aIpAddress).hasMatch();
|
||||
}
|
||||
|
||||
bool InputFormatValidator::ValidatePortFormat(const QString& aPort)
|
||||
{
|
||||
QRegularExpression regex("^([1-9]\\d{0,4}|0)$");
|
||||
return regex.match(aPort).hasMatch();
|
||||
}
|
||||
Reference in New Issue
Block a user