Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (796 Bytes) Statistiken
| Zweig: | Revision:
b7f1ce8e Christian Ehringfeld
#include "lengthvalidator.h"
using namespace CuteEntityManager;
LengthValidator::LengthValidator() : Validator() {
}

ErrorMsg LengthValidator::validateParam(QVariant value, Param param) const {
QString val = value.toString();
if (param.getName() == "min" && val.length() < param.getValue().toLongLong()) {
return ErrorMsg(param.getName(),
"<property> must have more than " + param.getValue().toString() +
" characters.");
} else if (param.getName() == "max"
&& val.length() > param.getValue().toLongLong() ) {
return ErrorMsg(param.getName(),
"<property> must have more than " + param.getValue().toString() +
"characters.");
}
return ErrorMsg();
}