summaryrefslogtreecommitdiff
path: root/validators/CallsignValidator.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-04-07 19:04:48 +0200
committerChristoph Berg <myon@debian.org>2026-04-07 19:04:48 +0200
commit9b9d6a272fa4204d45956828da3f20b7be49f675 (patch)
treeb611f981259a12a2bfd4d7305843929447f1bb74 /validators/CallsignValidator.cpp
parent2f7ab3ab46786fa2a5931dae22a1b119b5cfdafa (diff)
parentf647d78463c1250ce9c99af664615fafccf5e959 (diff)
Update upstream source from tag 'upstream/3.0.0'
Update to upstream version '3.0.0' with Debian dir 3b764e9a4be12ad8351230b538640dd98ddb9d05
Diffstat (limited to 'validators/CallsignValidator.cpp')
-rw-r--r--[-rwxr-xr-x]validators/CallsignValidator.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/validators/CallsignValidator.cpp b/validators/CallsignValidator.cpp
index 7b770181..d6aba538 100755..100644
--- 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;
+}