diff options
Diffstat (limited to 'src/lccnvalidator.cpp')
-rw-r--r-- | src/lccnvalidator.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lccnvalidator.cpp b/src/lccnvalidator.cpp index 8c47931..9b103dd 100644 --- a/src/lccnvalidator.cpp +++ b/src/lccnvalidator.cpp @@ -16,8 +16,8 @@ using Tellico::LCCNValidator; -LCCNValidator::LCCNValidator(QObject* parent_) : QRegExpValidator(parent_) { - QRegExp rx(QString::fromLatin1("[a-z ]{0,3}" +LCCNValidator::LCCNValidator(TQObject* tqparent_) : TQRegExpValidator(tqparent_) { + TQRegExp rx(TQString::tqfromLatin1("[a-z ]{0,3}" "(" "\\d{2}-?\\d{1,6}" "|" @@ -28,24 +28,24 @@ LCCNValidator::LCCNValidator(QObject* parent_) : QRegExpValidator(parent_) { } // static -QString LCCNValidator::formalize(const QString& value_) { +TQString LCCNValidator::formalize(const TQString& value_) { const int len = value_.length(); // first remove alpha prefix - QString alpha; + TQString alpha; for(int pos = 0; pos < len; ++pos) { - QChar c = value_.at(pos); + TQChar c = value_.at(pos); if(c.isNumber()) { break; } alpha += value_.at(pos); } - QString afterAlpha = value_.mid(alpha.length()); + TQString afterAlpha = value_.mid(alpha.length()); alpha = alpha.stripWhiteSpace(); // possible to have a space at the end - QString year; - QString serial; + TQString year; + TQString serial; // have to be able to differentiate 2 and 4-digit years, first check for hyphen position - int pos = afterAlpha.find('-'); + int pos = afterAlpha.tqfind('-'); if(pos > -1) { year = afterAlpha.section('-', 0, 0); serial = afterAlpha.section('-', 1); @@ -54,7 +54,7 @@ QString LCCNValidator::formalize(const QString& value_) { // or from any year after 2100. Reasonable, right? // so if the string starts with '20' we take the first 4 digits as the year // otherwise the first 2 - if(afterAlpha.startsWith(QString::fromLatin1("20"))) { + if(afterAlpha.startsWith(TQString::tqfromLatin1("20"))) { year = afterAlpha.left(4); serial = afterAlpha.mid(4); } else { @@ -66,7 +66,7 @@ QString LCCNValidator::formalize(const QString& value_) { // now check for non digits in the serial pos = 0; for( ; pos < serial.length() && serial.at(pos).isNumber(); ++pos) { ; } - QString suffix = serial.mid(pos); + TQString suffix = serial.mid(pos); serial = serial.left(pos); // serial must be left-padded with zeros to 6 characters serial = serial.rightJustify(6, '0'); |