summaryrefslogtreecommitdiff
path: root/validators/CallsignValidator.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2025-01-09 22:12:12 +0100
committerChristoph Berg <myon@debian.org>2025-01-09 22:12:12 +0100
commit98c02f78b26811ba5d9962ba27ec24cacf82bb22 (patch)
treedaaf609cde31d8fb3b6c3457c43663d14f0dda80 /validators/CallsignValidator.cpp
parent332d2ce88c2f0bc2908cacdc6707e2f9fa49f26d (diff)
parent992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (diff)
Update upstream source from tag 'upstream/2.7.0_rc8+repack'
Update to upstream version '2.7.0~rc8+repack' with Debian dir 6fce941c8282d35c8df23d3de779a42e27688bc1
Diffstat (limited to 'validators/CallsignValidator.cpp')
-rwxr-xr-xvalidators/CallsignValidator.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/validators/CallsignValidator.cpp b/validators/CallsignValidator.cpp
index 7b770181..d6aba538 100755
--- a/validators/CallsignValidator.cpp
+++ b/validators/CallsignValidator.cpp
@@ -1,27 +1,27 @@
-#include "CallsignValidator.hpp"
-
-CallsignValidator::CallsignValidator (QObject * parent, bool allow_compound)
- : QValidator {parent}
- , re_ {allow_compound ? R"(^[A-Z0-9/]+$)" : R"(^[A-Z0-9]+$)"}
-{
-}
-
-auto CallsignValidator::validate (QString& input, int& pos) const -> State
-{
- input = input.toUpper ();
- while (input.size () && input[0].isSpace ())
- {
- input.remove (0, 1);
- if (pos > 0) --pos;
- }
- while (input.size () && input[input.size () - 1].isSpace ())
- {
- if (pos > input.size ()) --pos;
- input.chop (1);
- }
- auto match = re_.match (input, 0, QRegularExpression::PartialPreferCompleteMatch);
- if (match.hasMatch ()) return Acceptable;
- if (!input.size () || match.hasPartialMatch ()) return Intermediate;
- pos = input.size ();
- return Invalid;
-}
+#include "CallsignValidator.hpp"
+
+CallsignValidator::CallsignValidator (QObject * parent, bool allow_compound)
+ : QValidator {parent}
+ , re_ {allow_compound ? R"(^[A-Z0-9/]+$)" : R"(^[A-Z0-9]+$)"}
+{
+}
+
+auto CallsignValidator::validate (QString& input, int& pos) const -> State
+{
+ input = input.toUpper ();
+ while (input.size () && input[0].isSpace ())
+ {
+ input.remove (0, 1);
+ if (pos > 0) --pos;
+ }
+ while (input.size () && input[input.size () - 1].isSpace ())
+ {
+ if (pos > input.size ()) --pos;
+ input.chop (1);
+ }
+ auto match = re_.match (input, 0, QRegularExpression::PartialPreferCompleteMatch);
+ if (match.hasMatch ()) return Acceptable;
+ if (!input.size () || match.hasPartialMatch ()) return Intermediate;
+ pos = input.size ();
+ return Invalid;
+}