summaryrefslogtreecommitdiff
path: root/Radio.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-11-16 21:54:50 +0100
committerChristoph Berg <myon@debian.org>2020-11-16 21:54:50 +0100
commit77922fa33547ce24535f2e514c9a112dcb496f18 (patch)
tree9f82b0ee01281b315f43a4c60d678927b4c6ca59 /Radio.cpp
parent7aa3c56b01768ba7d38fccedc17b30a4046b3fbb (diff)
New upstream version 2.3.0~rc2+repackupstream/2.3.0_rc2+repack
Diffstat (limited to 'Radio.cpp')
-rw-r--r--Radio.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Radio.cpp b/Radio.cpp
index e5b34c35..56b94373 100644
--- a/Radio.cpp
+++ b/Radio.cpp
@@ -14,10 +14,16 @@ namespace Radio
double constexpr MHz_factor {1.e6};
int constexpr frequency_precsion {6};
+ // valid callsign alphabet
+ QRegularExpression callsign_alphabet_re {R"(^[A-Z0-9/]{3,11}$)"};
+
// very loose validation - callsign must contain a letter next to
// a number
QRegularExpression valid_callsign_regexp {R"(\d[[:alpha:]]|[[:alpha:]]\d)"};
+ // standard callsign
+ QRegularExpression strict_standard_callsign_re {R"(^([A-Z][0-9]?|[0-9][A-Z])[0-9][A-Z]{0,3}$)"};
+
// suffixes that are often used and should not be interpreted as a
// DXCC Entity prefix used as a suffix
QRegularExpression non_prefix_suffix {R"(\A([0-9AMPQR]|QRP|F[DF]|[AM]M|L[HT]|LGT)\z)"};
@@ -112,6 +118,12 @@ namespace Radio
return callsign.contains ('/');
}
+ bool is_77bit_nonstandard_callsign (QString const& callsign)
+ {
+ return callsign.contains (callsign_alphabet_re)
+ && !callsign.contains (strict_standard_callsign_re);
+ }
+
// split on first '/' and return the larger portion or the whole if
// there is no '/'
QString base_callsign (QString callsign)